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 | |
47 // Takes ownership of |delegate|. | 40 // Takes ownership of |delegate|. |
48 ContentVerifier(content::BrowserContext* context, | 41 ContentVerifier(content::BrowserContext* context, |
49 ContentVerifierDelegate* delegate); | 42 ContentVerifierDelegate* delegate); |
50 void Start(); | 43 void Start(); |
51 void Shutdown(); | 44 void Shutdown(); |
52 | 45 |
53 // Call this before reading a file within an extension. The caller owns the | 46 // Call this before reading a file within an extension. The caller owns the |
54 // returned job. | 47 // returned job. |
55 ContentVerifyJob* CreateJobFor(const std::string& extension_id, | 48 ContentVerifyJob* CreateJobFor(const std::string& extension_id, |
56 const base::FilePath& extension_root, | 49 const base::FilePath& extension_root, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // For observing the ExtensionRegistry. | 96 // For observing the ExtensionRegistry. |
104 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_; | 97 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_; |
105 | 98 |
106 // Data that should only be used on the IO thread. | 99 // Data that should only be used on the IO thread. |
107 scoped_refptr<ContentVerifierIOData> io_data_; | 100 scoped_refptr<ContentVerifierIOData> io_data_; |
108 }; | 101 }; |
109 | 102 |
110 } // namespace extensions | 103 } // namespace extensions |
111 | 104 |
112 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ | 105 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_ |
OLD | NEW |