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 int size; |
28 | 28 |
29 ContentVerifierKey() : data(NULL), size(0) {} | 29 ContentVerifierKey(const uint8_t* data, int size) : data(data), size(size) {} |
30 | |
31 ContentVerifierKey(const uint8_t* data, int size) { | |
32 this->data = data; | |
33 this->size = size; | |
34 } | |
35 }; | 30 }; |
36 | 31 |
37 // This is an interface for clients that want to use a ContentVerifier. | 32 // This is an interface for clients that want to use a ContentVerifier. |
38 class ContentVerifierDelegate { | 33 class ContentVerifierDelegate { |
39 public: | 34 public: |
40 // Note that it is important for these to appear in increasing "severity" | 35 // Note that it is important for these to appear in increasing "severity" |
41 // order, because we use this to let command line flags increase, but not | 36 // order, because we use this to let command line flags increase, but not |
42 // decrease, the mode you're running in compared to the experiment group. | 37 // decrease, the mode you're running in compared to the experiment group. |
43 enum Mode { | 38 enum Mode { |
44 // Do not try to fetch content hashes if they are missing, and do not | 39 // 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... |
79 | 74 |
80 // Called when the content verifier detects that a read of a file inside | 75 // Called when the content verifier detects that a read of a file inside |
81 // an extension did not match its expected hash. | 76 // an extension did not match its expected hash. |
82 virtual void VerifyFailed(const std::string& extension_id, | 77 virtual void VerifyFailed(const std::string& extension_id, |
83 ContentVerifyJob::FailureReason reason) = 0; | 78 ContentVerifyJob::FailureReason reason) = 0; |
84 }; | 79 }; |
85 | 80 |
86 } // namespace extensions | 81 } // namespace extensions |
87 | 82 |
88 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ | 83 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ |
OLD | NEW |