| 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_H_ | 5 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ |
| 6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ | 6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 73 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 74 const Extension* extension, | 74 const Extension* extension, |
| 75 UnloadedExtensionInfo::Reason reason) override; | 75 UnloadedExtensionInfo::Reason reason) override; |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 DISALLOW_COPY_AND_ASSIGN(ContentVerifier); | 78 DISALLOW_COPY_AND_ASSIGN(ContentVerifier); |
| 79 | 79 |
| 80 friend class base::RefCountedThreadSafe<ContentVerifier>; | 80 friend class base::RefCountedThreadSafe<ContentVerifier>; |
| 81 ~ContentVerifier() override; | 81 ~ContentVerifier() override; |
| 82 | 82 |
| 83 void OnFetchComplete(const std::string& extension_id, | 83 void OnFetchComplete( |
| 84 bool success, | 84 const std::string& extension_id, |
| 85 bool was_force_check, | 85 bool success, |
| 86 const std::set<base::FilePath>& hash_mismatch_paths); | 86 bool was_force_check, |
| 87 const std::set<base::FilePath>& hash_mismatch_unix_paths); |
| 87 | 88 |
| 88 void OnFetchCompleteHelper(const std::string& extension_id, | 89 void OnFetchCompleteHelper(const std::string& extension_id, |
| 89 bool shouldVerifyAnyPathsResult); | 90 bool shouldVerifyAnyPathsResult); |
| 90 | 91 |
| 91 // Returns true if any of the paths in |relative_paths| *should* have their | 92 // Returns true if any of the paths in |relative_unix_paths| *should* have |
| 92 // contents verified. (Some files get transcoded during the install process, | 93 // their contents verified. (Some files get transcoded during the install |
| 93 // so we don't want to verify their contents because they are expected not | 94 // process, so we don't want to verify their contents because they are |
| 94 // to match). | 95 // expected not to match). |
| 95 bool ShouldVerifyAnyPaths(const std::string& extension_id, | 96 bool ShouldVerifyAnyPaths( |
| 96 const base::FilePath& extension_root, | 97 const std::string& extension_id, |
| 97 const std::set<base::FilePath>& relative_paths); | 98 const base::FilePath& extension_root, |
| 99 const std::set<base::FilePath>& relative_unix_paths); |
| 98 | 100 |
| 99 // Set to true once we've begun shutting down. | 101 // Set to true once we've begun shutting down. |
| 100 bool shutdown_; | 102 bool shutdown_; |
| 101 | 103 |
| 102 content::BrowserContext* context_; | 104 content::BrowserContext* context_; |
| 103 | 105 |
| 104 std::unique_ptr<ContentVerifierDelegate> delegate_; | 106 std::unique_ptr<ContentVerifierDelegate> delegate_; |
| 105 | 107 |
| 106 // For fetching content hash signatures. | 108 // For fetching content hash signatures. |
| 107 std::unique_ptr<ContentHashFetcher> fetcher_; | 109 std::unique_ptr<ContentHashFetcher> fetcher_; |
| 108 | 110 |
| 109 // For observing the ExtensionRegistry. | 111 // For observing the ExtensionRegistry. |
| 110 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_; | 112 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_; |
| 111 | 113 |
| 112 // Data that should only be used on the IO thread. | 114 // Data that should only be used on the IO thread. |
| 113 scoped_refptr<ContentVerifierIOData> io_data_; | 115 scoped_refptr<ContentVerifierIOData> io_data_; |
| 114 }; | 116 }; |
| 115 | 117 |
| 116 } // namespace extensions | 118 } // namespace extensions |
| 117 | 119 |
| 118 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ | 120 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ |
| OLD | NEW |