| 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" |
| 11 #include "chrome/browser/history/chrome_history_client.h" | 11 #include "chrome/browser/history/chrome_history_client.h" |
| 12 #include "chrome/browser/history/chrome_history_client_factory.h" | 12 #include "chrome/browser/history/chrome_history_client_factory.h" |
| 13 #include "chrome/browser/history/content_visit_delegate.h" |
| 13 #include "chrome/browser/history/history_service.h" | 14 #include "chrome/browser/history/history_service.h" |
| 14 #include "chrome/browser/profiles/incognito_helpers.h" | 15 #include "chrome/browser/profiles/incognito_helpers.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "components/bookmarks/browser/bookmark_model.h" | 18 #include "components/bookmarks/browser/bookmark_model.h" |
| 18 #include "components/history/content/browser/history_database_helper.h" | 19 #include "components/history/content/browser/history_database_helper.h" |
| 19 #include "components/history/core/browser/history_database_params.h" | 20 #include "components/history/core/browser/history_database_params.h" |
| 20 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 21 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 21 #include "components/keyed_service/core/service_access_type.h" | 22 #include "components/keyed_service/core/service_access_type.h" |
| 22 | 23 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 DependsOn(ChromeBookmarkClientFactory::GetInstance()); | 71 DependsOn(ChromeBookmarkClientFactory::GetInstance()); |
| 71 } | 72 } |
| 72 | 73 |
| 73 HistoryServiceFactory::~HistoryServiceFactory() { | 74 HistoryServiceFactory::~HistoryServiceFactory() { |
| 74 } | 75 } |
| 75 | 76 |
| 76 KeyedService* HistoryServiceFactory::BuildServiceInstanceFor( | 77 KeyedService* HistoryServiceFactory::BuildServiceInstanceFor( |
| 77 content::BrowserContext* context) const { | 78 content::BrowserContext* context) const { |
| 78 Profile* profile = Profile::FromBrowserContext(context); | 79 Profile* profile = Profile::FromBrowserContext(context); |
| 79 scoped_ptr<HistoryService> history_service(new HistoryService( | 80 scoped_ptr<HistoryService> history_service(new HistoryService( |
| 80 ChromeHistoryClientFactory::GetForProfile(profile), profile)); | 81 ChromeHistoryClientFactory::GetForProfile(profile), |
| 82 scoped_ptr<history::VisitDelegate>(new ContentVisitDelegate(profile)))); |
| 81 if (!history_service->Init( | 83 if (!history_service->Init( |
| 82 profile->GetPrefs(), | 84 profile->GetPrefs(), |
| 83 history::HistoryDatabaseParamsForPath(profile->GetPath()))) { | 85 history::HistoryDatabaseParamsForPath(profile->GetPath()))) { |
| 84 return nullptr; | 86 return nullptr; |
| 85 } | 87 } |
| 86 ChromeBookmarkClientFactory::GetForProfile(profile) | 88 ChromeBookmarkClientFactory::GetForProfile(profile) |
| 87 ->SetHistoryService(history_service.get()); | 89 ->SetHistoryService(history_service.get()); |
| 88 return history_service.release(); | 90 return history_service.release(); |
| 89 } | 91 } |
| 90 | 92 |
| 91 content::BrowserContext* HistoryServiceFactory::GetBrowserContextToUse( | 93 content::BrowserContext* HistoryServiceFactory::GetBrowserContextToUse( |
| 92 content::BrowserContext* context) const { | 94 content::BrowserContext* context) const { |
| 93 return chrome::GetBrowserContextRedirectedInIncognito(context); | 95 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 94 } | 96 } |
| 95 | 97 |
| 96 bool HistoryServiceFactory::ServiceIsNULLWhileTesting() const { | 98 bool HistoryServiceFactory::ServiceIsNULLWhileTesting() const { |
| 97 return true; | 99 return true; |
| 98 } | 100 } |
| OLD | NEW |