| 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_MOCK_EXTENSION_SYSTEM_H_ | 5 #ifndef EXTENSIONS_BROWSER_MOCK_EXTENSION_SYSTEM_H_ |
| 6 #define EXTENSIONS_BROWSER_MOCK_EXTENSION_SYSTEM_H_ | 6 #define EXTENSIONS_BROWSER_MOCK_EXTENSION_SYSTEM_H_ |
| 7 | 7 |
| 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 #include "extensions/browser/extension_registry_factory.h" | 9 #include "extensions/browser/extension_registry_factory.h" |
| 10 #include "extensions/browser/extension_system.h" | 10 #include "extensions/browser/extension_system.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 template <typename T> | 64 template <typename T> |
| 65 class MockExtensionSystemFactory : public ExtensionSystemProvider { | 65 class MockExtensionSystemFactory : public ExtensionSystemProvider { |
| 66 public: | 66 public: |
| 67 MockExtensionSystemFactory() | 67 MockExtensionSystemFactory() |
| 68 : ExtensionSystemProvider( | 68 : ExtensionSystemProvider( |
| 69 "MockExtensionSystem", | 69 "MockExtensionSystem", |
| 70 BrowserContextDependencyManager::GetInstance()) { | 70 BrowserContextDependencyManager::GetInstance()) { |
| 71 DependsOn(ExtensionRegistryFactory::GetInstance()); | 71 DependsOn(ExtensionRegistryFactory::GetInstance()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual ~MockExtensionSystemFactory() {} | 74 ~MockExtensionSystemFactory() override {} |
| 75 | 75 |
| 76 // BrowserContextKeyedServiceFactory overrides: | 76 // BrowserContextKeyedServiceFactory overrides: |
| 77 virtual KeyedService* BuildServiceInstanceFor( | 77 KeyedService* BuildServiceInstanceFor( |
| 78 content::BrowserContext* context) const override { | 78 content::BrowserContext* context) const override { |
| 79 return new T(context); | 79 return new T(context); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // ExtensionSystemProvider overrides: | 82 // ExtensionSystemProvider overrides: |
| 83 virtual ExtensionSystem* GetForBrowserContext( | 83 ExtensionSystem* GetForBrowserContext( |
| 84 content::BrowserContext* context) override { | 84 content::BrowserContext* context) override { |
| 85 return static_cast<ExtensionSystem*>( | 85 return static_cast<ExtensionSystem*>( |
| 86 GetServiceForBrowserContext(context, true)); | 86 GetServiceForBrowserContext(context, true)); |
| 87 } | 87 } |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystemFactory); | 90 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystemFactory); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace extensions | 93 } // namespace extensions |
| 94 | 94 |
| 95 #endif // EXTENSIONS_BROWSER_MOCK_EXTENSION_SYSTEM_H_ | 95 #endif // EXTENSIONS_BROWSER_MOCK_EXTENSION_SYSTEM_H_ |
| OLD | NEW |