summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakuegel@chromium.org <akuegel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-20 05:19:06 +0000
committerakuegel@chromium.org <akuegel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-20 05:19:06 +0000
commit4f02aac18ed533a18c3b1237579f6185ffc1607e (patch)
treeabce5b72437f8943879085fefa0fe8807e336a89
parent1260ef5e7d975603cfef88a995cc0b238619429a (diff)
downloadchromium_src-4f02aac18ed533a18c3b1237579f6185ffc1607e.zip
chromium_src-4f02aac18ed533a18c3b1237579f6185ffc1607e.tar.gz
chromium_src-4f02aac18ed533a18c3b1237579f6185ffc1607e.tar.bz2
Remove managed user elevation related to extensions.
BUG=241383 Review URL: https://chromiumcodereview.appspot.com/15218005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201020 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd6
-rw-r--r--chrome/browser/extensions/crx_installer.cc19
-rw-r--r--chrome/browser/extensions/extension_installer.cc38
-rw-r--r--chrome/browser/extensions/extension_installer.h11
-rw-r--r--chrome/browser/extensions/extension_uninstall_dialog.cc48
-rw-r--r--chrome/browser/extensions/extension_uninstall_dialog.h9
-rw-r--r--chrome/browser/extensions/unpacked_installer.cc22
-rw-r--r--chrome/browser/managed_mode/managed_user_service.cc49
-rw-r--r--chrome/browser/managed_mode/managed_user_service.h15
-rw-r--r--chrome/browser/managed_mode/managed_user_service_unittest.cc12
-rw-r--r--chrome/browser/managed_mode/scoped_extension_elevation.cc21
-rw-r--r--chrome/browser/managed_mode/scoped_extension_elevation.h35
-rw-r--r--chrome/browser/resources/extensions/extensions.css12
-rw-r--r--chrome/browser/resources/extensions/extensions.html6
-rw-r--r--chrome/browser/resources/extensions/extensions.js14
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.cc84
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.h17
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc28
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.h6
-rw-r--r--chrome/chrome_browser.gypi2
20 files changed, 22 insertions, 432 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 84b885e..6460b5b 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5510,12 +5510,6 @@ Make sure you do not expose any sensitive information.
<message name="IDS_EXTENSIONS_RESTART" desc="The link for restarting apps.">
Restart
</message>
- <message name="IDS_EXTENSIONS_LOCK_BUTTON" desc="The button to lock the extensions for a managed user.">
- Lock
- </message>
- <message name="IDS_EXTENSIONS_UNLOCK_BUTTON" desc="The button to unlock the extensions for a managed user.">
- Unlock
- </message>
<if expr="is_macosx">
<message name="IDS_EXTENSIONS_RELOAD_UNPACKED" desc="The link for reloading unpacked extensions.">
Reload (⌘R)
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 8929506..a776821 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -445,26 +445,7 @@ void CrxInstaller::OnRequirementsChecked(
}
has_requirement_errors_ = true;
}
-
-#if defined(ENABLE_MANAGED_USERS) && !defined(OS_CHROMEOS)
- // Extensions which should be installed by policy are installed without
- // using the ExtensionInstallPrompt. In that case, |client_| is NULL.
- if (!client_) {
- // Automatically set authorization
- installer_.OnAuthorizationResult(
- base::Bind(&CrxInstaller::ConfirmInstall, this),
- true);
- return;
- }
- // |parent_web_contents| could be NULL when the client is instantiated from
- // ExtensionEnableFlow, but that code path does not lead to here. Also they
- // are NULL in some tests.
- installer_.ShowPassphraseDialog(
- client_->parent_web_contents(),
- base::Bind(&CrxInstaller::ConfirmInstall, this));
-#else
ConfirmInstall();
-#endif
}
void CrxInstaller::ConfirmInstall() {
diff --git a/chrome/browser/extensions/extension_installer.cc b/chrome/browser/extensions/extension_installer.cc
index e49a756..4990906 100644
--- a/chrome/browser/extensions/extension_installer.cc
+++ b/chrome/browser/extensions/extension_installer.cc
@@ -10,11 +10,6 @@
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
-#if defined(ENABLE_MANAGED_USERS)
-#include "chrome/browser/managed_mode/managed_user_service.h"
-#include "chrome/browser/managed_mode/managed_user_service_factory.h"
-#endif
-
namespace extensions {
ExtensionInstaller::ExtensionInstaller(Profile* profile)
@@ -32,39 +27,6 @@ void ExtensionInstaller::CheckRequirements(
requirements_checker_->Check(extension_, callback);
}
-#if defined(ENABLE_MANAGED_USERS)
-void ExtensionInstaller::ShowPassphraseDialog(
- content::WebContents* web_contents,
- const base::Closure& authorization_callback) {
-
- ManagedUserService* service =
- ManagedUserServiceFactory::GetForProfile(profile());
- // Check whether the profile is managed.
- if (service->ProfileIsManaged()) {
- service->RequestAuthorization(
- web_contents,
- base::Bind(&ExtensionInstaller::OnAuthorizationResult,
- weak_ptr_factory_.GetWeakPtr(),
- authorization_callback));
- return;
- }
- authorization_callback.Run();
-}
-
-void ExtensionInstaller::OnAuthorizationResult(
- const base::Closure& authorization_callback,
- bool success) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- if (success) {
- ManagedUserService* service =
- ManagedUserServiceFactory::GetForProfile(profile_);
- if (service->ProfileIsManaged())
- service->AddElevationForExtension(extension_->id());
- }
- authorization_callback.Run();
-}
-#endif
-
string16 ExtensionInstaller::CheckManagementPolicy() {
string16 error;
bool allowed =
diff --git a/chrome/browser/extensions/extension_installer.h b/chrome/browser/extensions/extension_installer.h
index 99aca3e..3768295 100644
--- a/chrome/browser/extensions/extension_installer.h
+++ b/chrome/browser/extensions/extension_installer.h
@@ -34,17 +34,6 @@ class ExtensionInstaller {
// Called on the UI thread to start the requirements check on the extension
void CheckRequirements(const RequirementsCallback& callback);
-#if defined(ENABLE_MANAGED_USERS)
- // Shows the managed user passphrase dialog if the managed user is not in
- // elevated state yet.
- void ShowPassphraseDialog(content::WebContents* web_contents,
- const base::Closure& authorization_callback);
-
- // Runs on the UI thread. Callback from the managed user passphrase dialog.
- void OnAuthorizationResult(const base::Closure& authorization_callback,
- bool success);
-#endif
-
// Checks the management policy if the extension can be installed.
string16 CheckManagementPolicy();
diff --git a/chrome/browser/extensions/extension_uninstall_dialog.cc b/chrome/browser/extensions/extension_uninstall_dialog.cc
index 55171ac..1bde628 100644
--- a/chrome/browser/extensions/extension_uninstall_dialog.cc
+++ b/chrome/browser/extensions/extension_uninstall_dialog.cc
@@ -9,7 +9,6 @@
#include "base/message_loop.h"
#include "chrome/browser/extensions/image_loader.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -23,11 +22,6 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image.h"
-#if defined(ENABLE_MANAGED_USERS)
-#include "chrome/browser/managed_mode/managed_user_service.h"
-#include "chrome/browser/managed_mode/managed_user_service_factory.h"
-#endif
-
namespace {
// Returns pixel size under maximal scale factor for the icon whose device
@@ -77,16 +71,6 @@ void ExtensionUninstallDialog::ConfirmUninstall(
const extensions::Extension* extension) {
DCHECK(ui_loop_ == MessageLoop::current());
extension_ = extension;
-
-#if defined(ENABLE_MANAGED_USERS) && !defined(OS_CHROMEOS)
- // If the profile belongs to a managed user, and the profile is not in
- // elevated state, a passphrase dialog is shown, and if the custodian
- // authorizes by entering his passphrase, the uninstall is continued by
- // calling |ExtensionUninstallAccepted| on the delegate.
- if (ShowAuthorizationDialog())
- return;
-#endif
-
extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource(
extension_,
extension_misc::EXTENSION_ICON_LARGE,
@@ -146,35 +130,3 @@ void ExtensionUninstallDialog::Observe(
delegate_->ExtensionUninstallCanceled();
}
}
-
-#if defined(ENABLE_MANAGED_USERS)
-bool ExtensionUninstallDialog::ShowAuthorizationDialog() {
- ManagedUserService* service =
- ManagedUserServiceFactory::GetForProfile(profile_);
- if (!service->ProfileIsManaged() || !browser_)
- return false;
- content::WebContents* web_contents =
- browser_->tab_strip_model()->GetActiveWebContents();
- if (service->CanSkipPassphraseDialog(web_contents)) {
- service->AddElevationForExtension(extension_->id());
- return false;
- }
- service->RequestAuthorization(
- web_contents,
- base::Bind(&ExtensionUninstallDialog::OnAuthorizationResult,
- base::Unretained(this)));
- return true;
-}
-
-void ExtensionUninstallDialog::OnAuthorizationResult(bool success) {
- if (success) {
- ManagedUserService* service = ManagedUserServiceFactory::GetForProfile(
- profile_);
- DCHECK(service);
- service->AddElevationForExtension(extension_->id());
- delegate_->ExtensionUninstallAccepted();
- } else {
- delegate_->ExtensionUninstallCanceled();
- }
-}
-#endif
diff --git a/chrome/browser/extensions/extension_uninstall_dialog.h b/chrome/browser/extensions/extension_uninstall_dialog.h
index 729d50f..9f7c8dc 100644
--- a/chrome/browser/extensions/extension_uninstall_dialog.h
+++ b/chrome/browser/extensions/extension_uninstall_dialog.h
@@ -66,15 +66,6 @@ class ExtensionUninstallDialog
Browser* browser,
Delegate* delegate);
-#if defined(ENABLE_MANAGED_USERS)
- // Requests authorization from a managed user's custodian if required.
- bool ShowAuthorizationDialog();
-
- // If custodian authorization is granted, performs the uninstall, otherwise
- // cancels uninstall.
- void OnAuthorizationResult(bool success);
-#endif
-
Profile* const profile_;
Browser* browser_;
diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc
index d45d2c0..1eeabf2 100644
--- a/chrome/browser/extensions/unpacked_installer.cc
+++ b/chrome/browser/extensions/unpacked_installer.cc
@@ -15,8 +15,6 @@
#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/permissions_updater.h"
-#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/extensions/api/plugins/plugins_handler.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_file_util.h"
@@ -25,11 +23,6 @@
#include "extensions/common/id_util.h"
#include "sync/api/string_ordinal.h"
-#if defined(ENABLE_MANAGED_USERS)
-#include "chrome/browser/managed_mode/managed_user_service.h"
-#include "chrome/browser/managed_mode/managed_user_service_factory.h"
-#endif
-
using content::BrowserThread;
using extensions::Extension;
@@ -191,21 +184,6 @@ void UnpackedInstaller::OnRequirementsChecked(
return;
}
-#if defined(ENABLE_MANAGED_USERS)
- ManagedUserService* service =
- ManagedUserServiceFactory::GetForProfile(installer_.profile());
- if (service->ProfileIsManaged()) {
- Browser* browser = chrome::FindLastActiveWithProfile(
- service_weak_->profile(),
- chrome::GetActiveDesktop());
- DCHECK(service->CanSkipPassphraseDialog(
- browser->tab_strip_model()->GetActiveWebContents()));
- installer_.OnAuthorizationResult(
- base::Bind(&UnpackedInstaller::ConfirmInstall, this),
- true);
- return;
- }
-#endif
ConfirmInstall();
}
diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/managed_mode/managed_user_service.cc
index 99f616e..d227b1d 100644
--- a/chrome/browser/managed_mode/managed_user_service.cc
+++ b/chrome/browser/managed_mode/managed_user_service.cc
@@ -116,7 +116,7 @@ void ManagedUserService::URLFilterContext::SetManualURLs(
ManagedUserService::ManagedUserService(Profile* profile)
: weak_ptr_factory_(this),
profile_(profile),
- skip_dialog_for_testing_(false) {}
+ elevated_for_testing_(false) {}
ManagedUserService::~ManagedUserService() {
}
@@ -142,8 +142,7 @@ bool ManagedUserService::CanSkipPassphraseDialog(
#if defined(OS_CHROMEOS)
NOTREACHED();
#endif
- return skip_dialog_for_testing_ ||
- IsElevatedForWebContents(web_contents) ||
+ return IsElevatedForWebContents(web_contents) ||
IsPassphraseEmpty();
}
@@ -154,7 +153,7 @@ void ManagedUserService::RequestAuthorization(
NOTREACHED();
#endif
- if (skip_dialog_for_testing_ || CanSkipPassphraseDialog(web_contents)) {
+ if (CanSkipPassphraseDialog(web_contents)) {
callback.Run(true);
return;
}
@@ -295,21 +294,6 @@ void ManagedUserService::Observe(int type,
}
break;
}
- case chrome::NOTIFICATION_EXTENSION_INSTALLED: {
- // Remove the temporary elevation.
- const extensions::Extension* extension =
- content::Details<const extensions::InstalledExtensionInfo>(details)->
- extension;
- RemoveElevationForExtension(extension->id());
- break;
- }
- case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
- // Remove the temporary elevation.
- const extensions::Extension* extension =
- content::Details<extensions::Extension>(details).ptr();
- RemoveElevationForExtension(extension->id());
- break;
- }
default:
NOTREACHED();
}
@@ -321,6 +305,9 @@ bool ManagedUserService::ExtensionManagementPolicyImpl(
if (!ProfileIsManaged())
return true;
+ if (elevated_for_testing_)
+ return true;
+
if (elevated_for_extensions_.count(extension_id))
return true;
@@ -446,24 +433,6 @@ void ManagedUserService::GetManualExceptionsForHost(const std::string& host,
}
}
-void ManagedUserService::AddElevationForExtension(
- const std::string& extension_id) {
-#if defined(OS_CHROMEOS)
- NOTREACHED();
-#else
- elevated_for_extensions_.insert(extension_id);
-#endif
-}
-
-void ManagedUserService::RemoveElevationForExtension(
- const std::string& extension_id) {
-#if defined(OS_CHROMEOS)
- NOTREACHED();
-#else
- elevated_for_extensions_.erase(extension_id);
-#endif
-}
-
void ManagedUserService::InitForTesting() {
DCHECK(!profile_->GetPrefs()->GetBoolean(prefs::kProfileIsManaged));
profile_->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, true);
@@ -485,12 +454,6 @@ void ManagedUserService::Init() {
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
content::Source<Profile>(profile_));
-#if !defined(OS_CHROMEOS)
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
- content::Source<Profile>(profile_));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
- content::Source<Profile>(profile_));
-#endif
pref_change_registrar_.Init(profile_->GetPrefs());
pref_change_registrar_.Add(
diff --git a/chrome/browser/managed_mode/managed_user_service.h b/chrome/browser/managed_mode/managed_user_service.h
index c689ae9..3b391b8 100644
--- a/chrome/browser/managed_mode/managed_user_service.h
+++ b/chrome/browser/managed_mode/managed_user_service.h
@@ -101,13 +101,6 @@ class ManagedUserService : public ProfileKeyedService,
void RequestAuthorization(content::WebContents* web_contents,
const PassphraseCheckedCallback& callback);
- // Add an elevation for a specific extension which allows the managed user to
- // install/uninstall this specific extension.
- void AddElevationForExtension(const std::string& extension_id);
-
- // Remove the elevation for a specific extension.
- void RemoveElevationForExtension(const std::string& extension_id);
-
// Initializes this object. This method does nothing if the profile is not
// managed.
void Init();
@@ -126,8 +119,8 @@ class ManagedUserService : public ProfileKeyedService,
void RegisterAndInitSync(
ManagedUserRegistrationService* registration_service);
- void set_skip_dialog_for_testing(bool skip) {
- skip_dialog_for_testing_ = skip;
+ void set_elevated_for_testing(bool skip) {
+ elevated_for_testing_ = skip;
}
// extensions::ManagementPolicy::Provider implementation:
@@ -215,8 +208,8 @@ class ManagedUserService : public ProfileKeyedService,
// by the managed user.
std::set<std::string> elevated_for_extensions_;
- // Skips the passphrase dialog in tests if set to true.
- bool skip_dialog_for_testing_;
+ // Sets a profile in elevated state for testing if set to true.
+ bool elevated_for_testing_;
URLFilterContext url_filter_context_;
};
diff --git a/chrome/browser/managed_mode/managed_user_service_unittest.cc b/chrome/browser/managed_mode/managed_user_service_unittest.cc
index cc89fb9..835efa5 100644
--- a/chrome/browser/managed_mode/managed_user_service_unittest.cc
+++ b/chrome/browser/managed_mode/managed_user_service_unittest.cc
@@ -15,7 +15,6 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
-#include "chrome/test/base/test_browser_window.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -213,15 +212,7 @@ TEST_F(ManagedUserServiceExtensionTest, InstallContentPacks) {
EXPECT_EQ(ManagedModeURLFilter::WARN,
url_filter->GetFilteringBehaviorForURL(example_url));
- managed_user_service->set_skip_dialog_for_testing(true);
-
- // Create a testing browser in order to make it possible to use the unpacked
- // installer.
- Browser::CreateParams profile_params(profile_.get(),
- chrome::HOST_DESKTOP_TYPE_NATIVE);
- scoped_ptr<Browser> browser(
- chrome::CreateBrowserWithTestWindowForParams(&profile_params));
- BrowserList::SetLastActive(browser.get());
+ managed_user_service->set_elevated_for_testing(true);
// Load a content pack.
scoped_refptr<extensions::UnpackedInstaller> installer(
@@ -292,7 +283,6 @@ TEST_F(ManagedUserServiceExtensionTest, InstallContentPacks) {
#endif
// Disable the first content pack.
- managed_user_service->AddElevationForExtension(extension->id());
service_->DisableExtension(extension->id(),
extensions::Extension::DISABLE_USER_ACTION);
observer.Wait();
diff --git a/chrome/browser/managed_mode/scoped_extension_elevation.cc b/chrome/browser/managed_mode/scoped_extension_elevation.cc
deleted file mode 100644
index cac213e..0000000
--- a/chrome/browser/managed_mode/scoped_extension_elevation.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/managed_mode/scoped_extension_elevation.h"
-
-#include "chrome/browser/managed_mode/managed_user_service.h"
-
-ScopedExtensionElevation::ScopedExtensionElevation(ManagedUserService* service)
- : service_(service) {
-}
-
-void ScopedExtensionElevation::AddExtension(const std::string& extension_id) {
- service_->AddElevationForExtension(extension_id);
- elevated_extensions_.push_back(extension_id);
-}
-
-ScopedExtensionElevation::~ScopedExtensionElevation() {
- for (size_t i = 0; i < elevated_extensions_.size(); ++i)
- service_->RemoveElevationForExtension(elevated_extensions_[i]);
-}
diff --git a/chrome/browser/managed_mode/scoped_extension_elevation.h b/chrome/browser/managed_mode/scoped_extension_elevation.h
deleted file mode 100644
index 61af6e7..0000000
--- a/chrome/browser/managed_mode/scoped_extension_elevation.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_MANAGED_MODE_SCOPED_EXTENSION_ELEVATION_H_
-#define CHROME_BROWSER_MANAGED_MODE_SCOPED_EXTENSION_ELEVATION_H_
-
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-
-class ManagedUserService;
-
-// Used to allow managed users to install extensions if they are currently in
-// elevated state.
-class ScopedExtensionElevation {
- public:
- explicit ScopedExtensionElevation(ManagedUserService* service);
- ~ScopedExtensionElevation();
-
- // Add elevation for the extension with the id |extension_id|.
- void AddExtension(const std::string& extension_id);
-
- private:
- ManagedUserService* service_;
-
- // A list of extensions which stay elevated until the destructor of this
- // class is called.
- std::vector<std::string> elevated_extensions_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedExtensionElevation);
-};
-
-#endif // CHROME_BROWSER_MANAGED_MODE_SCOPED_EXTENSION_ELEVATION_H_
diff --git a/chrome/browser/resources/extensions/extensions.css b/chrome/browser/resources/extensions/extensions.css
index a48a356..d3f5210 100644
--- a/chrome/browser/resources/extensions/extensions.css
+++ b/chrome/browser/resources/extensions/extensions.css
@@ -287,11 +287,8 @@ html[dir='rtl'] #extension-settings .trash {
/* Managed mode */
-.page:not(.managed-user-locked) .profile-is-managed-banner,
-.managed-user-locked .more-extensions-link,
-.page:not(.profile-is-managed) #managed-user-control-div,
-.page:not(.managed-user-locked) #unlock-button,
-.managed-user-locked #lock-button {
+.page:not(.profile-is-managed) .profile-is-managed-banner,
+.profile-is-managed .more-extensions-link {
display: none;
}
@@ -299,11 +296,6 @@ html[dir='rtl'] #extension-settings .trash {
background-image: url('chrome://theme/IDR_WARNING');
}
-#managed-user-control-div {
- display: inline-block;
- padding-left: 7px;
-}
-
/* Sideload Wipeout */
.sideload-wipeout-learn-more {
diff --git a/chrome/browser/resources/extensions/extensions.html b/chrome/browser/resources/extensions/extensions.html
index fdc86d6..b433601 100644
--- a/chrome/browser/resources/extensions/extensions.html
+++ b/chrome/browser/resources/extensions/extensions.html
@@ -45,12 +45,6 @@
<span i18n-content="extensionSettingsDeveloperMode">
</label>
</div>
- <if expr="not pp_ifdef('chromeos')">
- <div id="managed-user-control-div">
- <button id="unlock-button" i18n-content="unlockButton"></button>
- <button id="lock-button" i18n-content="lockButton"></button>
- </div>
- </if>
</div>
<div class="page-banner profile-is-managed-banner">
<div class="page-banner-gradient">
diff --git a/chrome/browser/resources/extensions/extensions.js b/chrome/browser/resources/extensions/extensions.js
index cad4d6a..0fcc919 100644
--- a/chrome/browser/resources/extensions/extensions.js
+++ b/chrome/browser/resources/extensions/extensions.js
@@ -87,16 +87,6 @@ cr.define('extensions', function() {
$('dev-controls').addEventListener('webkitTransitionEnd',
this.handleDevControlsTransitionEnd_.bind(this));
- if (!cr.isChromeOS) {
- $('unlock-button').addEventListener('click', function() {
- chrome.send('setElevated', [true]);
- });
-
- $('lock-button').addEventListener('click', function() {
- chrome.send('setElevated', [false]);
- });
- }
-
// Set up the three dev mode buttons (load unpacked, pack and update).
$('load-unpacked').addEventListener('click',
this.handleLoadUnpackedExtension_.bind(this));
@@ -259,14 +249,12 @@ cr.define('extensions', function() {
} else {
pageDiv.classList.remove('profile-is-managed');
}
- if (extensionsData.profileIsManaged && !extensionsData.profileIsElevated) {
+ if (extensionsData.profileIsManaged) {
pageDiv.classList.add('showing-banner');
- pageDiv.classList.add('managed-user-locked');
$('toggle-dev-on').disabled = true;
marginTop += 45;
} else {
pageDiv.classList.remove('showing-banner');
- pageDiv.classList.remove('managed-user-locked');
$('toggle-dev-on').disabled = false;
}
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index ec7eb7d..2bbdd2e 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -33,7 +33,6 @@
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/google/google_util.h"
-#include "chrome/browser/managed_mode/managed_mode_navigation_observer.h"
#include "chrome/browser/managed_mode/managed_user_service.h"
#include "chrome/browser/managed_mode/managed_user_service_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -138,8 +137,9 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
bool enabled = extension_service_->IsExtensionEnabled(extension->id());
extension->GetBasicInfo(enabled, extension_data);
- extension_data->SetBoolean("userModifiable",
- CheckUserMayModifySettings(extension));
+ extension_data->SetBoolean(
+ "userModifiable",
+ management_policy_->UserMayModifySettings(extension, NULL));
GURL icon =
ExtensionIconSource::GetIconURL(extension,
@@ -342,10 +342,6 @@ void ExtensionSettingsHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_DETAILS));
source->AddString("extensionSettingsHideDetails",
l10n_util::GetStringUTF16(IDS_EXTENSIONS_HIDE_DETAILS));
- source->AddString("unlockButton",
- l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNLOCK_BUTTON));
- source->AddString("lockButton",
- l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOCK_BUTTON));
// TODO(estade): comb through the above strings to find ones no longer used in
// uber extensions.
@@ -390,9 +386,6 @@ void ExtensionSettingsHandler::RegisterMessages() {
extension_service_->profile())->management_policy();
}
- web_ui()->RegisterMessageCallback("setElevated",
- base::Bind(&ExtensionSettingsHandler::ManagedUserSetElevated,
- base::Unretained(this)));
web_ui()->RegisterMessageCallback("extensionSettingsRequestExtensionsData",
base::Bind(&ExtensionSettingsHandler::HandleRequestExtensionsData,
base::Unretained(this)));
@@ -549,61 +542,6 @@ void ExtensionSettingsHandler::ReloadUnpackedExtensions() {
}
}
-void ExtensionSettingsHandler::PassphraseDialogCallback(bool success) {
- if (!success)
- return;
- ManagedModeNavigationObserver* observer =
- ManagedModeNavigationObserver::FromWebContents(
- web_ui()->GetWebContents());
- observer->set_elevated(true);
- HandleRequestExtensionsData(NULL);
-}
-
-void ExtensionSettingsHandler::ManagedUserSetElevated(const ListValue* args) {
- ManagedUserService* service = ManagedUserServiceFactory::GetForProfile(
- Profile::FromWebUI(web_ui()));
- bool elevated;
- CHECK(args->GetBoolean(0, &elevated));
- if (elevated) {
- service->RequestAuthorization(
- web_ui()->GetWebContents(),
- base::Bind(&ExtensionSettingsHandler::PassphraseDialogCallback,
- base::Unretained(this)));
- } else {
- ManagedModeNavigationObserver* observer =
- ManagedModeNavigationObserver::FromWebContents(
- web_ui()->GetWebContents());
- observer->set_elevated(false);
- HandleRequestExtensionsData(NULL);
- }
-}
-
-scoped_ptr<ScopedExtensionElevation>
- ExtensionSettingsHandler::GetScopedElevation(
- const std::string& extension_id) {
- // web_ui() can be NULL in a unit_test.
- if (web_ui() == NULL)
- return scoped_ptr<ScopedExtensionElevation>(NULL);
- ManagedUserService* service = ManagedUserServiceFactory::GetForProfile(
- Profile::FromWebUI(web_ui()));
- scoped_ptr<ScopedExtensionElevation> elevation(
- new ScopedExtensionElevation(service));
- if (service->ProfileIsManaged() &&
- service->IsElevatedForWebContents(web_ui()->GetWebContents())) {
- elevation->AddExtension(extension_id);
- }
- return elevation.Pass();
-}
-
-bool ExtensionSettingsHandler::CheckUserMayModifySettings(
- const Extension* extension) {
- // Get managed user elevation for a specific extension id. The elevation will
- // be removed automatically when |elevation| goes out of scope.
- scoped_ptr<ScopedExtensionElevation> elevation =
- GetScopedElevation(extension->id());
- return management_policy_->UserMayModifySettings(extension, NULL);
-}
-
void ExtensionSettingsHandler::HandleRequestExtensionsData(
const ListValue* args) {
DictionaryValue results;
@@ -653,13 +591,10 @@ void ExtensionSettingsHandler::HandleRequestExtensionsData(
ManagedUserServiceFactory::GetForProfile(profile);
bool is_managed = service->ProfileIsManaged();
- bool is_elevated =
- service->IsElevatedForWebContents(web_ui()->GetWebContents());
bool developer_mode =
- (!is_managed || is_elevated) &&
+ !is_managed &&
profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode);
results.SetBoolean("profileIsManaged", is_managed);
- results.SetBoolean("profileIsElevated", is_elevated);
results.SetBoolean("developerMode", developer_mode);
bool load_unpacked_disabled =
@@ -757,7 +692,8 @@ void ExtensionSettingsHandler::HandleEnableMessage(const ListValue* args) {
const Extension* extension =
extension_service_->GetInstalledExtension(extension_id);
- if (!extension || !CheckUserMayModifySettings(extension)) {
+ if (!extension ||
+ !management_policy_->UserMayModifySettings(extension, NULL)) {
LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable was"
<< "made. Extension id: " << extension->id();
return;
@@ -788,10 +724,6 @@ void ExtensionSettingsHandler::HandleEnableMessage(const ListValue* args) {
prefs, extension->id(), true);
}
} else {
- // Get managed user elevation for a specific extension id. The elevation
- // will be removed automatically when |elevation| goes out of scope.
- scoped_ptr<ScopedExtensionElevation> elevation =
- GetScopedElevation(extension_id);
extension_service_->DisableExtension(
extension_id, Extension::DISABLE_USER_ACTION);
}
@@ -836,7 +768,7 @@ void ExtensionSettingsHandler::HandleAllowFileAccessMessage(
if (!extension)
return;
- if (!CheckUserMayModifySettings(extension)) {
+ if (!management_policy_->UserMayModifySettings(extension, NULL)) {
LOG(ERROR) << "Attempt to change allow file access of an extension that is "
<< "non-usermanagable was made. Extension id : "
<< extension->id();
@@ -855,7 +787,7 @@ void ExtensionSettingsHandler::HandleUninstallMessage(const ListValue* args) {
if (!extension)
return;
- if (!CheckUserMayModifySettings(extension)) {
+ if (!management_policy_->UserMayModifySettings(extension, NULL)) {
LOG(ERROR) << "Attempt to uninstall an extension that is non-usermanagable "
<< "was made. Extension id : " << extension->id();
return;
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.h b/chrome/browser/ui/webui/extensions/extension_settings_handler.h
index 49d9ec5..0324406 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.h
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.h
@@ -17,7 +17,6 @@
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/extensions/extension_warning_service.h"
#include "chrome/browser/extensions/requirements_checker.h"
-#include "chrome/browser/managed_mode/scoped_extension_elevation.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -136,22 +135,6 @@ class ExtensionSettingsHandler
// Helper method that reloads all unpacked extensions.
void ReloadUnpackedExtensions();
- // Callback for "setElevated" message.
- void ManagedUserSetElevated(const base::ListValue* args);
-
- // If the authentication of the managed user was successful,
- // it gives this information back to the UI.
- void PassphraseDialogCallback(bool success);
-
- // Generates a temporary elevation for a managed user which is bound to the
- // life-time of the return value.
- scoped_ptr<ScopedExtensionElevation> GetScopedElevation(
- const std::string& extension_id);
-
- // Verifies that the management policy allows the user to enable,
- // disable or uninstall an extension.
- bool CheckUserMayModifySettings(const extensions::Extension* extension);
-
// Callback for "requestExtensionsData" message.
void HandleRequestExtensionsData(const base::ListValue* args);
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 4dcd462..952de94 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -54,11 +54,6 @@
#include "ui/gfx/favicon_size.h"
#include "ui/webui/web_ui_util.h"
-#if defined(ENABLE_MANAGED_USERS)
-#include "chrome/browser/managed_mode/managed_user_service.h"
-#include "chrome/browser/managed_mode/managed_user_service_factory.h"
-#endif
-
using chrome::AppLaunchParams;
using chrome::OpenApplication;
using content::WebContents;
@@ -110,11 +105,6 @@ void AppLauncherHandler::CreateAppInfo(
!service->GetTerminatedExtension(extension->id());
extension->GetBasicInfo(enabled, value);
-#if defined(ENABLE_MANAGED_USERS)
- scoped_ptr<ScopedExtensionElevation> elevation =
- GetScopedElevation(extension->id(), service);
-#endif
-
value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get(
service->profile())->management_policy()->UserMayModifySettings(
extension, NULL));
@@ -537,11 +527,6 @@ void AppLauncherHandler::HandleUninstallApp(const ListValue* args) {
if (!extension)
return;
-#if defined(ENABLE_MANAGED_USERS)
- scoped_ptr<ScopedExtensionElevation> elevation =
- GetScopedElevation(extension->id(), extension_service_);
-#endif
-
if (!extensions::ExtensionSystem::Get(extension_service_->profile())->
management_policy()->UserMayModifySettings(extension, NULL)) {
LOG(ERROR) << "Attempt to uninstall an extension that is non-usermanagable "
@@ -790,19 +775,6 @@ void AppLauncherHandler::RecordAppLaunchByUrl(
RecordAppLaunchType(bucket, extensions::Manifest::TYPE_HOSTED_APP);
}
-#if defined(ENABLE_MANAGED_USERS)
-// static
-scoped_ptr<ScopedExtensionElevation> AppLauncherHandler::GetScopedElevation(
- const std::string& extension_id, ExtensionService* service) {
- ManagedUserService* managed_user_service =
- ManagedUserServiceFactory::GetForProfile(service->profile());
- scoped_ptr<ScopedExtensionElevation> elevation(
- new ScopedExtensionElevation(managed_user_service));
- elevation->AddExtension(extension_id);
- return elevation.Pass();
-}
-#endif
-
void AppLauncherHandler::PromptToEnableApp(const std::string& extension_id) {
if (!extension_id_prompting_.empty())
return; // Only one prompt at a time.
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chrome/browser/ui/webui/ntp/app_launcher_handler.h
index 2e65afd..2751f67 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.h
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.h
@@ -12,7 +12,6 @@
#include "base/prefs/pref_change_registrar.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/favicon/favicon_service.h"
-#include "chrome/browser/managed_mode/scoped_extension_elevation.h"
#include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h"
#include "chrome/common/cancelable_task_tracker.h"
#include "chrome/common/extensions/extension.h"
@@ -140,11 +139,6 @@ class AppLauncherHandler : public content::WebUIMessageHandler,
std::string escaped_url,
extension_misc::AppLaunchBucket bucket);
- // Generates a temporary elevation for a managed user which is bound to the
- // life-time of the return value.
- static scoped_ptr<ScopedExtensionElevation> GetScopedElevation(
- const std::string& extension_id, ExtensionService* service);
-
// Prompts the user to re-enable the app for |extension_id|.
void PromptToEnableApp(const std::string& extension_id);
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 91e0dea..ea0630a 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -953,8 +953,6 @@
'browser/managed_mode/managed_user_service.h',
'browser/managed_mode/managed_user_service_factory.cc',
'browser/managed_mode/managed_user_service_factory.h',
- 'browser/managed_mode/scoped_extension_elevation.cc',
- 'browser/managed_mode/scoped_extension_elevation.h',
'browser/media/audio_stream_indicator.cc',
'browser/media/audio_stream_indicator.h',
'browser/media/media_capture_devices_dispatcher.cc',