From 849749dd183cb18744d12f31735dd51b330018f0 Mon Sep 17 00:00:00 2001 From: "akuegel@chromium.org" Date: Mon, 6 May 2013 17:30:45 +0000 Subject: Currently the unpacked_installer does not check if there is a policy which might disallow allowing an extension. This CL changes this and also adds request authorization calls for managed users. Moreover some common logic of unpacked_installer and crx_installer is combined. The managed_user_service_unittest is adjusted to these changes. BUG=171370 TEST=Manual Review URL: https://chromiumcodereview.appspot.com/12965012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198476 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/crx_installer.h | 37 ++++++++++++------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'chrome/browser/extensions/crx_installer.h') diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h index e394c33..a66b4a1 100644 --- a/chrome/browser/extensions/crx_installer.h +++ b/chrome/browser/extensions/crx_installer.h @@ -13,6 +13,7 @@ #include "base/memory/weak_ptr.h" #include "base/version.h" #include "chrome/browser/extensions/extension_install_prompt.h" +#include "chrome/browser/extensions/extension_installer.h" #include "chrome/browser/extensions/sandboxed_unpacker.h" #include "chrome/browser/extensions/webstore_installer.h" #include "chrome/common/extensions/extension.h" @@ -74,17 +75,17 @@ class CrxInstaller NumOffStoreInstallAllowReasons }; - // Extensions will be installed into frontend->install_directory(), - // then registered with |frontend|. Any install UI will be displayed + // Extensions will be installed into service->install_directory(), + // then registered with |service|. Any install UI will be displayed // using |client|. Pass NULL for |client| for silent install static scoped_refptr Create( - ExtensionService* frontend, + ExtensionService* service, ExtensionInstallPrompt* client); // Same as the previous method, except use the |approval| to bypass the // prompt. Note that the caller retains ownership of |approval|. static scoped_refptr Create( - ExtensionService* frontend, + ExtensionService* service, ExtensionInstallPrompt* client, const WebstoreInstaller::Approval* approval); @@ -191,14 +192,16 @@ class CrxInstaller bool did_handle_successfully() const { return did_handle_successfully_; } - Profile* profile() { return profile_; } + Profile* profile() { return installer_.profile(); } + + const Extension* extension() { return installer_.extension(); } private: friend class ::ExtensionServiceTest; friend class ExtensionUpdaterTest; friend class ExtensionCrxInstallerTest; - CrxInstaller(base::WeakPtr frontend_weak, + CrxInstaller(base::WeakPtr service_weak, ExtensionInstallPrompt* client, const WebstoreInstaller::Approval* approval); virtual ~CrxInstaller(); @@ -227,13 +230,7 @@ class CrxInstaller // Runs on the UI thread. Callback from RequirementsChecker. void OnRequirementsChecked(std::vector requirement_errors); -#if defined(ENABLE_MANAGED_USERS) - // Runs on the UI thread. Callback from the managed user passphrase dialog. - void OnAuthorizationResult(bool success); -#endif - - // Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt) - // that it is OK to install this extension. + // Runs on the UI thread. Confirms the installation to the ExtensionService. void ConfirmInstall(); // Runs on File thread. Install the unpacked extension into the profile and @@ -311,10 +308,6 @@ class CrxInstaller // apps. bool create_app_shortcut_; - // The extension we're installing. We own this and either pass it off to - // ExtensionService on success, or delete it on failure. - scoped_refptr extension_; - // The ordinal of the NTP apps page |extension_| will be shown on. syncer::StringOrdinal page_ordinal_; @@ -334,10 +327,7 @@ class CrxInstaller base::FilePath temp_dir_; // The frontend we will report results back to. - base::WeakPtr frontend_weak_; - - // The Profile where the extension is being installed in. - Profile* profile_; + base::WeakPtr service_weak_; // The client we will work with to do the installation. This can be NULL, in // which case the install is silent. @@ -388,8 +378,6 @@ class CrxInstaller // will continue but the extension will be distabled. bool error_on_unsupported_requirements_; - scoped_ptr requirements_checker_; - bool has_requirement_errors_; bool install_wait_for_idle_; @@ -404,6 +392,9 @@ class CrxInstaller // page. bool update_from_settings_page_; + // Gives access to common methods and data of an extension installer. + ExtensionInstaller installer_; + DISALLOW_COPY_AND_ASSIGN(CrxInstaller); }; -- cgit v1.1