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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 class Extension; | 30 class Extension; |
31 class ContentHashFetcher; | 31 class ContentHashFetcher; |
32 class ContentVerifierIOData; | 32 class ContentVerifierIOData; |
33 | 33 |
34 // Used for managing overall content verification - both fetching content | 34 // Used for managing overall content verification - both fetching content |
35 // hashes as needed, and supplying job objects to verify file contents as they | 35 // hashes as needed, and supplying job objects to verify file contents as they |
36 // are read. | 36 // are read. |
37 class ContentVerifier : public base::RefCountedThreadSafe<ContentVerifier>, | 37 class ContentVerifier : public base::RefCountedThreadSafe<ContentVerifier>, |
38 public ExtensionRegistryObserver { | 38 public ExtensionRegistryObserver { |
39 public: | 39 public: |
| 40 class TestObserver { |
| 41 public: |
| 42 virtual void OnFetchComplete(const std::string& extension_id, |
| 43 bool success) = 0; |
| 44 }; |
| 45 static void SetObserverForTests(TestObserver* observer); |
| 46 |
40 // Takes ownership of |delegate|. | 47 // Takes ownership of |delegate|. |
41 ContentVerifier(content::BrowserContext* context, | 48 ContentVerifier(content::BrowserContext* context, |
42 ContentVerifierDelegate* delegate); | 49 ContentVerifierDelegate* delegate); |
43 void Start(); | 50 void Start(); |
44 void Shutdown(); | 51 void Shutdown(); |
45 | 52 |
46 // Call this before reading a file within an extension. The caller owns the | 53 // Call this before reading a file within an extension. The caller owns the |
47 // returned job. | 54 // returned job. |
48 ContentVerifyJob* CreateJobFor(const std::string& extension_id, | 55 ContentVerifyJob* CreateJobFor(const std::string& extension_id, |
49 const base::FilePath& extension_root, | 56 const base::FilePath& extension_root, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // For observing the ExtensionRegistry. | 103 // For observing the ExtensionRegistry. |
97 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_; | 104 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_; |
98 | 105 |
99 // Data that should only be used on the IO thread. | 106 // Data that should only be used on the IO thread. |
100 scoped_refptr<ContentVerifierIOData> io_data_; | 107 scoped_refptr<ContentVerifierIOData> io_data_; |
101 }; | 108 }; |
102 | 109 |
103 } // namespace extensions | 110 } // namespace extensions |
104 | 111 |
105 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ | 112 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ |
OLD | NEW |