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

Unified Diff: chrome/browser/extensions/crx_installer.h

Issue 10689097: Enforce the 'requirements' field in manifests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/crx_installer.h
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h
index 1cad3601bc61cfb936cb19036510cc23d3db9082..a6c2f013a38fb06f4fd603e4ab566ea4fda484b9 100644
--- a/chrome/browser/extensions/crx_installer.h
+++ b/chrome/browser/extensions/crx_installer.h
@@ -25,6 +25,7 @@ class SkBitmap;
namespace extensions {
class ExtensionUpdaterTest;
+class RequirementsChecker;
// This class installs a crx file into a profile.
//
@@ -165,6 +166,10 @@ class CrxInstaller
page_ordinal_ = page_ordinal;
}
+ void set_error_on_unsupported_requirements(bool val) {
+ error_on_unsupported_requirements_ = val;
+ }
+
bool did_handle_successfully() const { return did_handle_successfully_; }
Profile* profile() { return profile_; }
@@ -186,19 +191,25 @@ class CrxInstaller
// Called after OnUnpackSuccess as a last check to see whether the install
// should complete.
- CrxInstallerError AllowInstall(const Extension* extension);
+ CrxInstallerError AllowInstall(Extension* extension);
// SandboxedUnpackerClient
virtual void OnUnpackFailure(const string16& error_message) OVERRIDE;
virtual void OnUnpackSuccess(const FilePath& temp_dir,
const FilePath& extension_dir,
const base::DictionaryValue* original_manifest,
- const Extension* extension) OVERRIDE;
+ Extension* extension) OVERRIDE;
// Returns true if we can skip confirmation because the install was
// whitelisted.
bool CanSkipConfirmation();
+ // Called on the UI thread to start the requirements check on the extension.
+ void CheckRequirements();
+
+ // Runs on the FILE thread. Callback from RequirementsChecker.
+ void RequirementsChecked(std::vector<std::string> errors);
+
// Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt)
// that it is OK to install this extension.
void ConfirmInstall();
@@ -212,7 +223,7 @@ class CrxInstaller
void ReportFailureFromUIThread(const CrxInstallerError& error);
void ReportSuccessFromFileThread();
void ReportSuccessFromUIThread();
- void NotifyCrxInstallComplete(const Extension* extension);
+ void NotifyCrxInstallComplete(Extension* extension);
// The file we're installing.
FilePath source_file_;
@@ -267,7 +278,7 @@ class CrxInstaller
// The extension we're installing. We own this and either pass it off to
// ExtensionService on success, or delete it on failure.
- scoped_refptr<const Extension> extension_;
+ scoped_refptr<Extension> extension_;
// The ordinal of the NTP apps page |extension_| will be shown on.
StringOrdinal page_ordinal_;
@@ -339,6 +350,15 @@ class CrxInstaller
// Whether we should record an oauth2 grant upon successful install.
bool record_oauth2_grant_;
+ // Whether we should produce an error if the manifest declares requirements
+ // that are not met. If false and there is an unmet requirement, the install
+ // will continue but the extension will be distabled.
+ bool error_on_unsupported_requirements_;
+
+ scoped_ptr<RequirementsChecker> requirements_checker_;
+
+ std::vector<std::string> requirement_errors_;
+
DISALLOW_COPY_AND_ASSIGN(CrxInstaller);
};

Powered by Google App Engine
This is Rietveld 408576698