| 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/web_history_service_factory.h" | 5 #include "chrome/browser/history/web_history_service_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/content_settings/cookie_settings.h" | 8 #include "chrome/browser/content_settings/cookie_settings.h" |
| 9 #include "chrome/browser/history/web_history_service.h" | 9 #include "chrome/browser/history/web_history_service.h" |
| 10 #include "chrome/browser/signin/token_service_factory.h" | 10 #include "chrome/browser/signin/token_service_factory.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // static | 33 // static |
| 34 WebHistoryServiceFactory* WebHistoryServiceFactory::GetInstance() { | 34 WebHistoryServiceFactory* WebHistoryServiceFactory::GetInstance() { |
| 35 return Singleton<WebHistoryServiceFactory>::get(); | 35 return Singleton<WebHistoryServiceFactory>::get(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // static | 38 // static |
| 39 history::WebHistoryService* WebHistoryServiceFactory::GetForProfile( | 39 history::WebHistoryService* WebHistoryServiceFactory::GetForProfile( |
| 40 Profile* profile) { | 40 Profile* profile) { |
| 41 if (IsHistorySyncEnabled(profile)) { | 41 if (IsHistorySyncEnabled(profile)) { |
| 42 return static_cast<history::WebHistoryService*>( | 42 return static_cast<history::WebHistoryService*>( |
| 43 GetInstance()->GetServiceForProfile(profile, true)); | 43 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 44 } | 44 } |
| 45 return NULL; | 45 return NULL; |
| 46 } | 46 } |
| 47 | 47 |
| 48 ProfileKeyedService* WebHistoryServiceFactory::BuildServiceInstanceFor( | 48 BrowserContextKeyedService* WebHistoryServiceFactory::BuildServiceInstanceFor( |
| 49 content::BrowserContext* context) const { | 49 content::BrowserContext* context) const { |
| 50 Profile* profile = static_cast<Profile*>(context); | 50 Profile* profile = static_cast<Profile*>(context); |
| 51 | 51 |
| 52 // Ensure that the service is not instantiated or used if the user is not | 52 // Ensure that the service is not instantiated or used if the user is not |
| 53 // signed into sync, or if web history is not enabled. | 53 // signed into sync, or if web history is not enabled. |
| 54 return IsHistorySyncEnabled(profile) ? | 54 return IsHistorySyncEnabled(profile) ? |
| 55 new history::WebHistoryService(profile) : NULL; | 55 new history::WebHistoryService(profile) : NULL; |
| 56 } | 56 } |
| 57 | 57 |
| 58 WebHistoryServiceFactory::WebHistoryServiceFactory() | 58 WebHistoryServiceFactory::WebHistoryServiceFactory() |
| 59 : ProfileKeyedServiceFactory("WebHistoryServiceFactory", | 59 : BrowserContextKeyedServiceFactory("WebHistoryServiceFactory", |
| 60 ProfileDependencyManager::GetInstance()) { | 60 BrowserContextDependencyManager::GetInstance())
{ |
| 61 DependsOn(TokenServiceFactory::GetInstance()); | 61 DependsOn(TokenServiceFactory::GetInstance()); |
| 62 DependsOn(CookieSettings::Factory::GetInstance()); | 62 DependsOn(CookieSettings::Factory::GetInstance()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 WebHistoryServiceFactory::~WebHistoryServiceFactory() { | 65 WebHistoryServiceFactory::~WebHistoryServiceFactory() { |
| 66 } | 66 } |
| OLD | NEW |