| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ | 5 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ |
| 6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ | 6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "extensions/browser/content_verify_job.h" | 12 #include "extensions/browser/content_verify_job.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class FilePath; | 16 class FilePath; |
| 17 class Version; | 17 class Version; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 | 21 |
| 22 class Extension; | 22 class Extension; |
| 23 | 23 |
| 24 // A pointer to the bytes of a public key, and the number of bytes. | 24 // A pointer to the bytes of a public key, and the number of bytes. |
| 25 struct ContentVerifierKey { | 25 struct ContentVerifierKey { |
| 26 const uint8_t* data; | 26 const uint8_t* data; |
| 27 int size; | 27 size_t size; |
| 28 | 28 |
| 29 ContentVerifierKey(const uint8_t* data, int size) : data(data), size(size) {} | 29 ContentVerifierKey(const uint8_t* data, size_t size) |
| 30 : data(data), size(size) {} |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 // This is an interface for clients that want to use a ContentVerifier. | 33 // This is an interface for clients that want to use a ContentVerifier. |
| 33 class ContentVerifierDelegate { | 34 class ContentVerifierDelegate { |
| 34 public: | 35 public: |
| 35 // Note that it is important for these to appear in increasing "severity" | 36 // Note that it is important for these to appear in increasing "severity" |
| 36 // order, because we use this to let command line flags increase, but not | 37 // order, because we use this to let command line flags increase, but not |
| 37 // decrease, the mode you're running in compared to the experiment group. | 38 // decrease, the mode you're running in compared to the experiment group. |
| 38 enum Mode { | 39 enum Mode { |
| 39 // Do not try to fetch content hashes if they are missing, and do not | 40 // Do not try to fetch content hashes if they are missing, and do not |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 75 |
| 75 // Called when the content verifier detects that a read of a file inside | 76 // Called when the content verifier detects that a read of a file inside |
| 76 // an extension did not match its expected hash. | 77 // an extension did not match its expected hash. |
| 77 virtual void VerifyFailed(const std::string& extension_id, | 78 virtual void VerifyFailed(const std::string& extension_id, |
| 78 ContentVerifyJob::FailureReason reason) = 0; | 79 ContentVerifyJob::FailureReason reason) = 0; |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 } // namespace extensions | 82 } // namespace extensions |
| 82 | 83 |
| 83 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ | 84 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ |
| OLD | NEW |