| 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/sync_file_system_service.h" | 5 #include "chrome/browser/sync_file_system/sync_file_system_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "chrome/browser/extensions/api/sync_file_system/extension_sync_event_ob
server.h" | 13 #include "chrome/browser/extensions/api/sync_file_system/extension_sync_event_ob
server.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/sync/profile_sync_service.h" | 15 #include "chrome/browser/sync/profile_sync_service.h" |
| 16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 16 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 17 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" | 17 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" |
| 18 #include "chrome/browser/sync_file_system/local_file_sync_service.h" | 18 #include "chrome/browser/sync_file_system/local_file_sync_service.h" |
| 19 #include "chrome/browser/sync_file_system/logger.h" |
| 19 #include "chrome/browser/sync_file_system/sync_event_observer.h" | 20 #include "chrome/browser/sync_file_system/sync_event_observer.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
| 21 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 22 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 23 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
| 25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 26 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
| 27 #include "webkit/fileapi/file_system_context.h" | 28 #include "webkit/fileapi/file_system_context.h" |
| 28 #include "webkit/fileapi/syncable/sync_direction.h" | 29 #include "webkit/fileapi/syncable/sync_direction.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 extension_misc::UnloadedExtensionReason reason, | 61 extension_misc::UnloadedExtensionReason reason, |
| 61 const GURL& origin, | 62 const GURL& origin, |
| 62 SyncStatusCode code) { | 63 SyncStatusCode code) { |
| 63 DCHECK(chrome::NOTIFICATION_EXTENSION_UNLOADED == type); | 64 DCHECK(chrome::NOTIFICATION_EXTENSION_UNLOADED == type); |
| 64 DCHECK(extension_misc::UNLOAD_REASON_DISABLE == reason || | 65 DCHECK(extension_misc::UNLOAD_REASON_DISABLE == reason || |
| 65 extension_misc::UNLOAD_REASON_UNINSTALL == reason); | 66 extension_misc::UNLOAD_REASON_UNINSTALL == reason); |
| 66 if (code != SYNC_STATUS_OK && | 67 if (code != SYNC_STATUS_OK && |
| 67 code != SYNC_STATUS_UNKNOWN_ORIGIN) { | 68 code != SYNC_STATUS_UNKNOWN_ORIGIN) { |
| 68 switch (reason) { | 69 switch (reason) { |
| 69 case extension_misc::UNLOAD_REASON_DISABLE: | 70 case extension_misc::UNLOAD_REASON_DISABLE: |
| 70 LOG(WARNING) << "Disabling origin for UNLOAD(DISABLE) failed: " | 71 util::Log(logging::LOG_WARNING, |
| 71 << origin.spec(); | 72 FROM_HERE, |
| 73 "Disabling origin for UNLOAD(DISABLE) failed: %s", |
| 74 origin.spec().c_str()); |
| 72 break; | 75 break; |
| 73 case extension_misc::UNLOAD_REASON_UNINSTALL: | 76 case extension_misc::UNLOAD_REASON_UNINSTALL: |
| 74 LOG(WARNING) << "Uninstall origin for UNLOAD(UNINSTALL) failed: " | 77 util::Log(logging::LOG_WARNING, |
| 75 << origin.spec(); | 78 FROM_HERE, |
| 79 "Uninstall origin for UNLOAD(UNINSTALL) failed: %s", |
| 80 origin.spec().c_str()); |
| 76 break; | 81 break; |
| 77 default: | 82 default: |
| 78 break; | 83 break; |
| 79 } | 84 } |
| 80 } | 85 } |
| 81 } | 86 } |
| 82 | 87 |
| 83 void DidHandleOriginForExtensionEnabledEvent( | 88 void DidHandleOriginForExtensionEnabledEvent( |
| 84 int type, | 89 int type, |
| 85 const GURL& origin, | 90 const GURL& origin, |
| 86 SyncStatusCode code) { | 91 SyncStatusCode code) { |
| 87 DCHECK(chrome::NOTIFICATION_EXTENSION_ENABLED == type); | 92 DCHECK(chrome::NOTIFICATION_EXTENSION_ENABLED == type); |
| 88 if (code != SYNC_STATUS_OK) | 93 if (code != SYNC_STATUS_OK) |
| 89 LOG(WARNING) << "Enabling origin for ENABLED failed: " << origin.spec(); | 94 util::Log(logging::LOG_WARNING, |
| 95 FROM_HERE, |
| 96 "Enabling origin for ENABLED failed: %s", |
| 97 origin.spec().c_str()); |
| 90 } | 98 } |
| 91 | 99 |
| 92 } // namespace | 100 } // namespace |
| 93 | 101 |
| 94 void SyncFileSystemService::Shutdown() { | 102 void SyncFileSystemService::Shutdown() { |
| 95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 96 | 104 |
| 97 local_file_service_->Shutdown(); | 105 local_file_service_->Shutdown(); |
| 98 local_file_service_.reset(); | 106 local_file_service_.reset(); |
| 99 | 107 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 syncer::APPS); | 568 syncer::APPS); |
| 561 remote_file_service_->SetSyncEnabled(sync_enabled_); | 569 remote_file_service_->SetSyncEnabled(sync_enabled_); |
| 562 if (sync_enabled_) { | 570 if (sync_enabled_) { |
| 563 base::MessageLoopProxy::current()->PostTask( | 571 base::MessageLoopProxy::current()->PostTask( |
| 564 FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync, | 572 FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync, |
| 565 AsWeakPtr())); | 573 AsWeakPtr())); |
| 566 } | 574 } |
| 567 } | 575 } |
| 568 | 576 |
| 569 } // namespace sync_file_system | 577 } // namespace sync_file_system |
| OLD | NEW |