OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync_file_system/local_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/local_file_sync_service.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/sync_file_system/local_change_processor.h" | 11 #include "chrome/browser/sync_file_system/local_change_processor.h" |
| 12 #include "chrome/browser/sync_file_system/logger.h" |
12 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
15 #include "content/public/browser/storage_partition.h" | 16 #include "content/public/browser/storage_partition.h" |
16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
17 #include "webkit/fileapi/file_system_context.h" | 18 #include "webkit/fileapi/file_system_context.h" |
18 #include "webkit/fileapi/file_system_url.h" | 19 #include "webkit/fileapi/file_system_url.h" |
19 #include "webkit/fileapi/syncable/file_change.h" | 20 #include "webkit/fileapi/syncable/file_change.h" |
20 #include "webkit/fileapi/syncable/local_file_change_tracker.h" | 21 #include "webkit/fileapi/syncable/local_file_change_tracker.h" |
21 #include "webkit/fileapi/syncable/local_file_sync_context.h" | 22 #include "webkit/fileapi/syncable/local_file_sync_context.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (!ContainsKey(origin_to_contexts_, url.origin())) { | 194 if (!ContainsKey(origin_to_contexts_, url.origin())) { |
194 // This could happen if a remote sync is triggered for the app that hasn't | 195 // This could happen if a remote sync is triggered for the app that hasn't |
195 // been initialized in this service. | 196 // been initialized in this service. |
196 DCHECK(profile_); | 197 DCHECK(profile_); |
197 // The given url.origin() must be for valid installed app. | 198 // The given url.origin() must be for valid installed app. |
198 ExtensionService* extension_service = | 199 ExtensionService* extension_service = |
199 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 200 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
200 const extensions::Extension* extension = extension_service->GetInstalledApp( | 201 const extensions::Extension* extension = extension_service->GetInstalledApp( |
201 url.origin()); | 202 url.origin()); |
202 if (!extension) { | 203 if (!extension) { |
203 LOG(WARNING) << "PrepareForProcessRemoteChange called for non-existing " | 204 util::Log( |
204 << " origin:" << url.origin().spec(); | 205 logging::LOG_WARNING, |
| 206 FROM_HERE, |
| 207 "PrepareForProcessRemoteChange called for non-existing origin: %s", |
| 208 url.origin().spec().c_str()); |
| 209 |
205 // The extension has been uninstalled and this method is called | 210 // The extension has been uninstalled and this method is called |
206 // before the remote changes for the origin are removed. | 211 // before the remote changes for the origin are removed. |
207 callback.Run(SYNC_STATUS_NO_CHANGE_TO_SYNC, | 212 callback.Run(SYNC_STATUS_NO_CHANGE_TO_SYNC, |
208 SyncFileMetadata(), FileChangeList()); | 213 SyncFileMetadata(), FileChangeList()); |
209 return; | 214 return; |
210 } | 215 } |
211 GURL site_url = extension_service->GetSiteForExtensionId(extension->id()); | 216 GURL site_url = extension_service->GetSiteForExtensionId(extension->id()); |
212 DCHECK(!site_url.is_empty()); | 217 DCHECK(!site_url.is_empty()); |
213 scoped_refptr<fileapi::FileSystemContext> file_system_context = | 218 scoped_refptr<fileapi::FileSystemContext> file_system_context = |
214 content::BrowserContext::GetStoragePartitionForSite( | 219 content::BrowserContext::GetStoragePartitionForSite( |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 changes.front(), | 419 changes.front(), |
415 sync_file_info.local_file_path, | 420 sync_file_info.local_file_path, |
416 sync_file_info.metadata, | 421 sync_file_info.metadata, |
417 url, | 422 url, |
418 base::Bind(&LocalFileSyncService::ProcessNextChangeForURL, | 423 base::Bind(&LocalFileSyncService::ProcessNextChangeForURL, |
419 AsWeakPtr(), sync_file_info, | 424 AsWeakPtr(), sync_file_info, |
420 changes.front(), changes.PopAndGetNewList())); | 425 changes.front(), changes.PopAndGetNewList())); |
421 } | 426 } |
422 | 427 |
423 } // namespace sync_file_system | 428 } // namespace sync_file_system |
OLD | NEW |