OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ |
| 6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ |
| 7 |
| 8 #include "url/gurl.h" |
| 9 |
| 10 namespace base { |
| 11 class Version; |
| 12 } |
| 13 |
| 14 namespace extensions { |
| 15 |
| 16 class Extension; |
| 17 |
| 18 // A pointer to the bytes of a public key, and the number of bytes. |
| 19 struct ContentVerifierKey { |
| 20 const uint8* data; |
| 21 int size; |
| 22 |
| 23 ContentVerifierKey(const uint8* data, int size) { |
| 24 this->data = data; |
| 25 this->size = size; |
| 26 } |
| 27 }; |
| 28 |
| 29 // This is an interface for clients that want to use a ContentVerifier. |
| 30 class ContentVerifierDelegate { |
| 31 public: |
| 32 virtual ~ContentVerifierDelegate() {} |
| 33 |
| 34 // This should return true if the given extension should have its content |
| 35 // verified. |
| 36 virtual bool ShouldBeVerified(const Extension& extension) = 0; |
| 37 |
| 38 // Should return the public key to use for validating signatures via the two |
| 39 // out parameters. NOTE: the pointer returned *must* remain valid for the |
| 40 // lifetime of this object. |
| 41 virtual const ContentVerifierKey& PublicKey() = 0; |
| 42 |
| 43 // This should return a URL that can be used to fetch the |
| 44 // verified_contents.json containing signatures for the given extension |
| 45 // id/version pair. |
| 46 virtual GURL GetSignatureFetchUrl(const std::string& extension_id, |
| 47 const base::Version& version) = 0; |
| 48 |
| 49 // Called when the content verifier detects that a read of a file inside |
| 50 // an extension did not match its expected hash. |
| 51 virtual void VerifyFailed(const std::string& extension_id) = 0; |
| 52 }; |
| 53 |
| 54 } // namespace extensions |
| 55 |
| 56 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ |
OLD | NEW |