| 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 <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // If hashes are present, enforce them. If they are missing, try to fetch | 48 // If hashes are present, enforce them. If they are missing, try to fetch |
| 49 // them. | 49 // them. |
| 50 ENFORCE, | 50 ENFORCE, |
| 51 | 51 |
| 52 // Treat the absence of hashes the same as a verification failure. | 52 // Treat the absence of hashes the same as a verification failure. |
| 53 ENFORCE_STRICT | 53 ENFORCE_STRICT |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 virtual ~ContentVerifierDelegate() {} | 56 virtual ~ContentVerifierDelegate() {} |
| 57 | 57 |
| 58 // This should return true if the given extension should have its content | 58 // This should return what verification mode is appropriate for the given |
| 59 // verified. | 59 // extension, if any. |
| 60 virtual Mode ShouldBeVerified(const Extension& extension) = 0; | 60 virtual Mode ShouldBeVerified(const Extension& extension) = 0; |
| 61 | 61 |
| 62 // Should return the public key to use for validating signatures via the two | 62 // Should return the public key to use for validating signatures via the two |
| 63 // out parameters. NOTE: the pointer returned *must* remain valid for the | 63 // out parameters. NOTE: the pointer returned *must* remain valid for the |
| 64 // lifetime of this object. | 64 // lifetime of this object. |
| 65 virtual const ContentVerifierKey& PublicKey() = 0; | 65 virtual const ContentVerifierKey& PublicKey() = 0; |
| 66 | 66 |
| 67 // This should return a URL that can be used to fetch the | 67 // This should return a URL that can be used to fetch the |
| 68 // verified_contents.json containing signatures for the given extension | 68 // verified_contents.json containing signatures for the given extension |
| 69 // id/version pair. | 69 // id/version pair. |
| 70 virtual GURL GetSignatureFetchUrl(const std::string& extension_id, | 70 virtual GURL GetSignatureFetchUrl(const std::string& extension_id, |
| 71 const base::Version& version) = 0; | 71 const base::Version& version) = 0; |
| 72 | 72 |
| 73 // This should return the set of file paths for images used within the | 73 // This should return the set of file paths for images used within the |
| 74 // browser process. (These may get transcoded during the install process). | 74 // browser process. (These may get transcoded during the install process). |
| 75 virtual std::set<base::FilePath> GetBrowserImagePaths( | 75 virtual std::set<base::FilePath> GetBrowserImagePaths( |
| 76 const extensions::Extension* extension) = 0; | 76 const extensions::Extension* extension) = 0; |
| 77 | 77 |
| 78 // Called when the content verifier detects that a read of a file inside | 78 // Called when the content verifier detects that a read of a file inside |
| 79 // an extension did not match its expected hash. | 79 // an extension did not match its expected hash. |
| 80 virtual void VerifyFailed(const std::string& extension_id) = 0; | 80 virtual void VerifyFailed(const std::string& extension_id) = 0; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace extensions | 83 } // namespace extensions |
| 84 | 84 |
| 85 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ | 85 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_DELEGATE_H_ |
| OLD | NEW |