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/history/history_service_factory.h" | 5 #include "chrome/browser/history/history_service_factory.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
9 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 9 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
10 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | 10 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 "HistoryService", BrowserContextDependencyManager::GetInstance()) { | 68 "HistoryService", BrowserContextDependencyManager::GetInstance()) { |
69 DependsOn(ChromeHistoryClientFactory::GetInstance()); | 69 DependsOn(ChromeHistoryClientFactory::GetInstance()); |
70 DependsOn(ChromeBookmarkClientFactory::GetInstance()); | 70 DependsOn(ChromeBookmarkClientFactory::GetInstance()); |
71 } | 71 } |
72 | 72 |
73 HistoryServiceFactory::~HistoryServiceFactory() { | 73 HistoryServiceFactory::~HistoryServiceFactory() { |
74 } | 74 } |
75 | 75 |
76 KeyedService* HistoryServiceFactory::BuildServiceInstanceFor( | 76 KeyedService* HistoryServiceFactory::BuildServiceInstanceFor( |
77 content::BrowserContext* context) const { | 77 content::BrowserContext* context) const { |
78 Profile* profile = static_cast<Profile*>(context); | 78 Profile* profile = Profile::FromBrowserContext(context); |
79 scoped_ptr<HistoryService> history_service(new HistoryService( | 79 scoped_ptr<HistoryService> history_service(new HistoryService( |
80 ChromeHistoryClientFactory::GetForProfile(profile), profile)); | 80 ChromeHistoryClientFactory::GetForProfile(profile), profile)); |
81 if (!history_service->Init( | 81 if (!history_service->Init( |
| 82 profile->GetPrefs()->GetString(prefs::kAcceptLanguages), |
82 history::HistoryDatabaseParamsForPath(profile->GetPath()))) { | 83 history::HistoryDatabaseParamsForPath(profile->GetPath()))) { |
83 return nullptr; | 84 return nullptr; |
84 } | 85 } |
85 ChromeBookmarkClientFactory::GetForProfile(profile) | 86 ChromeBookmarkClientFactory::GetForProfile(profile) |
86 ->SetHistoryService(history_service.get()); | 87 ->SetHistoryService(history_service.get()); |
87 return history_service.release(); | 88 return history_service.release(); |
88 } | 89 } |
89 | 90 |
90 content::BrowserContext* HistoryServiceFactory::GetBrowserContextToUse( | 91 content::BrowserContext* HistoryServiceFactory::GetBrowserContextToUse( |
91 content::BrowserContext* context) const { | 92 content::BrowserContext* context) const { |
92 return chrome::GetBrowserContextRedirectedInIncognito(context); | 93 return chrome::GetBrowserContextRedirectedInIncognito(context); |
93 } | 94 } |
94 | 95 |
95 bool HistoryServiceFactory::ServiceIsNULLWhileTesting() const { | 96 bool HistoryServiceFactory::ServiceIsNULLWhileTesting() const { |
96 return true; | 97 return true; |
97 } | 98 } |
OLD | NEW |