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

Side by Side Diff: chrome/browser/profile_resetter/profile_resetter.cc

Issue 2827523003: Move BrowsingDataRemover to content/ (Closed)
Patch Set: Addressed some comments. 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/profile_resetter/profile_resetter.h" 5 #include "chrome/browser/profile_resetter/profile_resetter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/synchronization/cancellation_flag.h" 13 #include "base/synchronization/cancellation_flag.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/browsing_data/browsing_data_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_helper.h"
16 #include "chrome/browser/browsing_data/browsing_data_remover.h" 16
17 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
18 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" 17 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
19 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
20 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" 20 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
22 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/search_engines/template_url_service_factory.h" 22 #include "chrome/browser/search_engines/template_url_service_factory.h"
24 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
25 #include "chrome/browser/ui/browser_list.h" 24 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" 25 #include "chrome/browser/ui/tabs/tab_strip_model.h"
27 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
28 #include "chrome/installer/util/browser_distribution.h" 27 #include "chrome/installer/util/browser_distribution.h"
29 #include "components/content_settings/core/browser/content_settings_info.h" 28 #include "components/content_settings/core/browser/content_settings_info.h"
30 #include "components/content_settings/core/browser/content_settings_registry.h" 29 #include "components/content_settings/core/browser/content_settings_registry.h"
31 #include "components/content_settings/core/browser/host_content_settings_map.h" 30 #include "components/content_settings/core/browser/host_content_settings_map.h"
32 #include "components/content_settings/core/browser/website_settings_info.h" 31 #include "components/content_settings/core/browser/website_settings_info.h"
33 #include "components/content_settings/core/browser/website_settings_registry.h" 32 #include "components/content_settings/core/browser/website_settings_registry.h"
34 #include "components/prefs/pref_service.h" 33 #include "components/prefs/pref_service.h"
35 #include "components/prefs/scoped_user_pref_update.h" 34 #include "components/prefs/scoped_user_pref_update.h"
36 #include "components/search_engines/search_engines_pref_names.h" 35 #include "components/search_engines/search_engines_pref_names.h"
37 #include "components/search_engines/template_url_prepopulate_data.h" 36 #include "components/search_engines/template_url_prepopulate_data.h"
38 #include "components/search_engines/template_url_service.h" 37 #include "components/search_engines/template_url_service.h"
39 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/browsing_data_remover.h"
40 #include "extensions/browser/extension_registry.h" 40 #include "extensions/browser/extension_registry.h"
41 #include "extensions/browser/extension_system.h" 41 #include "extensions/browser/extension_system.h"
42 #include "extensions/browser/management_policy.h" 42 #include "extensions/browser/management_policy.h"
43 #include "extensions/common/extension_id.h" 43 #include "extensions/common/extension_id.h"
44 #include "extensions/common/manifest.h" 44 #include "extensions/common/manifest.h"
45 45
46 #if defined(OS_WIN) 46 #if defined(OS_WIN)
47 #include "base/base_paths.h" 47 #include "base/base_paths.h"
48 #include "base/path_service.h" 48 #include "base/path_service.h"
49 #include "chrome/installer/util/shell_util.h" 49 #include "chrome/installer/util/shell_util.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 map->SetDefaultContentSetting(info->website_settings_info()->type(), 230 map->SetDefaultContentSetting(info->website_settings_info()->type(),
231 CONTENT_SETTING_DEFAULT); 231 CONTENT_SETTING_DEFAULT);
232 } 232 }
233 MarkAsDone(CONTENT_SETTINGS); 233 MarkAsDone(CONTENT_SETTINGS);
234 } 234 }
235 235
236 void ProfileResetter::ResetCookiesAndSiteData() { 236 void ProfileResetter::ResetCookiesAndSiteData() {
237 DCHECK(CalledOnValidThread()); 237 DCHECK(CalledOnValidThread());
238 DCHECK(!cookies_remover_); 238 DCHECK(!cookies_remover_);
239 239
240 cookies_remover_ = BrowsingDataRemoverFactory::GetForBrowserContext(profile_); 240 cookies_remover_ = content::BrowserContext::GetBrowsingDataRemover(profile_);
241 cookies_remover_->AddObserver(this); 241 cookies_remover_->AddObserver(this);
242 int remove_mask = ChromeBrowsingDataRemoverDelegate::DATA_TYPE_SITE_DATA | 242 int remove_mask = ChromeBrowsingDataRemoverDelegate::DATA_TYPE_SITE_DATA |
243 BrowsingDataRemover::DATA_TYPE_CACHE; 243 content::BrowsingDataRemover::DATA_TYPE_CACHE;
244 PrefService* prefs = profile_->GetPrefs(); 244 PrefService* prefs = profile_->GetPrefs();
245 DCHECK(prefs); 245 DCHECK(prefs);
246 246
247 // Don't try to clear LSO data if it's not supported. 247 // Don't try to clear LSO data if it's not supported.
248 if (!prefs->GetBoolean(prefs::kClearPluginLSODataEnabled)) 248 if (!prefs->GetBoolean(prefs::kClearPluginLSODataEnabled))
249 remove_mask &= ~ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA; 249 remove_mask &= ~ChromeBrowsingDataRemoverDelegate::DATA_TYPE_PLUGIN_DATA;
250 cookies_remover_->RemoveAndReply( 250 cookies_remover_->RemoveAndReply(
251 base::Time(), base::Time::Max(), remove_mask, 251 base::Time(), base::Time::Max(), remove_mask,
252 BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB, this); 252 content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB, this);
253 } 253 }
254 254
255 void ProfileResetter::ResetExtensions() { 255 void ProfileResetter::ResetExtensions() {
256 DCHECK(CalledOnValidThread()); 256 DCHECK(CalledOnValidThread());
257 257
258 std::vector<std::string> brandcode_extensions; 258 std::vector<std::string> brandcode_extensions;
259 master_settings_->GetExtensions(&brandcode_extensions); 259 master_settings_->GetExtensions(&brandcode_extensions);
260 260
261 ExtensionService* extension_service = 261 ExtensionService* extension_service =
262 extensions::ExtensionSystem::Get(profile_)->extension_service(); 262 extensions::ExtensionSystem::Get(profile_)->extension_service();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 chrome_exe, 369 chrome_exe,
370 false, 370 false,
371 cancel, 371 cancel,
372 &shortcuts); 372 &shortcuts);
373 } 373 }
374 return shortcuts; 374 return shortcuts;
375 #else 375 #else
376 return std::vector<ShortcutCommand>(); 376 return std::vector<ShortcutCommand>();
377 #endif 377 #endif
378 } 378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698