OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ |
7 | 7 |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "extensions/browser/extension_system.h" | 9 #include "extensions/browser/extension_system.h" |
10 #include "extensions/common/one_shot_event.h" | 10 #include "extensions/common/one_shot_event.h" |
11 | 11 |
12 class Profile; | 12 class Profile; |
13 class TestingValueStore; | 13 class TestingValueStore; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class CommandLine; | 16 class CommandLine; |
17 class FilePath; | 17 class FilePath; |
18 class Time; | 18 class Time; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class BrowserContext; | 22 class BrowserContext; |
23 } | 23 } |
24 | 24 |
25 namespace extensions { | 25 namespace extensions { |
26 class DeclarativeUserScriptMaster; | 26 class DeclarativeUserScriptManager; |
27 class ExtensionPrefs; | 27 class ExtensionPrefs; |
28 class RuntimeData; | 28 class RuntimeData; |
29 class SharedUserScriptMaster; | 29 class SharedUserScriptMaster; |
30 class StandardManagementPolicyProvider; | 30 class StandardManagementPolicyProvider; |
31 | 31 |
32 // Test ExtensionSystem, for use with TestingProfile. | 32 // Test ExtensionSystem, for use with TestingProfile. |
33 class TestExtensionSystem : public ExtensionSystem { | 33 class TestExtensionSystem : public ExtensionSystem { |
34 public: | 34 public: |
35 explicit TestExtensionSystem(Profile* profile); | 35 explicit TestExtensionSystem(Profile* profile); |
36 ~TestExtensionSystem() override; | 36 ~TestExtensionSystem() override; |
(...skipping 15 matching lines...) Expand all Loading... |
52 bool autoupdate_enabled); | 52 bool autoupdate_enabled); |
53 | 53 |
54 void CreateSocketManager(); | 54 void CreateSocketManager(); |
55 | 55 |
56 void InitForRegularProfile(bool extensions_enabled) override {} | 56 void InitForRegularProfile(bool extensions_enabled) override {} |
57 void SetExtensionService(ExtensionService* service); | 57 void SetExtensionService(ExtensionService* service); |
58 ExtensionService* extension_service() override; | 58 ExtensionService* extension_service() override; |
59 RuntimeData* runtime_data() override; | 59 RuntimeData* runtime_data() override; |
60 ManagementPolicy* management_policy() override; | 60 ManagementPolicy* management_policy() override; |
61 SharedUserScriptMaster* shared_user_script_master() override; | 61 SharedUserScriptMaster* shared_user_script_master() override; |
| 62 DeclarativeUserScriptManager* declarative_user_script_manager() override; |
62 StateStore* state_store() override; | 63 StateStore* state_store() override; |
63 StateStore* rules_store() override; | 64 StateStore* rules_store() override; |
64 TestingValueStore* value_store() { return value_store_; } | 65 TestingValueStore* value_store() { return value_store_; } |
65 InfoMap* info_map() override; | 66 InfoMap* info_map() override; |
66 LazyBackgroundTaskQueue* lazy_background_task_queue() override; | 67 LazyBackgroundTaskQueue* lazy_background_task_queue() override; |
67 void SetEventRouter(scoped_ptr<EventRouter> event_router); | 68 void SetEventRouter(scoped_ptr<EventRouter> event_router); |
68 EventRouter* event_router() override; | 69 EventRouter* event_router() override; |
69 ErrorConsole* error_console() override; | 70 ErrorConsole* error_console() override; |
70 InstallVerifier* install_verifier() override; | 71 InstallVerifier* install_verifier() override; |
71 QuotaService* quota_service() override; | 72 QuotaService* quota_service() override; |
72 const OneShotEvent& ready() const override; | 73 const OneShotEvent& ready() const override; |
73 ContentVerifier* content_verifier() override; | 74 ContentVerifier* content_verifier() override; |
74 scoped_ptr<ExtensionSet> GetDependentExtensions( | 75 scoped_ptr<ExtensionSet> GetDependentExtensions( |
75 const Extension* extension) override; | 76 const Extension* extension) override; |
76 DeclarativeUserScriptMaster* GetDeclarativeUserScriptMasterByExtension( | |
77 const ExtensionId& extension_id) override; | |
78 | 77 |
79 // Note that you probably want to use base::RunLoop().RunUntilIdle() right | 78 // Note that you probably want to use base::RunLoop().RunUntilIdle() right |
80 // after this to run all the accumulated tasks. | 79 // after this to run all the accumulated tasks. |
81 void SetReady() { ready_.Signal(); } | 80 void SetReady() { ready_.Signal(); } |
82 | 81 |
83 // Factory method for tests to use with SetTestingProfile. | 82 // Factory method for tests to use with SetTestingProfile. |
84 static KeyedService* Build(content::BrowserContext* profile); | 83 static KeyedService* Build(content::BrowserContext* profile); |
85 | 84 |
86 protected: | 85 protected: |
87 Profile* profile_; | 86 Profile* profile_; |
88 | 87 |
89 private: | 88 private: |
90 scoped_ptr<StateStore> state_store_; | 89 scoped_ptr<StateStore> state_store_; |
91 // A pointer to the TestingValueStore owned by |state_store_|. | 90 // A pointer to the TestingValueStore owned by |state_store_|. |
92 TestingValueStore* value_store_; | 91 TestingValueStore* value_store_; |
93 ScopedVector<DeclarativeUserScriptMaster> declarative_user_script_masters_; | 92 scoped_ptr<DeclarativeUserScriptManager> declarative_user_script_manager_; |
94 scoped_ptr<ManagementPolicy> management_policy_; | 93 scoped_ptr<ManagementPolicy> management_policy_; |
95 scoped_ptr<RuntimeData> runtime_data_; | 94 scoped_ptr<RuntimeData> runtime_data_; |
96 scoped_ptr<ExtensionService> extension_service_; | 95 scoped_ptr<ExtensionService> extension_service_; |
97 scoped_refptr<InfoMap> info_map_; | 96 scoped_refptr<InfoMap> info_map_; |
98 scoped_ptr<EventRouter> event_router_; | 97 scoped_ptr<EventRouter> event_router_; |
99 scoped_ptr<ErrorConsole> error_console_; | 98 scoped_ptr<ErrorConsole> error_console_; |
100 scoped_ptr<InstallVerifier> install_verifier_; | 99 scoped_ptr<InstallVerifier> install_verifier_; |
101 scoped_ptr<QuotaService> quota_service_; | 100 scoped_ptr<QuotaService> quota_service_; |
102 OneShotEvent ready_; | 101 OneShotEvent ready_; |
103 }; | 102 }; |
104 | 103 |
105 } // namespace extensions | 104 } // namespace extensions |
106 | 105 |
107 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ | 106 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ |
OLD | NEW |