| 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/profiles/profile_dependency_manager.h" | 10 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 history::WebHistoryService* WebHistoryServiceFactory::GetForProfile( | 38 history::WebHistoryService* WebHistoryServiceFactory::GetForProfile( |
| 39 Profile* profile) { | 39 Profile* profile) { |
| 40 if (IsHistorySyncEnabled(profile)) { | 40 if (IsHistorySyncEnabled(profile)) { |
| 41 return static_cast<history::WebHistoryService*>( | 41 return static_cast<history::WebHistoryService*>( |
| 42 GetInstance()->GetServiceForProfile(profile, true)); | 42 GetInstance()->GetServiceForProfile(profile, true)); |
| 43 } | 43 } |
| 44 return NULL; | 44 return NULL; |
| 45 } | 45 } |
| 46 | 46 |
| 47 ProfileKeyedService* WebHistoryServiceFactory::BuildServiceInstanceFor( | 47 ProfileKeyedService* WebHistoryServiceFactory::BuildServiceInstanceFor( |
| 48 Profile* profile) const { | 48 content::BrowserContext* context) const { |
| 49 Profile* profile = static_cast<Profile*>(context); |
| 50 |
| 49 // Ensure that the service is not instantiated or used if the user is not | 51 // Ensure that the service is not instantiated or used if the user is not |
| 50 // signed into sync, or if web history is not enabled. | 52 // signed into sync, or if web history is not enabled. |
| 51 return IsHistorySyncEnabled(profile) ? | 53 return IsHistorySyncEnabled(profile) ? |
| 52 new history::WebHistoryService(profile) : NULL; | 54 new history::WebHistoryService(profile) : NULL; |
| 53 } | 55 } |
| 54 | 56 |
| 55 WebHistoryServiceFactory::WebHistoryServiceFactory() | 57 WebHistoryServiceFactory::WebHistoryServiceFactory() |
| 56 : ProfileKeyedServiceFactory("WebHistoryServiceFactory", | 58 : ProfileKeyedServiceFactory("WebHistoryServiceFactory", |
| 57 ProfileDependencyManager::GetInstance()) { | 59 ProfileDependencyManager::GetInstance()) { |
| 58 DependsOn(TokenServiceFactory::GetInstance()); | 60 DependsOn(TokenServiceFactory::GetInstance()); |
| 59 DependsOn(CookieSettings::Factory::GetInstance()); | 61 DependsOn(CookieSettings::Factory::GetInstance()); |
| 60 } | 62 } |
| 61 | 63 |
| 62 WebHistoryServiceFactory::~WebHistoryServiceFactory() { | 64 WebHistoryServiceFactory::~WebHistoryServiceFactory() { |
| 63 } | 65 } |
| OLD | NEW |