| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/extension_toolbar_model_factory.h" | |
| 6 | |
| 7 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | |
| 8 #include "chrome/browser/extensions/extension_toolbar_model.h" | |
| 9 #include "chrome/browser/profiles/profile.h" | |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 11 #include "extensions/browser/extension_prefs.h" | |
| 12 #include "extensions/browser/extension_prefs_factory.h" | |
| 13 #include "extensions/browser/extensions_browser_client.h" | |
| 14 | |
| 15 namespace extensions { | |
| 16 | |
| 17 // static | |
| 18 ExtensionToolbarModel* ExtensionToolbarModelFactory::GetForProfile( | |
| 19 Profile* profile) { | |
| 20 return static_cast<ExtensionToolbarModel*>( | |
| 21 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 22 } | |
| 23 | |
| 24 // static | |
| 25 ExtensionToolbarModelFactory* ExtensionToolbarModelFactory::GetInstance() { | |
| 26 return Singleton<ExtensionToolbarModelFactory>::get(); | |
| 27 } | |
| 28 | |
| 29 ExtensionToolbarModelFactory::ExtensionToolbarModelFactory() | |
| 30 : BrowserContextKeyedServiceFactory( | |
| 31 "ExtensionToolbarModel", | |
| 32 BrowserContextDependencyManager::GetInstance()) { | |
| 33 DependsOn(ExtensionPrefsFactory::GetInstance()); | |
| 34 DependsOn(ExtensionActionAPI::GetFactoryInstance()); | |
| 35 } | |
| 36 | |
| 37 ExtensionToolbarModelFactory::~ExtensionToolbarModelFactory() {} | |
| 38 | |
| 39 KeyedService* ExtensionToolbarModelFactory::BuildServiceInstanceFor( | |
| 40 content::BrowserContext* context) const { | |
| 41 return new ExtensionToolbarModel( | |
| 42 Profile::FromBrowserContext(context), | |
| 43 ExtensionPrefsFactory::GetForBrowserContext(context)); | |
| 44 } | |
| 45 | |
| 46 content::BrowserContext* ExtensionToolbarModelFactory::GetBrowserContextToUse( | |
| 47 content::BrowserContext* context) const { | |
| 48 return context; | |
| 49 } | |
| 50 | |
| 51 bool ExtensionToolbarModelFactory::ServiceIsCreatedWithBrowserContext() const { | |
| 52 return true; | |
| 53 } | |
| 54 | |
| 55 bool ExtensionToolbarModelFactory::ServiceIsNULLWhileTesting() const { | |
| 56 return true; | |
| 57 } | |
| 58 | |
| 59 } // namespace extensions | |
| OLD | NEW |