Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover_factory.cc

Issue 2827523003: Move BrowsingDataRemover to content/ (Closed)
Patch Set: Rebase over codereview.chromium.org/2815913005 Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
6
7 #include "base/memory/ptr_util.h"
8 #include "base/memory/singleton.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"
12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
13 #include "chrome/browser/domain_reliability/service_factory.h"
14 #include "chrome/browser/history/history_service_factory.h"
15 #include "chrome/browser/history/web_history_service_factory.h"
16 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
17 #include "chrome/browser/password_manager/password_store_factory.h"
18 #include "chrome/browser/prerender/prerender_manager_factory.h"
19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/search_engines/template_url_service_factory.h"
21 #include "chrome/browser/sessions/tab_restore_service_factory.h"
22 #include "chrome/browser/web_data_service_factory.h"
23 #include "components/keyed_service/content/browser_context_dependency_manager.h"
24 #include "content/public/browser/browser_context.h"
25 #include "extensions/features/features.h"
26
27 #if defined(OS_ANDROID)
28 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
29 #include "chrome/browser/precache/precache_manager_factory.h"
30 #endif
31
32 #if BUILDFLAG(ENABLE_EXTENSIONS)
33 #include "chrome/browser/extensions/activity_log/activity_log.h"
34 #include "extensions/browser/extension_prefs_factory.h"
35 #endif
36
37 #if BUILDFLAG(ENABLE_SESSION_SERVICE)
38 #include "chrome/browser/sessions/session_service_factory.h"
39 #endif
40
41 // static
42 BrowsingDataRemoverFactory* BrowsingDataRemoverFactory::GetInstance() {
43 return base::Singleton<BrowsingDataRemoverFactory>::get();
44 }
45
46 // static
47 BrowsingDataRemover* BrowsingDataRemoverFactory::GetForBrowserContext(
48 content::BrowserContext* context) {
49 return static_cast<BrowsingDataRemover*>(
50 GetInstance()->GetServiceForBrowserContext(context, true));
51 }
52
53 BrowsingDataRemoverFactory::BrowsingDataRemoverFactory()
54 : BrowserContextKeyedServiceFactory(
55 "BrowsingDataRemover",
56 BrowserContextDependencyManager::GetInstance()) {
57 DependsOn(autofill::PersonalDataManagerFactory::GetInstance());
58 DependsOn(DataReductionProxyChromeSettingsFactory::GetInstance());
59 DependsOn(domain_reliability::DomainReliabilityServiceFactory::GetInstance());
60 DependsOn(HistoryServiceFactory::GetInstance());
61 DependsOn(HostContentSettingsMapFactory::GetInstance());
62 DependsOn(PasswordStoreFactory::GetInstance());
63 DependsOn(prerender::PrerenderManagerFactory::GetInstance());
64 DependsOn(TabRestoreServiceFactory::GetInstance());
65 DependsOn(TemplateURLServiceFactory::GetInstance());
66 DependsOn(WebDataServiceFactory::GetInstance());
67 DependsOn(WebHistoryServiceFactory::GetInstance());
68
69 #if defined(OS_ANDROID)
70 DependsOn(offline_pages::OfflinePageModelFactory::GetInstance());
71 DependsOn(precache::PrecacheManagerFactory::GetInstance());
72 #endif
73
74 #if BUILDFLAG(ENABLE_EXTENSIONS)
75 DependsOn(extensions::ActivityLog::GetFactoryInstance());
76 DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
77 #endif
78
79 #if BUILDFLAG(ENABLE_SESSION_SERVICE)
80 DependsOn(SessionServiceFactory::GetInstance());
81 #endif
82 }
83
84 BrowsingDataRemoverFactory::~BrowsingDataRemoverFactory() {}
85
86 content::BrowserContext* BrowsingDataRemoverFactory::GetBrowserContextToUse(
87 content::BrowserContext* context) const {
88 // For guest profiles the browsing data is in the OTR profile.
89 Profile* profile = static_cast<Profile*>(context);
90 DCHECK(!profile->IsGuestSession() || profile->IsOffTheRecord());
91
92 return profile;
93 }
94
95 KeyedService* BrowsingDataRemoverFactory::BuildServiceInstanceFor(
96 content::BrowserContext* context) const {
97 BrowsingDataRemoverImpl* remover = new BrowsingDataRemoverImpl(context);
98 remover->SetEmbedderDelegate(
99 base::MakeUnique<ChromeBrowsingDataRemoverDelegate>(context));
100 return remover;
101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698