Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service.cc

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Add SyncService* to OnStateChanged Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 browser_sync::ProfileSyncService* service =
skym 2017/01/26 23:43:23 This variable can be replaced by |sync|.
Steven Holte 2017/01/27 02:27:19 Done.
1262 ProfileSyncServiceFactory::GetForProfile(profile_); 1262 ProfileSyncServiceFactory::GetForProfile(profile_);
1263 if (waiting_for_sync_initialization_ && service->IsEngineInitialized()) { 1263 if (waiting_for_sync_initialization_ && service->IsEngineInitialized()) {
1264 waiting_for_sync_initialization_ = false; 1264 waiting_for_sync_initialization_ = false;
1265 service->RemoveObserver(this); 1265 service->RemoveObserver(this);
1266 FinishSetupSync(); 1266 FinishSetupSync();
1267 return; 1267 return;
1268 } 1268 }
1269 1269
1270 DLOG_IF(ERROR, service->GetAuthError().state() == 1270 DLOG_IF(ERROR, service->GetAuthError().state() ==
1271 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS) 1271 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)
1272 << "Credentials rejected"; 1272 << "Credentials rejected";
1273 } 1273 }
1274 1274
1275 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { 1275 void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) {
1276 bool profile_became_active = profile_->IsSameProfile(browser->profile()); 1276 bool profile_became_active = profile_->IsSameProfile(browser->profile());
1277 if (!is_profile_active_ && profile_became_active) 1277 if (!is_profile_active_ && profile_became_active)
1278 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); 1278 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile"));
1279 else if (is_profile_active_ && !profile_became_active) 1279 else if (is_profile_active_ && !profile_became_active)
1280 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); 1280 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile"));
1281 1281
1282 is_profile_active_ = profile_became_active; 1282 is_profile_active_ = profile_became_active;
1283 } 1283 }
1284 #endif // !defined(OS_ANDROID) 1284 #endif // !defined(OS_ANDROID)
1285 1285
1286 void SupervisedUserService::OnSiteListUpdated() { 1286 void SupervisedUserService::OnSiteListUpdated() {
1287 for (SupervisedUserServiceObserver& observer : observer_list_) 1287 for (SupervisedUserServiceObserver& observer : observer_list_)
1288 observer.OnURLFilterChanged(); 1288 observer.OnURLFilterChanged();
1289 } 1289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698