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 "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 FOR_EACH_OBSERVER(AppSyncUIStateObserver, | 118 FOR_EACH_OBSERVER(AppSyncUIStateObserver, |
119 observers_, | 119 observers_, |
120 OnAppSyncUIStatusChanged()); | 120 OnAppSyncUIStatusChanged()); |
121 } | 121 } |
122 | 122 |
123 void AppSyncUIState::CheckAppSync() { | 123 void AppSyncUIState::CheckAppSync() { |
124 if (!sync_service_ || !sync_service_->HasSyncSetupCompleted()) | 124 if (!sync_service_ || !sync_service_->HasSyncSetupCompleted()) |
125 return; | 125 return; |
126 | 126 |
127 const bool synced = sync_service_->SyncActive(); | 127 const bool synced = sync_service_->IsSyncActive(); |
128 const bool has_pending_extension = | 128 const bool has_pending_extension = |
129 extensions::ExtensionSystem::Get(profile_)->extension_service()-> | 129 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
130 pending_extension_manager()->HasPendingExtensionFromSync(); | 130 pending_extension_manager()->HasPendingExtensionFromSync(); |
131 | 131 |
132 if (synced && !has_pending_extension) | 132 if (synced && !has_pending_extension) |
133 SetStatus(STATUS_NORMAL); | 133 SetStatus(STATUS_NORMAL); |
134 else | 134 else |
135 SetStatus(STATUS_SYNCING); | 135 SetStatus(STATUS_SYNCING); |
136 } | 136 } |
137 | 137 |
138 void AppSyncUIState::OnMaxSyncingTimer() { | 138 void AppSyncUIState::OnMaxSyncingTimer() { |
139 SetStatus(STATUS_TIMED_OUT); | 139 SetStatus(STATUS_TIMED_OUT); |
140 } | 140 } |
141 | 141 |
142 void AppSyncUIState::OnStateChanged() { | 142 void AppSyncUIState::OnStateChanged() { |
143 DCHECK(sync_service_); | 143 DCHECK(sync_service_); |
144 CheckAppSync(); | 144 CheckAppSync(); |
145 } | 145 } |
146 | 146 |
147 void AppSyncUIState::OnExtensionLoaded(content::BrowserContext* browser_context, | 147 void AppSyncUIState::OnExtensionLoaded(content::BrowserContext* browser_context, |
148 const extensions::Extension* extension) { | 148 const extensions::Extension* extension) { |
149 CheckAppSync(); | 149 CheckAppSync(); |
150 } | 150 } |
OLD | NEW |