| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // verification process works by sending a request to a backend server to get a | 36 // verification process works by sending a request to a backend server to get a |
| 37 // signature proving that a set of extensions are verified. This signature is | 37 // signature proving that a set of extensions are verified. This signature is |
| 38 // written into the extension preferences and is checked for validity when | 38 // written into the extension preferences and is checked for validity when |
| 39 // being read back again. | 39 // being read back again. |
| 40 // | 40 // |
| 41 // This class should be kept notified of runtime changes to the set of | 41 // This class should be kept notified of runtime changes to the set of |
| 42 // extensions installed from the webstore. | 42 // extensions installed from the webstore. |
| 43 class InstallVerifier : public ManagementPolicy::Provider { | 43 class InstallVerifier : public ManagementPolicy::Provider { |
| 44 public: | 44 public: |
| 45 InstallVerifier(ExtensionPrefs* prefs, content::BrowserContext* context); | 45 InstallVerifier(ExtensionPrefs* prefs, content::BrowserContext* context); |
| 46 virtual ~InstallVerifier(); | 46 ~InstallVerifier() override; |
| 47 | 47 |
| 48 // Returns whether |extension| is of a type that needs verification. | 48 // Returns whether |extension| is of a type that needs verification. |
| 49 static bool NeedsVerification(const Extension& extension); | 49 static bool NeedsVerification(const Extension& extension); |
| 50 | 50 |
| 51 // Determines if an extension claims to be from the webstore. | 51 // Determines if an extension claims to be from the webstore. |
| 52 static bool IsFromStore(const Extension& extension); | 52 static bool IsFromStore(const Extension& extension); |
| 53 | 53 |
| 54 // Initializes this object for use, including reading preferences and | 54 // Initializes this object for use, including reading preferences and |
| 55 // validating the stored signature. | 55 // validating the stored signature. |
| 56 void Init(); | 56 void Init(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 void AddProvisional(const ExtensionIdSet& ids); | 77 void AddProvisional(const ExtensionIdSet& ids); |
| 78 | 78 |
| 79 // Removes an id or set of ids from the verified list. | 79 // Removes an id or set of ids from the verified list. |
| 80 void Remove(const std::string& id); | 80 void Remove(const std::string& id); |
| 81 void RemoveMany(const ExtensionIdSet& ids); | 81 void RemoveMany(const ExtensionIdSet& ids); |
| 82 | 82 |
| 83 // Returns whether an extension id is allowed by policy. | 83 // Returns whether an extension id is allowed by policy. |
| 84 bool AllowedByEnterprisePolicy(const std::string& id) const; | 84 bool AllowedByEnterprisePolicy(const std::string& id) const; |
| 85 | 85 |
| 86 // ManagementPolicy::Provider interface. | 86 // ManagementPolicy::Provider interface. |
| 87 virtual std::string GetDebugPolicyProviderName() const override; | 87 std::string GetDebugPolicyProviderName() const override; |
| 88 virtual bool MustRemainDisabled(const Extension* extension, | 88 bool MustRemainDisabled(const Extension* extension, |
| 89 Extension::DisableReason* reason, | 89 Extension::DisableReason* reason, |
| 90 base::string16* error) const override; | 90 base::string16* error) const override; |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 // We keep a list of operations to the current set of extensions. | 93 // We keep a list of operations to the current set of extensions. |
| 94 enum OperationType { | 94 enum OperationType { |
| 95 ADD_SINGLE, // Adding a single extension to be verified. | 95 ADD_SINGLE, // Adding a single extension to be verified. |
| 96 ADD_ALL, // Adding all extensions to be verified. | 96 ADD_ALL, // Adding all extensions to be verified. |
| 97 ADD_ALL_BOOTSTRAP, // Adding all extensions because of a bootstrapping. | 97 ADD_ALL_BOOTSTRAP, // Adding all extensions because of a bootstrapping. |
| 98 ADD_PROVISIONAL, // Adding one or more provisionally-allowed extensions. | 98 ADD_PROVISIONAL, // Adding one or more provisionally-allowed extensions. |
| 99 REMOVE // Remove one or more extensions. | 99 REMOVE // Remove one or more extensions. |
| 100 }; | 100 }; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 ExtensionIdSet provisional_; | 169 ExtensionIdSet provisional_; |
| 170 | 170 |
| 171 base::WeakPtrFactory<InstallVerifier> weak_factory_; | 171 base::WeakPtrFactory<InstallVerifier> weak_factory_; |
| 172 | 172 |
| 173 DISALLOW_COPY_AND_ASSIGN(InstallVerifier); | 173 DISALLOW_COPY_AND_ASSIGN(InstallVerifier); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 } // namespace extensions | 176 } // namespace extensions |
| 177 | 177 |
| 178 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ | 178 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ |
| OLD | NEW |