| Index: chrome/browser/managed_mode/managed_user_service.cc
|
| diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/managed_mode/managed_user_service.cc
|
| index 29565486dc32498fd29cdf78bce01cae8839e62f..bd9fab046f01e634e55555139172f1dbe799cb51 100644
|
| --- a/chrome/browser/managed_mode/managed_user_service.cc
|
| +++ b/chrome/browser/managed_mode/managed_user_service.cc
|
| @@ -103,9 +103,7 @@ void ManagedUserService::URLFilterContext::SetManualURLs(
|
| io_url_filter_, base::Owned(url_map.release())));
|
| }
|
|
|
| -ManagedUserService::ManagedUserService(Profile* profile)
|
| - : profile_(profile),
|
| - is_elevated_(false) {
|
| +ManagedUserService::ManagedUserService(Profile* profile) : profile_(profile) {
|
| }
|
|
|
| ManagedUserService::~ManagedUserService() {
|
| @@ -115,10 +113,6 @@ bool ManagedUserService::ProfileIsManaged() const {
|
| return profile_->GetPrefs()->GetBoolean(prefs::kProfileIsManaged);
|
| }
|
|
|
| -bool ManagedUserService::IsElevated() const {
|
| - return is_elevated_;
|
| -}
|
| -
|
| bool ManagedUserService::IsElevatedForWebContents(
|
| const content::WebContents* web_contents) const {
|
| const ManagedModeNavigationObserver* observer =
|
| @@ -131,17 +125,10 @@ bool ManagedUserService::IsPassphraseEmpty() const {
|
| return pref_service->GetString(prefs::kManagedModeLocalPassphrase).empty();
|
| }
|
|
|
| -bool ManagedUserService::CanSkipPassphraseDialog() {
|
| - // If the profile is already elevated or there is no passphrase set, no
|
| - // authentication is needed.
|
| - return IsElevated() || IsPassphraseEmpty();
|
| -}
|
| -
|
| bool ManagedUserService::CanSkipPassphraseDialog(
|
| const content::WebContents* web_contents) const {
|
| - return IsElevated() ||
|
| - IsElevatedForWebContents(web_contents) ||
|
| - IsPassphraseEmpty();
|
| + return IsElevatedForWebContents(web_contents) ||
|
| + IsPassphraseEmpty();
|
| }
|
|
|
| void ManagedUserService::RequestAuthorization(
|
| @@ -156,14 +143,6 @@ void ManagedUserService::RequestAuthorization(
|
| new ManagedUserPassphraseDialog(web_contents, callback);
|
| }
|
|
|
| -void ManagedUserService::RequestAuthorizationUsingActiveWebContents(
|
| - Browser* browser,
|
| - const PassphraseCheckedCallback& callback) {
|
| - RequestAuthorization(
|
| - browser->tab_strip_model()->GetActiveWebContents(),
|
| - callback);
|
| -}
|
| -
|
| // static
|
| void ManagedUserService::RegisterUserPrefs(PrefRegistrySyncable* registry) {
|
| registry->RegisterDictionaryPref(prefs::kManagedModeManualHosts,
|
| @@ -287,6 +266,15 @@ void ManagedUserService::Observe(int type,
|
|
|
| break;
|
| }
|
| + case chrome::NOTIFICATION_EXTENSION_INSTALLED:
|
| + case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
|
| + // When an extension was installed or uninstalled, remove the temporary
|
| + // elevation.
|
| + const extensions::Extension* extension =
|
| + content::Details<extensions::Extension>(details).ptr();
|
| + RemoveElevationForExtension(extension->id());
|
| + break;
|
| + }
|
| default:
|
| NOTREACHED();
|
| }
|
| @@ -298,9 +286,6 @@ bool ManagedUserService::ExtensionManagementPolicyImpl(
|
| if (!ProfileIsManaged())
|
| return true;
|
|
|
| - if (is_elevated_)
|
| - return true;
|
| -
|
| if (elevated_for_extensions_.count(extension_id))
|
| return true;
|
|
|
| @@ -421,12 +406,6 @@ void ManagedUserService::GetManualExceptionsForHost(const std::string& host,
|
| }
|
| }
|
|
|
| -// TODO(akuegel): Rename to SetElevatedForTesting when all callers are changed
|
| -// to set elevation on the ManagedModeNavigationObserver.
|
| -void ManagedUserService::SetElevated(bool is_elevated) {
|
| - is_elevated_ = is_elevated;
|
| -}
|
| -
|
| void ManagedUserService::AddElevationForExtension(
|
| const std::string& extension_id) {
|
| elevated_for_extensions_.insert(extension_id);
|
| @@ -452,6 +431,10 @@ void ManagedUserService::Init() {
|
| content::Source<Profile>(profile_));
|
| registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
|
| content::Source<Profile>(profile_));
|
| + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
|
| + content::Source<Profile>(profile_));
|
| + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
|
| + content::Source<Profile>(profile_));
|
| pref_change_registrar_.Init(profile_->GetPrefs());
|
| pref_change_registrar_.Add(
|
| prefs::kDefaultManagedModeFilteringBehavior,
|
|
|