| 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 <memory> |
| 8 #include <queue> | 9 #include <queue> |
| 9 #include <set> | 10 #include <set> |
| 10 #include <string> | 11 #include <string> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
| 18 #include "extensions/browser/management_policy.h" | 18 #include "extensions/browser/management_policy.h" |
| 19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class BrowserContext; | 22 class BrowserContext; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 // Begins the process of fetching a new signature, based on applying the | 146 // Begins the process of fetching a new signature, based on applying the |
| 147 // operation at the head of the queue to the current set of ids in | 147 // operation at the head of the queue to the current set of ids in |
| 148 // |signature_| (if any) and then sending a request to sign that. | 148 // |signature_| (if any) and then sending a request to sign that. |
| 149 void BeginFetch(); | 149 void BeginFetch(); |
| 150 | 150 |
| 151 // Saves the current value of |signature_| to the prefs; | 151 // Saves the current value of |signature_| to the prefs; |
| 152 void SaveToPrefs(); | 152 void SaveToPrefs(); |
| 153 | 153 |
| 154 // Called with the result of a signature request, or NULL on failure. | 154 // Called with the result of a signature request, or NULL on failure. |
| 155 void SignatureCallback(scoped_ptr<InstallSignature> signature); | 155 void SignatureCallback(std::unique_ptr<InstallSignature> signature); |
| 156 | 156 |
| 157 ExtensionPrefs* prefs_; | 157 ExtensionPrefs* prefs_; |
| 158 | 158 |
| 159 // The context with which the InstallVerifier is associated. | 159 // The context with which the InstallVerifier is associated. |
| 160 content::BrowserContext* context_; | 160 content::BrowserContext* context_; |
| 161 | 161 |
| 162 // Have we finished our bootstrap check yet? | 162 // Have we finished our bootstrap check yet? |
| 163 bool bootstrap_check_complete_; | 163 bool bootstrap_check_complete_; |
| 164 | 164 |
| 165 // This is the most up-to-date signature, read out of |prefs_| during | 165 // This is the most up-to-date signature, read out of |prefs_| during |
| 166 // initialization and updated anytime we get new id's added. | 166 // initialization and updated anytime we get new id's added. |
| 167 scoped_ptr<InstallSignature> signature_; | 167 std::unique_ptr<InstallSignature> signature_; |
| 168 | 168 |
| 169 // The current InstallSigner, if we have a signature request running. | 169 // The current InstallSigner, if we have a signature request running. |
| 170 scoped_ptr<InstallSigner> signer_; | 170 std::unique_ptr<InstallSigner> signer_; |
| 171 | 171 |
| 172 // A queue of operations to apply to the current set of allowed ids. | 172 // A queue of operations to apply to the current set of allowed ids. |
| 173 std::queue<linked_ptr<PendingOperation> > operation_queue_; | 173 std::queue<linked_ptr<PendingOperation> > operation_queue_; |
| 174 | 174 |
| 175 // A set of ids that have been provisionally added, which we're willing to | 175 // A set of ids that have been provisionally added, which we're willing to |
| 176 // consider allowed until we hear back from the server signature request. | 176 // consider allowed until we hear back from the server signature request. |
| 177 ExtensionIdSet provisional_; | 177 ExtensionIdSet provisional_; |
| 178 | 178 |
| 179 base::WeakPtrFactory<InstallVerifier> weak_factory_; | 179 base::WeakPtrFactory<InstallVerifier> weak_factory_; |
| 180 | 180 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 192 static bool ShouldBypass(); | 192 static bool ShouldBypass(); |
| 193 | 193 |
| 194 private: | 194 private: |
| 195 bool old_value_; | 195 bool old_value_; |
| 196 DISALLOW_COPY_AND_ASSIGN(ScopedInstallVerifierBypassForTest); | 196 DISALLOW_COPY_AND_ASSIGN(ScopedInstallVerifierBypassForTest); |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 } // namespace extensions | 199 } // namespace extensions |
| 200 | 200 |
| 201 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ | 201 #endif // CHROME_BROWSER_EXTENSIONS_INSTALL_VERIFIER_H_ |
| OLD | NEW |