OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/supervised_user_service.h" | 5 #include "chrome/browser/supervised_user/supervised_user_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 result.Put(syncer::EXTENSIONS); | 1250 result.Put(syncer::EXTENSIONS); |
1251 result.Put(syncer::EXTENSION_SETTINGS); | 1251 result.Put(syncer::EXTENSION_SETTINGS); |
1252 result.Put(syncer::APPS); | 1252 result.Put(syncer::APPS); |
1253 result.Put(syncer::APP_SETTINGS); | 1253 result.Put(syncer::APP_SETTINGS); |
1254 result.Put(syncer::APP_NOTIFICATIONS); | 1254 result.Put(syncer::APP_NOTIFICATIONS); |
1255 result.Put(syncer::APP_LIST); | 1255 result.Put(syncer::APP_LIST); |
1256 return result; | 1256 return result; |
1257 } | 1257 } |
1258 | 1258 |
1259 #if !defined(OS_ANDROID) | 1259 #if !defined(OS_ANDROID) |
1260 void SupervisedUserService::OnStateChanged() { | 1260 void SupervisedUserService::OnStateChanged(syncer::SyncService* sync) { |
1261 browser_sync::ProfileSyncService* service = | 1261 if (waiting_for_sync_initialization_ && sync->IsEngineInitialized()) { |
1262 ProfileSyncServiceFactory::GetForProfile(profile_); | |
1263 if (waiting_for_sync_initialization_ && service->IsEngineInitialized()) { | |
1264 waiting_for_sync_initialization_ = false; | 1262 waiting_for_sync_initialization_ = false; |
1265 service->RemoveObserver(this); | 1263 sync->RemoveObserver(this); |
1266 FinishSetupSync(); | 1264 FinishSetupSync(); |
1267 return; | 1265 return; |
1268 } | 1266 } |
1269 | 1267 |
1270 DLOG_IF(ERROR, service->GetAuthError().state() == | 1268 DLOG_IF(ERROR, sync->GetAuthError().state() == |
1271 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS) | 1269 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS) |
1272 << "Credentials rejected"; | 1270 << "Credentials rejected"; |
1273 } | 1271 } |
1274 | 1272 |
1275 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { | 1273 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { |
1276 bool profile_became_active = profile_->IsSameProfile(browser->profile()); | 1274 bool profile_became_active = profile_->IsSameProfile(browser->profile()); |
1277 if (!is_profile_active_ && profile_became_active) | 1275 if (!is_profile_active_ && profile_became_active) |
1278 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); | 1276 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); |
1279 else if (is_profile_active_ && !profile_became_active) | 1277 else if (is_profile_active_ && !profile_became_active) |
1280 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); | 1278 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); |
1281 | 1279 |
1282 is_profile_active_ = profile_became_active; | 1280 is_profile_active_ = profile_became_active; |
1283 } | 1281 } |
1284 #endif // !defined(OS_ANDROID) | 1282 #endif // !defined(OS_ANDROID) |
1285 | 1283 |
1286 void SupervisedUserService::OnSiteListUpdated() { | 1284 void SupervisedUserService::OnSiteListUpdated() { |
1287 for (SupervisedUserServiceObserver& observer : observer_list_) | 1285 for (SupervisedUserServiceObserver& observer : observer_list_) |
1288 observer.OnURLFilterChanged(); | 1286 observer.OnURLFilterChanged(); |
1289 } | 1287 } |
OLD | NEW |