OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/browsing_data/browsing_data_remover_factory.h" | 5 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_fac
tory.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 9 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
10 #include "chrome/browser/browsing_data/browsing_data_remover_impl.h" | |
11 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 10 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 11 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
13 #include "chrome/browser/domain_reliability/service_factory.h" | 12 #include "chrome/browser/domain_reliability/service_factory.h" |
14 #include "chrome/browser/history/history_service_factory.h" | 13 #include "chrome/browser/history/history_service_factory.h" |
15 #include "chrome/browser/history/web_history_service_factory.h" | 14 #include "chrome/browser/history/web_history_service_factory.h" |
16 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" | 15 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
17 #include "chrome/browser/password_manager/password_store_factory.h" | 16 #include "chrome/browser/password_manager/password_store_factory.h" |
18 #include "chrome/browser/prerender/prerender_manager_factory.h" | 17 #include "chrome/browser/prerender/prerender_manager_factory.h" |
19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/search_engines/template_url_service_factory.h" | 19 #include "chrome/browser/search_engines/template_url_service_factory.h" |
(...skipping 11 matching lines...) Expand all Loading... |
32 #if BUILDFLAG(ENABLE_EXTENSIONS) | 31 #if BUILDFLAG(ENABLE_EXTENSIONS) |
33 #include "chrome/browser/extensions/activity_log/activity_log.h" | 32 #include "chrome/browser/extensions/activity_log/activity_log.h" |
34 #include "extensions/browser/extension_prefs_factory.h" | 33 #include "extensions/browser/extension_prefs_factory.h" |
35 #endif | 34 #endif |
36 | 35 |
37 #if BUILDFLAG(ENABLE_SESSION_SERVICE) | 36 #if BUILDFLAG(ENABLE_SESSION_SERVICE) |
38 #include "chrome/browser/sessions/session_service_factory.h" | 37 #include "chrome/browser/sessions/session_service_factory.h" |
39 #endif | 38 #endif |
40 | 39 |
41 // static | 40 // static |
42 BrowsingDataRemoverFactory* BrowsingDataRemoverFactory::GetInstance() { | 41 ChromeBrowsingDataRemoverDelegateFactory* |
43 return base::Singleton<BrowsingDataRemoverFactory>::get(); | 42 ChromeBrowsingDataRemoverDelegateFactory::GetInstance() { |
| 43 return base::Singleton<ChromeBrowsingDataRemoverDelegateFactory>::get(); |
44 } | 44 } |
45 | 45 |
46 // static | 46 // static |
47 BrowsingDataRemover* BrowsingDataRemoverFactory::GetForBrowserContext( | 47 ChromeBrowsingDataRemoverDelegate* |
48 content::BrowserContext* context) { | 48 ChromeBrowsingDataRemoverDelegateFactory::GetForProfile(Profile* profile) { |
49 return static_cast<BrowsingDataRemover*>( | 49 return static_cast<ChromeBrowsingDataRemoverDelegate*>( |
50 GetInstance()->GetServiceForBrowserContext(context, true)); | 50 GetInstance()->GetServiceForBrowserContext(profile, true)); |
51 } | 51 } |
52 | 52 |
53 BrowsingDataRemoverFactory::BrowsingDataRemoverFactory() | 53 ChromeBrowsingDataRemoverDelegateFactory:: |
| 54 ChromeBrowsingDataRemoverDelegateFactory() |
54 : BrowserContextKeyedServiceFactory( | 55 : BrowserContextKeyedServiceFactory( |
55 "BrowsingDataRemover", | 56 "BrowsingDataRemover", |
56 BrowserContextDependencyManager::GetInstance()) { | 57 BrowserContextDependencyManager::GetInstance()) { |
57 DependsOn(autofill::PersonalDataManagerFactory::GetInstance()); | 58 DependsOn(autofill::PersonalDataManagerFactory::GetInstance()); |
58 DependsOn(DataReductionProxyChromeSettingsFactory::GetInstance()); | 59 DependsOn(DataReductionProxyChromeSettingsFactory::GetInstance()); |
59 DependsOn(domain_reliability::DomainReliabilityServiceFactory::GetInstance()); | 60 DependsOn(domain_reliability::DomainReliabilityServiceFactory::GetInstance()); |
60 DependsOn(HistoryServiceFactory::GetInstance()); | 61 DependsOn(HistoryServiceFactory::GetInstance()); |
61 DependsOn(HostContentSettingsMapFactory::GetInstance()); | 62 DependsOn(HostContentSettingsMapFactory::GetInstance()); |
62 DependsOn(PasswordStoreFactory::GetInstance()); | 63 DependsOn(PasswordStoreFactory::GetInstance()); |
63 DependsOn(prerender::PrerenderManagerFactory::GetInstance()); | 64 DependsOn(prerender::PrerenderManagerFactory::GetInstance()); |
(...skipping 10 matching lines...) Expand all Loading... |
74 #if BUILDFLAG(ENABLE_EXTENSIONS) | 75 #if BUILDFLAG(ENABLE_EXTENSIONS) |
75 DependsOn(extensions::ActivityLog::GetFactoryInstance()); | 76 DependsOn(extensions::ActivityLog::GetFactoryInstance()); |
76 DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); | 77 DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); |
77 #endif | 78 #endif |
78 | 79 |
79 #if BUILDFLAG(ENABLE_SESSION_SERVICE) | 80 #if BUILDFLAG(ENABLE_SESSION_SERVICE) |
80 DependsOn(SessionServiceFactory::GetInstance()); | 81 DependsOn(SessionServiceFactory::GetInstance()); |
81 #endif | 82 #endif |
82 } | 83 } |
83 | 84 |
84 BrowsingDataRemoverFactory::~BrowsingDataRemoverFactory() {} | 85 ChromeBrowsingDataRemoverDelegateFactory:: |
| 86 ~ChromeBrowsingDataRemoverDelegateFactory() {} |
85 | 87 |
86 content::BrowserContext* BrowsingDataRemoverFactory::GetBrowserContextToUse( | 88 content::BrowserContext* |
| 89 ChromeBrowsingDataRemoverDelegateFactory::GetBrowserContextToUse( |
87 content::BrowserContext* context) const { | 90 content::BrowserContext* context) const { |
88 // For guest profiles the browsing data is in the OTR profile. | 91 // For guest profiles the browsing data is in the OTR profile. |
89 Profile* profile = static_cast<Profile*>(context); | 92 Profile* profile = static_cast<Profile*>(context); |
90 DCHECK(!profile->IsGuestSession() || profile->IsOffTheRecord()); | 93 DCHECK(!profile->IsGuestSession() || profile->IsOffTheRecord()); |
91 | 94 |
92 return profile; | 95 return profile; |
93 } | 96 } |
94 | 97 |
95 KeyedService* BrowsingDataRemoverFactory::BuildServiceInstanceFor( | 98 KeyedService* ChromeBrowsingDataRemoverDelegateFactory::BuildServiceInstanceFor( |
96 content::BrowserContext* context) const { | 99 content::BrowserContext* context) const { |
97 BrowsingDataRemoverImpl* remover = new BrowsingDataRemoverImpl(context); | 100 return new ChromeBrowsingDataRemoverDelegate(context); |
98 remover->SetEmbedderDelegate( | |
99 base::MakeUnique<ChromeBrowsingDataRemoverDelegate>(context)); | |
100 return remover; | |
101 } | 101 } |
OLD | NEW |