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 "Disabling origin for UNLOAD(DISABLE) failed: %s", |
73 origin.spec().c_str()); | |
tzik
2013/05/22 09:30:54
This replacement drops the location of the log (e.
calvinlo
2013/05/23 10:00:15
Thanks for pointing this out and suggesting the im
| |
72 break; | 74 break; |
73 case extension_misc::UNLOAD_REASON_UNINSTALL: | 75 case extension_misc::UNLOAD_REASON_UNINSTALL: |
74 LOG(WARNING) << "Uninstall origin for UNLOAD(UNINSTALL) failed: " | 76 util::Log(logging::LOG_WARNING, |
75 << origin.spec(); | 77 "Uninstall origin for UNLOAD(UNINSTALL) failed: %s", |
78 origin.spec().c_str()); | |
76 break; | 79 break; |
77 default: | 80 default: |
78 break; | 81 break; |
79 } | 82 } |
80 } | 83 } |
81 } | 84 } |
82 | 85 |
83 void DidHandleOriginForExtensionEnabledEvent( | 86 void DidHandleOriginForExtensionEnabledEvent( |
84 int type, | 87 int type, |
85 const GURL& origin, | 88 const GURL& origin, |
86 SyncStatusCode code) { | 89 SyncStatusCode code) { |
87 DCHECK(chrome::NOTIFICATION_EXTENSION_ENABLED == type); | 90 DCHECK(chrome::NOTIFICATION_EXTENSION_ENABLED == type); |
88 if (code != SYNC_STATUS_OK) | 91 if (code != SYNC_STATUS_OK) |
89 LOG(WARNING) << "Enabling origin for ENABLED failed: " << origin.spec(); | 92 util::Log(logging::LOG_WARNING, |
93 "Enabling origin for ENABLED failed: %s", | |
94 origin.spec().c_str()); | |
90 } | 95 } |
91 | 96 |
92 } // namespace | 97 } // namespace |
93 | 98 |
94 void SyncFileSystemService::Shutdown() { | 99 void SyncFileSystemService::Shutdown() { |
95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
96 | 101 |
97 local_file_service_->Shutdown(); | 102 local_file_service_->Shutdown(); |
98 local_file_service_.reset(); | 103 local_file_service_.reset(); |
99 | 104 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
560 syncer::APPS); | 565 syncer::APPS); |
561 remote_file_service_->SetSyncEnabled(sync_enabled_); | 566 remote_file_service_->SetSyncEnabled(sync_enabled_); |
562 if (sync_enabled_) { | 567 if (sync_enabled_) { |
563 base::MessageLoopProxy::current()->PostTask( | 568 base::MessageLoopProxy::current()->PostTask( |
564 FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync, | 569 FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync, |
565 AsWeakPtr())); | 570 AsWeakPtr())); |
566 } | 571 } |
567 } | 572 } |
568 | 573 |
569 } // namespace sync_file_system | 574 } // namespace sync_file_system |
OLD | NEW |