| 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/ui/ash/app_sync_ui_state.h" | 5 #include "chrome/browser/ui/ash/app_sync_ui_state.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/pending_extension_manager.h" | 9 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 base::TimeDelta::FromMilliseconds(kMaxSyncingTimeMs), | 102 base::TimeDelta::FromMilliseconds(kMaxSyncingTimeMs), |
| 103 this, &AppSyncUIState::OnMaxSyncingTimer); | 103 this, &AppSyncUIState::OnMaxSyncingTimer); |
| 104 break; | 104 break; |
| 105 case STATUS_NORMAL: | 105 case STATUS_NORMAL: |
| 106 case STATUS_TIMED_OUT: | 106 case STATUS_TIMED_OUT: |
| 107 max_syncing_status_timer_.Stop(); | 107 max_syncing_status_timer_.Stop(); |
| 108 StopObserving(); | 108 StopObserving(); |
| 109 break; | 109 break; |
| 110 } | 110 } |
| 111 | 111 |
| 112 FOR_EACH_OBSERVER(AppSyncUIStateObserver, | 112 for (AppSyncUIStateObserver& observer : observers_) |
| 113 observers_, | 113 observer.OnAppSyncUIStatusChanged(); |
| 114 OnAppSyncUIStatusChanged()); | |
| 115 } | 114 } |
| 116 | 115 |
| 117 void AppSyncUIState::CheckAppSync() { | 116 void AppSyncUIState::CheckAppSync() { |
| 118 if (!sync_service_ || !sync_service_->IsFirstSetupComplete()) | 117 if (!sync_service_ || !sync_service_->IsFirstSetupComplete()) |
| 119 return; | 118 return; |
| 120 | 119 |
| 121 const bool synced = sync_service_->IsSyncActive(); | 120 const bool synced = sync_service_->IsSyncActive(); |
| 122 const bool has_pending_extension = | 121 const bool has_pending_extension = |
| 123 extensions::ExtensionSystem::Get(profile_)->extension_service()-> | 122 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
| 124 pending_extension_manager()->HasPendingExtensionFromSync(); | 123 pending_extension_manager()->HasPendingExtensionFromSync(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 135 | 134 |
| 136 void AppSyncUIState::OnStateChanged() { | 135 void AppSyncUIState::OnStateChanged() { |
| 137 DCHECK(sync_service_); | 136 DCHECK(sync_service_); |
| 138 CheckAppSync(); | 137 CheckAppSync(); |
| 139 } | 138 } |
| 140 | 139 |
| 141 void AppSyncUIState::OnExtensionLoaded(content::BrowserContext* browser_context, | 140 void AppSyncUIState::OnExtensionLoaded(content::BrowserContext* browser_context, |
| 142 const extensions::Extension* extension) { | 141 const extensions::Extension* extension) { |
| 143 CheckAppSync(); | 142 CheckAppSync(); |
| 144 } | 143 } |
| OLD | NEW |