| Index: chrome/browser/extensions/extension_install_checker.h
|
| diff --git a/chrome/browser/extensions/extension_install_checker.h b/chrome/browser/extensions/extension_install_checker.h
|
| index b73255bdd4f1360c0239f6ec2f97fe434aa4756a..83b58e50f52d132b61ee7681b89fc412a9d4c2bf 100644
|
| --- a/chrome/browser/extensions/extension_install_checker.h
|
| +++ b/chrome/browser/extensions/extension_install_checker.h
|
| @@ -22,8 +22,8 @@ namespace extensions {
|
|
|
| class RequirementsChecker;
|
|
|
| -// Performs common checks for an extension. Extensions that violate these checks
|
| -// would be disabled or not even installed.
|
| +// Performs common checks for validating whether an extension may be installed.
|
| +// This class should be Start()-ed at most once.
|
| class ExtensionInstallChecker {
|
| public:
|
| // Called when checks are complete. The returned value is a bitmask of
|
| @@ -42,25 +42,24 @@ class ExtensionInstallChecker {
|
| CHECK_ALL = (1 << 3) - 1
|
| };
|
|
|
| - explicit ExtensionInstallChecker(Profile* profile);
|
| + // |enabled_checks| is a bitmask of CheckTypes to run.
|
| + // If |fail_fast| is true, the callback to Start() will be invoked once any
|
| + // check fails. Otherwise it will be invoked when all checks have completed.
|
| + ExtensionInstallChecker(Profile* profile,
|
| + scoped_refptr<const Extension> extension,
|
| + int enabled_checks,
|
| + bool fail_fast);
|
| virtual ~ExtensionInstallChecker();
|
|
|
| - // Start a set of checks. |enabled_checks| is a bitmask of CheckTypes to run.
|
| - // If |fail_fast| is true, the callback will be invoked once any check fails.
|
| - // Otherwise it will be invoked when all checks have completed. |callback|
|
| - // will only be called once.
|
| + // Starts the set of checks. |callback| will only be called once.
|
| // This function must be called on the UI thread. The callback also occurs on
|
| // the UI thread. Checks may run asynchronously in parallel.
|
| - // If checks are currently running, the caller must wait for the callback to
|
| - // be invoked before starting another set of checks.
|
| - void Start(int enabled_checks, bool fail_fast, const Callback& callback);
|
| + // This function should be invoked at most once.
|
| + void Start(const Callback& callback);
|
|
|
| Profile* profile() const { return profile_; }
|
|
|
| const scoped_refptr<const Extension>& extension() { return extension_; }
|
| - void set_extension(const scoped_refptr<const Extension>& extension) {
|
| - extension_ = extension;
|
| - }
|
|
|
| // Returns true if any checks are currently running.
|
| bool is_running() const { return running_checks_ != 0; }
|
| @@ -84,14 +83,10 @@ class ExtensionInstallChecker {
|
| void OnManagementPolicyCheckDone(bool allows_load, const std::string& error);
|
|
|
| virtual void CheckRequirements();
|
| - void OnRequirementsCheckDone(int sequence_number,
|
| - const std::vector<std::string>& errors);
|
| + void OnRequirementsCheckDone(const std::vector<std::string>& errors);
|
|
|
| virtual void CheckBlacklistState();
|
| - void OnBlacklistStateCheckDone(int sequence_number, BlacklistState state);
|
| -
|
| - virtual void ResetResults();
|
| - int current_sequence_number() const { return current_sequence_number_; }
|
| + void OnBlacklistStateCheckDone(BlacklistState state);
|
|
|
| private:
|
| void MaybeInvokeCallback();
|
| @@ -114,8 +109,8 @@ class ExtensionInstallChecker {
|
| bool policy_allows_load_;
|
| std::string policy_error_;
|
|
|
| - // The sequence number of the currently running checks.
|
| - int current_sequence_number_;
|
| + // Bitmask of enabled checks.
|
| + int enabled_checks_;
|
|
|
| // Bitmask of currently running checks.
|
| int running_checks_;
|
|
|