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" |
11 #include "chrome/browser/sync/profile_sync_service.h" | 11 #include "chrome/browser/sync/profile_sync_service.h" |
12 #include "chrome/browser/sync/profile_sync_service_factory.h" | 12 #include "chrome/browser/sync/profile_sync_service_factory.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 14 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 // Returns true if the user is signed in and full history sync is enabled, | 17 // Returns true if the user is signed in and full history sync is enabled, |
18 // and false otherwise. | 18 // and false otherwise. |
19 bool IsHistorySyncEnabled(Profile* profile) { | 19 bool IsHistorySyncEnabled(Profile* profile) { |
20 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 20 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
21 switches::kHistoryDisableFullHistorySync)) { | 21 switches::kHistoryDisableFullHistorySync)) { |
22 ProfileSyncService* sync = | 22 ProfileSyncService* sync = |
23 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 23 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
24 return sync && | 24 return sync && |
25 sync->sync_initialized() && | 25 sync->sync_initialized() && |
26 sync->GetPreferredDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES); | 26 sync->GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES); |
27 } | 27 } |
28 return false; | 28 return false; |
29 } | 29 } |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 // static | 33 // static |
34 WebHistoryServiceFactory* WebHistoryServiceFactory::GetInstance() { | 34 WebHistoryServiceFactory* WebHistoryServiceFactory::GetInstance() { |
35 return Singleton<WebHistoryServiceFactory>::get(); | 35 return Singleton<WebHistoryServiceFactory>::get(); |
36 } | 36 } |
(...skipping 21 matching lines...) Expand all Loading... |
58 WebHistoryServiceFactory::WebHistoryServiceFactory() | 58 WebHistoryServiceFactory::WebHistoryServiceFactory() |
59 : BrowserContextKeyedServiceFactory( | 59 : BrowserContextKeyedServiceFactory( |
60 "WebHistoryServiceFactory", | 60 "WebHistoryServiceFactory", |
61 BrowserContextDependencyManager::GetInstance()) { | 61 BrowserContextDependencyManager::GetInstance()) { |
62 DependsOn(TokenServiceFactory::GetInstance()); | 62 DependsOn(TokenServiceFactory::GetInstance()); |
63 DependsOn(CookieSettings::Factory::GetInstance()); | 63 DependsOn(CookieSettings::Factory::GetInstance()); |
64 } | 64 } |
65 | 65 |
66 WebHistoryServiceFactory::~WebHistoryServiceFactory() { | 66 WebHistoryServiceFactory::~WebHistoryServiceFactory() { |
67 } | 67 } |
OLD | NEW |