OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/search_engines/template_url_fetcher_factory.h" | 5 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" |
6 | 6 |
7 #include "chrome/browser/profiles/incognito_helpers.h" | 7 #include "chrome/browser/profiles/incognito_helpers.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/search_engines/template_url_service_factory.h" | 9 #include "chrome/browser/search_engines/template_url_service_factory.h" |
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
11 #include "components/search_engines/template_url_fetcher.h" | 11 #include "components/search_engines/template_url_fetcher.h" |
12 #include "content/public/browser/storage_partition.h" | |
13 | 12 |
14 // static | 13 // static |
15 TemplateURLFetcher* TemplateURLFetcherFactory::GetForProfile( | 14 TemplateURLFetcher* TemplateURLFetcherFactory::GetForProfile( |
16 Profile* profile) { | 15 Profile* profile) { |
17 return static_cast<TemplateURLFetcher*>( | 16 return static_cast<TemplateURLFetcher*>( |
18 GetInstance()->GetServiceForBrowserContext(profile, true)); | 17 GetInstance()->GetServiceForBrowserContext(profile, true)); |
19 } | 18 } |
20 | 19 |
21 // static | 20 // static |
22 TemplateURLFetcherFactory* TemplateURLFetcherFactory::GetInstance() { | 21 TemplateURLFetcherFactory* TemplateURLFetcherFactory::GetInstance() { |
(...skipping 14 matching lines...) Expand all Loading... |
37 DependsOn(TemplateURLServiceFactory::GetInstance()); | 36 DependsOn(TemplateURLServiceFactory::GetInstance()); |
38 } | 37 } |
39 | 38 |
40 TemplateURLFetcherFactory::~TemplateURLFetcherFactory() { | 39 TemplateURLFetcherFactory::~TemplateURLFetcherFactory() { |
41 } | 40 } |
42 | 41 |
43 KeyedService* TemplateURLFetcherFactory::BuildServiceInstanceFor( | 42 KeyedService* TemplateURLFetcherFactory::BuildServiceInstanceFor( |
44 content::BrowserContext* profile) const { | 43 content::BrowserContext* profile) const { |
45 return new TemplateURLFetcher( | 44 return new TemplateURLFetcher( |
46 TemplateURLServiceFactory::GetForProfile(static_cast<Profile*>(profile)), | 45 TemplateURLServiceFactory::GetForProfile(static_cast<Profile*>(profile)), |
47 content::BrowserContext::GetDefaultStoragePartition(profile)-> | 46 profile->GetRequestContext()); |
48 GetURLRequestContext()); | |
49 } | 47 } |
50 | 48 |
51 content::BrowserContext* TemplateURLFetcherFactory::GetBrowserContextToUse( | 49 content::BrowserContext* TemplateURLFetcherFactory::GetBrowserContextToUse( |
52 content::BrowserContext* context) const { | 50 content::BrowserContext* context) const { |
53 return chrome::GetBrowserContextRedirectedInIncognito(context); | 51 return chrome::GetBrowserContextRedirectedInIncognito(context); |
54 } | 52 } |
OLD | NEW |