| 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 #include "chrome/browser/ui/app_list/start_page_service_factory.h" | 5 #include "chrome/browser/ui/app_list/start_page_service_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/extensions/install_tracker_factory.h" | 8 #include "chrome/browser/extensions/install_tracker_factory.h" |
| 9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/search_engines/template_url_service_factory.h" | 11 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 12 #include "chrome/browser/ui/app_list/start_page_service.h" | 12 #include "chrome/browser/ui/app_list/start_page_service.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 15 #include "extensions/browser/extension_system_provider.h" | 15 #include "extensions/browser/extension_system_provider.h" |
| 16 #include "extensions/browser/extensions_browser_client.h" | 16 #include "extensions/browser/extensions_browser_client.h" |
| 17 #include "ui/app_list/app_list_switches.h" | 17 #include "ui/app_list/app_list_switches.h" |
| 18 | 18 |
| 19 namespace app_list { | 19 namespace app_list { |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 StartPageService* StartPageServiceFactory::GetForProfile(Profile* profile) { | 22 StartPageService* StartPageServiceFactory::GetForProfile(Profile* profile) { |
| 23 if (!app_list::switches::IsExperimentalAppListEnabled() && | |
| 24 !app_list::switches::IsVoiceSearchEnabled()) { | |
| 25 return NULL; | |
| 26 } | |
| 27 | |
| 28 return static_cast<StartPageService*>( | 23 return static_cast<StartPageService*>( |
| 29 GetInstance()->GetServiceForBrowserContext(profile, true)); | 24 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 30 } | 25 } |
| 31 | 26 |
| 32 // static | 27 // static |
| 33 StartPageServiceFactory* StartPageServiceFactory::GetInstance() { | 28 StartPageServiceFactory* StartPageServiceFactory::GetInstance() { |
| 34 return base::Singleton<StartPageServiceFactory>::get(); | 29 return base::Singleton<StartPageServiceFactory>::get(); |
| 35 } | 30 } |
| 36 | 31 |
| 37 StartPageServiceFactory::StartPageServiceFactory() | 32 StartPageServiceFactory::StartPageServiceFactory() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 52 return new StartPageService(profile); | 47 return new StartPageService(profile); |
| 53 } | 48 } |
| 54 | 49 |
| 55 content::BrowserContext* StartPageServiceFactory::GetBrowserContextToUse( | 50 content::BrowserContext* StartPageServiceFactory::GetBrowserContextToUse( |
| 56 content::BrowserContext* context) const { | 51 content::BrowserContext* context) const { |
| 57 // The start page service needs an instance in ChromeOS guest mode. | 52 // The start page service needs an instance in ChromeOS guest mode. |
| 58 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 53 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 59 } | 54 } |
| 60 | 55 |
| 61 } // namespace app_list | 56 } // namespace app_list |
| OLD | NEW |