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/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 NOTREACHED(); | 66 NOTREACHED(); |
67 } | 67 } |
68 NOTREACHED() << "Unknown remote service state: " << state; | 68 NOTREACHED() << "Unknown remote service state: " << state; |
69 return SYNC_SERVICE_DISABLED; | 69 return SYNC_SERVICE_DISABLED; |
70 } | 70 } |
71 | 71 |
72 void DidHandleOriginForExtensionUnloadedEvent( | 72 void DidHandleOriginForExtensionUnloadedEvent( |
73 int type, | 73 int type, |
74 const GURL& origin, | 74 const GURL& origin, |
75 SyncStatusCode code) { | 75 SyncStatusCode code) { |
76 DCHECK(chrome::NOTIFICATION_EXTENSION_UNLOADED == type || | 76 DCHECK(chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED == type || |
77 chrome::NOTIFICATION_EXTENSION_UNINSTALLED == type); | 77 chrome::NOTIFICATION_EXTENSION_UNINSTALLED == type); |
78 if (code != SYNC_STATUS_OK && | 78 if (code != SYNC_STATUS_OK && |
79 code != SYNC_STATUS_UNKNOWN_ORIGIN) { | 79 code != SYNC_STATUS_UNKNOWN_ORIGIN) { |
80 switch (type) { | 80 switch (type) { |
81 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 81 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
82 util::Log(logging::LOG_WARNING, | 82 util::Log(logging::LOG_WARNING, |
83 FROM_HERE, | 83 FROM_HERE, |
84 "Disabling origin for UNLOADED(DISABLE) failed: %s", | 84 "Disabling origin for UNLOADED(DISABLE) failed: %s", |
85 origin.spec().c_str()); | 85 origin.spec().c_str()); |
86 break; | 86 break; |
87 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: | 87 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: |
88 util::Log(logging::LOG_WARNING, | 88 util::Log(logging::LOG_WARNING, |
89 FROM_HERE, | 89 FROM_HERE, |
90 "Uninstall origin for UNINSTALLED failed: %s", | 90 "Uninstall origin for UNINSTALLED failed: %s", |
91 origin.spec().c_str()); | 91 origin.spec().c_str()); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 ProfileSyncServiceBase* profile_sync_service = | 437 ProfileSyncServiceBase* profile_sync_service = |
438 ProfileSyncServiceFactory::GetForProfile(profile_); | 438 ProfileSyncServiceFactory::GetForProfile(profile_); |
439 if (profile_sync_service) { | 439 if (profile_sync_service) { |
440 UpdateSyncEnabledStatus(profile_sync_service); | 440 UpdateSyncEnabledStatus(profile_sync_service); |
441 profile_sync_service->AddObserver(this); | 441 profile_sync_service->AddObserver(this); |
442 } | 442 } |
443 | 443 |
444 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 444 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
445 content::Source<Profile>(profile_)); | 445 content::Source<Profile>(profile_)); |
446 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 446 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
447 content::Source<Profile>(profile_)); | 447 content::Source<Profile>(profile_)); |
448 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 448 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
449 content::Source<Profile>(profile_)); | 449 content::Source<Profile>(profile_)); |
450 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED, | 450 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED, |
451 content::Source<Profile>(profile_)); | 451 content::Source<Profile>(profile_)); |
452 } | 452 } |
453 | 453 |
454 void SyncFileSystemService::DidInitializeFileSystem( | 454 void SyncFileSystemService::DidInitializeFileSystem( |
455 const GURL& app_origin, | 455 const GURL& app_origin, |
456 const SyncStatusCallback& callback, | 456 const SyncStatusCallback& callback, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 // Uninstall: UNINSTALLED. | 612 // Uninstall: UNINSTALLED. |
613 // Launch, Close: No notification. | 613 // Launch, Close: No notification. |
614 // Enable: ENABLED. | 614 // Enable: ENABLED. |
615 // Disable: UNLOADED(DISABLE). | 615 // Disable: UNLOADED(DISABLE). |
616 // Reload, Restart: UNLOADED(DISABLE) -> INSTALLED -> ENABLED. | 616 // Reload, Restart: UNLOADED(DISABLE) -> INSTALLED -> ENABLED. |
617 // | 617 // |
618 switch (type) { | 618 switch (type) { |
619 case chrome::NOTIFICATION_EXTENSION_INSTALLED: | 619 case chrome::NOTIFICATION_EXTENSION_INSTALLED: |
620 HandleExtensionInstalled(details); | 620 HandleExtensionInstalled(details); |
621 break; | 621 break; |
622 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 622 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
623 HandleExtensionUnloaded(type, details); | 623 HandleExtensionUnloaded(type, details); |
624 break; | 624 break; |
625 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: | 625 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: |
626 HandleExtensionUninstalled(type, details); | 626 HandleExtensionUninstalled(type, details); |
627 break; | 627 break; |
628 case chrome::NOTIFICATION_EXTENSION_ENABLED: | 628 case chrome::NOTIFICATION_EXTENSION_ENABLED: |
629 HandleExtensionEnabled(type, details); | 629 HandleExtensionEnabled(type, details); |
630 break; | 630 break; |
631 default: | 631 default: |
632 NOTREACHED() << "Unknown notification."; | 632 NOTREACHED() << "Unknown notification."; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get()); | 776 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get()); |
777 v2_remote_service_->SetSyncEnabled(sync_enabled_); | 777 v2_remote_service_->SetSyncEnabled(sync_enabled_); |
778 v2_remote_service_->SetDefaultConflictResolutionPolicy( | 778 v2_remote_service_->SetDefaultConflictResolutionPolicy( |
779 remote_service_->GetDefaultConflictResolutionPolicy()); | 779 remote_service_->GetDefaultConflictResolutionPolicy()); |
780 remote_sync_runners_.push_back(v2_remote_syncer.release()); | 780 remote_sync_runners_.push_back(v2_remote_syncer.release()); |
781 } | 781 } |
782 return v2_remote_service_.get(); | 782 return v2_remote_service_.get(); |
783 } | 783 } |
784 | 784 |
785 } // namespace sync_file_system | 785 } // namespace sync_file_system |
OLD | NEW |