| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 // Initializes this object for use, including reading preferences and | 47 // Initializes this object for use, including reading preferences and |
| 48 // validating the stored signature. | 48 // validating the stored signature. |
| 49 void Init(); | 49 void Init(); |
| 50 | 50 |
| 51 // Do we need to be bootstrapped? (i.e. do we have a signature already). If | 51 // Do we need to be bootstrapped? (i.e. do we have a signature already). If |
| 52 // this is true, then consumers of this class should use Add/AddMany to get | 52 // this is true, then consumers of this class should use Add/AddMany to get |
| 53 // an initial one so that MustRemainDisabled can actually check against it. | 53 // an initial one so that MustRemainDisabled can actually check against it. |
| 54 bool NeedsBootstrap(); | 54 bool NeedsBootstrap(); |
| 55 | 55 |
| 56 // Returns the timestamp of our InstallSignature, if we have one. |
| 57 base::Time SignatureTimestamp(); |
| 58 |
| 56 // A callback for indicating success/failure of adding new ids. | 59 // A callback for indicating success/failure of adding new ids. |
| 57 typedef base::Callback<void(bool)> AddResultCallback; | 60 typedef base::Callback<void(bool)> AddResultCallback; |
| 58 | 61 |
| 59 // Try adding a new |id| (or set of ids) to the list of verified ids. When | 62 // Try adding a new |id| (or set of ids) to the list of verified ids. When |
| 60 // this process is finished |callback| will be run with success/failure of | 63 // this process is finished |callback| will be run with success/failure of |
| 61 // the signature request (not necessarily whether the ids were verified). | 64 // the signature request (not necessarily whether the ids were verified). |
| 62 void Add(const std::string& id, const AddResultCallback& callback); | 65 void Add(const std::string& id, const AddResultCallback& callback); |
| 63 void AddMany(const ExtensionIdSet& ids, | 66 void AddMany(const ExtensionIdSet& ids, |
| 64 const AddResultCallback& callback); | 67 const AddResultCallback& callback); |
| 65 | 68 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 103 |
| 101 // Removes any no-longer-installed ids, requesting a new signature if needed. | 104 // Removes any no-longer-installed ids, requesting a new signature if needed. |
| 102 void GarbageCollect(); | 105 void GarbageCollect(); |
| 103 | 106 |
| 104 // Returns whether an extension id is allowed by policy. | 107 // Returns whether an extension id is allowed by policy. |
| 105 bool AllowedByEnterprisePolicy(const std::string& id) const; | 108 bool AllowedByEnterprisePolicy(const std::string& id) const; |
| 106 | 109 |
| 107 // Returns whether the given |id| is included in our verified signature. | 110 // Returns whether the given |id| is included in our verified signature. |
| 108 bool IsVerified(const std::string& id) const; | 111 bool IsVerified(const std::string& id) const; |
| 109 | 112 |
| 113 // Returns true if the extension with |id| was installed later than the |
| 114 // timestamp of our signature. |
| 115 bool WasInstalledAfterSignature(const std::string& id) const; |
| 116 |
| 110 // Begins the process of fetching a new signature, based on applying the | 117 // Begins the process of fetching a new signature, based on applying the |
| 111 // operation at the head of the queue to the current set of ids in | 118 // operation at the head of the queue to the current set of ids in |
| 112 // |signature_| (if any) and then sending a request to sign that. | 119 // |signature_| (if any) and then sending a request to sign that. |
| 113 void BeginFetch(); | 120 void BeginFetch(); |
| 114 | 121 |
| 115 // Saves the current value of |signature_| to the prefs; | 122 // Saves the current value of |signature_| to the prefs; |
| 116 void SaveToPrefs(); | 123 void SaveToPrefs(); |
| 117 | 124 |
| 118 // Called with the result of a signature request, or NULL on failure. | 125 // Called with the result of a signature request, or NULL on failure. |
| 119 void SignatureCallback(scoped_ptr<InstallSignature> signature); | 126 void SignatureCallback(scoped_ptr<InstallSignature> signature); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 134 // A set of ids that have been provisionally added, which we're willing to | 141 // A set of ids that have been provisionally added, which we're willing to |
| 135 // consider allowed until we hear back from the server signature request. | 142 // consider allowed until we hear back from the server signature request. |
| 136 ExtensionIdSet provisional_; | 143 ExtensionIdSet provisional_; |
| 137 | 144 |
| 138 DISALLOW_COPY_AND_ASSIGN(InstallVerifier); | 145 DISALLOW_COPY_AND_ASSIGN(InstallVerifier); |
| 139 }; | 146 }; |
| 140 | 147 |
| 141 } // namespace extensions | 148 } // namespace extensions |
| 142 | 149 |
| 143 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ | 150 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ |
| OLD | NEW |