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 "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/extensions/extension_system.h" |
8 #include "chrome/browser/extensions/pending_extension_manager.h" | 9 #include "chrome/browser/extensions/pending_extension_manager.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/sync/profile_sync_service.h" | 12 #include "chrome/browser/sync/profile_sync_service.h" |
12 #include "chrome/browser/sync/profile_sync_service_factory.h" | 13 #include "chrome/browser/sync/profile_sync_service_factory.h" |
13 #include "chrome/browser/ui/ash/app_sync_ui_state_factory.h" | 14 #include "chrome/browser/ui/ash/app_sync_ui_state_factory.h" |
14 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" | 15 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" |
15 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
16 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
17 | 18 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 FOR_EACH_OBSERVER(AppSyncUIStateObserver, | 116 FOR_EACH_OBSERVER(AppSyncUIStateObserver, |
116 observers_, | 117 observers_, |
117 OnAppSyncUIStatusChanged()); | 118 OnAppSyncUIStatusChanged()); |
118 } | 119 } |
119 | 120 |
120 void AppSyncUIState::CheckAppSync() { | 121 void AppSyncUIState::CheckAppSync() { |
121 if (!sync_service_ || !sync_service_->HasSyncSetupCompleted()) | 122 if (!sync_service_ || !sync_service_->HasSyncSetupCompleted()) |
122 return; | 123 return; |
123 | 124 |
124 const bool synced = sync_service_->ShouldPushChanges(); | 125 const bool synced = sync_service_->ShouldPushChanges(); |
125 const bool has_pending_extension = profile_->GetExtensionService()-> | 126 const bool has_pending_extension = |
126 pending_extension_manager()->HasPendingExtensionFromSync(); | 127 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
| 128 pending_extension_manager()->HasPendingExtensionFromSync(); |
127 | 129 |
128 if (synced && !has_pending_extension) | 130 if (synced && !has_pending_extension) |
129 SetStatus(STATUS_NORMAL); | 131 SetStatus(STATUS_NORMAL); |
130 else | 132 else |
131 SetStatus(STATUS_SYNCING); | 133 SetStatus(STATUS_SYNCING); |
132 } | 134 } |
133 | 135 |
134 void AppSyncUIState::OnMaxSyncingTimer() { | 136 void AppSyncUIState::OnMaxSyncingTimer() { |
135 SetStatus(STATUS_TIMED_OUT); | 137 SetStatus(STATUS_TIMED_OUT); |
136 } | 138 } |
137 | 139 |
138 void AppSyncUIState::Observe(int type, | 140 void AppSyncUIState::Observe(int type, |
139 const content::NotificationSource& source, | 141 const content::NotificationSource& source, |
140 const content::NotificationDetails& details) { | 142 const content::NotificationDetails& details) { |
141 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_LOADED, type); | 143 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_LOADED, type); |
142 CheckAppSync(); | 144 CheckAppSync(); |
143 } | 145 } |
144 | 146 |
145 void AppSyncUIState::OnStateChanged() { | 147 void AppSyncUIState::OnStateChanged() { |
146 DCHECK(sync_service_); | 148 DCHECK(sync_service_); |
147 CheckAppSync(); | 149 CheckAppSync(); |
148 } | 150 } |
OLD | NEW |