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/apps/shortcut_manager_factory.h" 6 7 #include "chrome/browser/apps/shortcut_manager.h" 8 #include "chrome/browser/profiles/profile.h" 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" 10 11 // static GetForProfile(Profile * profile)12AppShortcutManager* AppShortcutManagerFactory::GetForProfile(Profile* profile) { 13 return static_cast<AppShortcutManager*>( 14 GetInstance()->GetServiceForBrowserContext(profile, 15 false /* don't create */)); 16 } 17 GetInstance()18AppShortcutManagerFactory* AppShortcutManagerFactory::GetInstance() { 19 return Singleton<AppShortcutManagerFactory>::get(); 20 } 21 AppShortcutManagerFactory()22AppShortcutManagerFactory::AppShortcutManagerFactory() 23 : BrowserContextKeyedServiceFactory( 24 "AppShortcutManager", 25 BrowserContextDependencyManager::GetInstance()) { 26 } 27 ~AppShortcutManagerFactory()28AppShortcutManagerFactory::~AppShortcutManagerFactory() { 29 } 30 BuildServiceInstanceFor(content::BrowserContext * profile) const31KeyedService* AppShortcutManagerFactory::BuildServiceInstanceFor( 32 content::BrowserContext* profile) const { 33 return new AppShortcutManager(static_cast<Profile*>(profile)); 34 } 35 ServiceIsCreatedWithBrowserContext() const36bool AppShortcutManagerFactory::ServiceIsCreatedWithBrowserContext() const { 37 return true; 38 } 39 ServiceIsNULLWhileTesting() const40bool AppShortcutManagerFactory::ServiceIsNULLWhileTesting() const { 41 return true; 42 } 43