| 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> |
| 9 |
| 8 #include <set> | 10 #include <set> |
| 9 | 11 |
| 10 #include "extensions/browser/content_verify_job.h" | 12 #include "extensions/browser/content_verify_job.h" |
| 11 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 12 | 14 |
| 13 namespace base { | 15 namespace base { |
| 14 class FilePath; | 16 class FilePath; |
| 15 class Version; | 17 class Version; |
| 16 } | 18 } |
| 17 | 19 |
| 18 namespace extensions { | 20 namespace extensions { |
| 19 | 21 |
| 20 class Extension; | 22 class Extension; |
| 21 | 23 |
| 22 // 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. |
| 23 struct ContentVerifierKey { | 25 struct ContentVerifierKey { |
| 24 const uint8* data; | 26 const uint8_t* data; |
| 25 int size; | 27 int size; |
| 26 | 28 |
| 27 ContentVerifierKey() : data(NULL), size(0) {} | 29 ContentVerifierKey() : data(NULL), size(0) {} |
| 28 | 30 |
| 29 ContentVerifierKey(const uint8* data, int size) { | 31 ContentVerifierKey(const uint8_t* data, int size) { |
| 30 this->data = data; | 32 this->data = data; |
| 31 this->size = size; | 33 this->size = size; |
| 32 } | 34 } |
| 33 }; | 35 }; |
| 34 | 36 |
| 35 // This is an interface for clients that want to use a ContentVerifier. | 37 // This is an interface for clients that want to use a ContentVerifier. |
| 36 class ContentVerifierDelegate { | 38 class ContentVerifierDelegate { |
| 37 public: | 39 public: |
| 38 // Note that it is important for these to appear in increasing "severity" | 40 // Note that it is important for these to appear in increasing "severity" |
| 39 // order, because we use this to let command line flags increase, but not | 41 // order, because we use this to let command line flags increase, but not |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 79 |
| 78 // Called when the content verifier detects that a read of a file inside | 80 // Called when the content verifier detects that a read of a file inside |
| 79 // an extension did not match its expected hash. | 81 // an extension did not match its expected hash. |
| 80 virtual void VerifyFailed(const std::string& extension_id, | 82 virtual void VerifyFailed(const std::string& extension_id, |
| 81 ContentVerifyJob::FailureReason reason) = 0; | 83 ContentVerifyJob::FailureReason reason) = 0; |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 } // namespace extensions | 86 } // namespace extensions |
| 85 | 87 |
| 86 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ | 88 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ |
| OLD | NEW |