Chromium Code Reviews| 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 fd22f42c3d74ffcab2940190364ad87ac60e3828..39c7179f3390e28601b6da02706fb416767a62c1 100644 |
| --- a/chrome/browser/extensions/extension_install_checker.h |
| +++ b/chrome/browser/extensions/extension_install_checker.h |
| @@ -11,9 +11,8 @@ |
| #include "base/callback.h" |
| #include "base/macros.h" |
| -#include "base/memory/weak_ptr.h" |
| #include "base/strings/string16.h" |
| -#include "extensions/browser/blacklist_state.h" |
| +#include "extensions/browser/preload_check.h" |
| #include "extensions/common/extension.h" |
| class Profile; |
| @@ -66,43 +65,49 @@ class ExtensionInstallChecker { |
| return requirement_errors_; |
| } |
| - // Returns the blacklist state of the extension. A blacklist state of |
| + // Returns the blacklist error of the extension. A blacklist state of |
| // BLACKLISTED_MALWARE is considered to be a check failure. |
|
Devlin
2017/03/22 15:08:46
BLACKLISTED_ID
michaelpg
2017/03/24 02:34:16
I see why this is confusing, so I've changed the c
|
| - BlacklistState blacklist_state() const { return blacklist_state_; } |
| + PreloadCheck::Error blacklist_error() const { return blacklist_error_; } |
| // Returns whether management policy permits installation of the extension. |
| - bool policy_allows_load() const { return policy_allows_load_; } |
| const std::string& policy_error() const { return policy_error_; } |
| + void SetBlacklistCheckForTesting(std::unique_ptr<PreloadCheck> policy_check) { |
| + blacklist_check_ = std::move(policy_check); |
| + } |
| + void SetPolicyCheckForTesting(std::unique_ptr<PreloadCheck> policy_check) { |
| + policy_check_ = std::move(policy_check); |
| + } |
| + |
| protected: |
| virtual void CheckManagementPolicy(); |
| - void OnManagementPolicyCheckDone(bool allows_load, const std::string& error); |
| + void OnManagementPolicyCheckDone(PreloadCheck::Errors errors); |
| virtual void CheckRequirements(); |
| void OnRequirementsCheckDone(const std::vector<std::string>& errors); |
| virtual void CheckBlacklistState(); |
| - void OnBlacklistStateCheckDone(BlacklistState state); |
| + void OnBlacklistStateCheckDone(PreloadCheck::Errors errors); |
| private: |
| void MaybeInvokeCallback(); |
| - std::unique_ptr<RequirementsChecker> requirements_checker_; |
| - |
| // The Profile where the extension is being installed in. |
| Profile* profile_; |
| // The extension to run checks for. |
| scoped_refptr<const Extension> extension_; |
| - // Requirement violations. |
| + // Checks requirements specified in the manifest. |
| + std::unique_ptr<RequirementsChecker> requirements_checker_; |
| std::vector<std::string> requirement_errors_; |
| - // Result of the blacklist state check. |
| - BlacklistState blacklist_state_; |
| + // Checks if the extension is blacklisted. |
| + std::unique_ptr<PreloadCheck> blacklist_check_; |
| + PreloadCheck::Error blacklist_error_; |
| - // Whether the extension can be installed, according to management policies. |
| - bool policy_allows_load_; |
| + // Checks whether management policies allow the extension to be installed. |
| + std::unique_ptr<PreloadCheck> policy_check_; |
| std::string policy_error_; |
| // Bitmask of enabled checks. |
| @@ -117,8 +122,6 @@ class ExtensionInstallChecker { |
| // The callback to invoke when checks are complete. |
| Callback callback_; |
| - base::WeakPtrFactory<ExtensionInstallChecker> weak_ptr_factory_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(ExtensionInstallChecker); |
| }; |