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

Side by Side Diff: chrome/browser/managed_mode/managed_user_service.cc

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/managed_mode/managed_user_service.h" 5 #include "chrome/browser/managed_mode/managed_user_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 339
340 DLOG_IF(ERROR, service->GetAuthError().state() == 340 DLOG_IF(ERROR, service->GetAuthError().state() ==
341 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS) 341 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)
342 << "Credentials rejected"; 342 << "Credentials rejected";
343 } 343 }
344 344
345 void ManagedUserService::Observe(int type, 345 void ManagedUserService::Observe(int type,
346 const content::NotificationSource& source, 346 const content::NotificationSource& source,
347 const content::NotificationDetails& details) { 347 const content::NotificationDetails& details) {
348 switch (type) { 348 switch (type) {
349 case chrome::NOTIFICATION_EXTENSION_LOADED: { 349 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
350 const extensions::Extension* extension = 350 const extensions::Extension* extension =
351 content::Details<extensions::Extension>(details).ptr(); 351 content::Details<extensions::Extension>(details).ptr();
352 if (!extensions::ManagedModeInfo::GetContentPackSiteList( 352 if (!extensions::ManagedModeInfo::GetContentPackSiteList(
353 extension).empty()) { 353 extension).empty()) {
354 UpdateSiteLists(); 354 UpdateSiteLists();
355 } 355 }
356 break; 356 break;
357 } 357 }
358 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { 358 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
359 const extensions::UnloadedExtensionInfo* extension_info = 359 const extensions::UnloadedExtensionInfo* extension_info =
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); 565 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
566 token_service->LoadCredentials(managed_users::kManagedUserPseudoEmail); 566 token_service->LoadCredentials(managed_users::kManagedUserPseudoEmail);
567 567
568 extensions::ExtensionSystem* extension_system = 568 extensions::ExtensionSystem* extension_system =
569 extensions::ExtensionSystem::Get(profile_); 569 extensions::ExtensionSystem::Get(profile_);
570 extensions::ManagementPolicy* management_policy = 570 extensions::ManagementPolicy* management_policy =
571 extension_system->management_policy(); 571 extension_system->management_policy();
572 if (management_policy) 572 if (management_policy)
573 extension_system->management_policy()->RegisterProvider(this); 573 extension_system->management_policy()->RegisterProvider(this);
574 574
575 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 575 registrar_.Add(this,
576 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
576 content::Source<Profile>(profile_)); 577 content::Source<Profile>(profile_));
577 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 578 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
578 content::Source<Profile>(profile_)); 579 content::Source<Profile>(profile_));
579 580
580 pref_change_registrar_.Init(profile_->GetPrefs()); 581 pref_change_registrar_.Init(profile_->GetPrefs());
581 pref_change_registrar_.Add( 582 pref_change_registrar_.Add(
582 prefs::kDefaultManagedModeFilteringBehavior, 583 prefs::kDefaultManagedModeFilteringBehavior,
583 base::Bind(&ManagedUserService::OnDefaultFilteringBehaviorChanged, 584 base::Bind(&ManagedUserService::OnDefaultFilteringBehaviorChanged,
584 base::Unretained(this))); 585 base::Unretained(this)));
585 pref_change_registrar_.Add(prefs::kManagedModeManualHosts, 586 pref_change_registrar_.Add(prefs::kManagedModeManualHosts,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 692
692 void ManagedUserService::OnBrowserSetLastActive(Browser* browser) { 693 void ManagedUserService::OnBrowserSetLastActive(Browser* browser) {
693 bool profile_became_active = profile_->IsSameProfile(browser->profile()); 694 bool profile_became_active = profile_->IsSameProfile(browser->profile());
694 if (!is_profile_active_ && profile_became_active) 695 if (!is_profile_active_ && profile_became_active)
695 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); 696 content::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile"));
696 else if (is_profile_active_ && !profile_became_active) 697 else if (is_profile_active_ && !profile_became_active)
697 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); 698 content::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile"));
698 699
699 is_profile_active_ = profile_became_active; 700 is_profile_active_ = profile_became_active;
700 } 701 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobars_browsertest.cc ('k') | chrome/browser/managed_mode/managed_user_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698