NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / extensions / extension_toolbar_model_factory.cc
blob79ab80fa41a35da2402e66f9726f36bd00a29e9c
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.
5 #include "chrome/browser/extensions/extension_toolbar_model_factory.h"
7 #include "chrome/browser/extensions/extension_toolbar_model.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
10 #include "extensions/browser/extension_prefs.h"
11 #include "extensions/browser/extension_prefs_factory.h"
12 #include "extensions/browser/extensions_browser_client.h"
14 // static
15 ExtensionToolbarModel* ExtensionToolbarModelFactory::GetForProfile(
16 Profile* profile) {
17 return static_cast<ExtensionToolbarModel*>(
18 GetInstance()->GetServiceForBrowserContext(profile, true));
21 // static
22 ExtensionToolbarModelFactory* ExtensionToolbarModelFactory::GetInstance() {
23 return Singleton<ExtensionToolbarModelFactory>::get();
26 ExtensionToolbarModelFactory::ExtensionToolbarModelFactory()
27 : BrowserContextKeyedServiceFactory(
28 "ExtensionToolbarModel",
29 BrowserContextDependencyManager::GetInstance()) {
30 DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
33 ExtensionToolbarModelFactory::~ExtensionToolbarModelFactory() {}
35 BrowserContextKeyedService*
36 ExtensionToolbarModelFactory::BuildServiceInstanceFor(
37 content::BrowserContext* context) const {
38 return new ExtensionToolbarModel(
39 Profile::FromBrowserContext(context),
40 extensions::ExtensionPrefsFactory::GetForBrowserContext(context));
43 content::BrowserContext* ExtensionToolbarModelFactory::GetBrowserContextToUse(
44 content::BrowserContext* context) const {
45 return extensions::ExtensionsBrowserClient::Get()->
46 GetOriginalContext(context);
49 bool ExtensionToolbarModelFactory::ServiceIsCreatedWithBrowserContext() const {
50 return true;
53 bool ExtensionToolbarModelFactory::ServiceIsNULLWhileTesting() const {
54 return true;