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

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

Issue 8223004: Check whether clearing LSO data is supported in clients of the BrowsingDataRemover. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_remover.h" 5 #include "chrome/browser/browsing_data_remover.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 cache_(NULL), 75 cache_(NULL),
76 main_context_getter_(profile->GetRequestContext()), 76 main_context_getter_(profile->GetRequestContext()),
77 media_context_getter_(profile->GetRequestContextForMedia()), 77 media_context_getter_(profile->GetRequestContextForMedia()),
78 waiting_for_clear_history_(false), 78 waiting_for_clear_history_(false),
79 waiting_for_clear_quota_managed_data_(false), 79 waiting_for_clear_quota_managed_data_(false),
80 waiting_for_clear_networking_history_(false), 80 waiting_for_clear_networking_history_(false),
81 waiting_for_clear_cookies_(false), 81 waiting_for_clear_cookies_(false),
82 waiting_for_clear_cache_(false), 82 waiting_for_clear_cache_(false),
83 waiting_for_clear_lso_data_(false) { 83 waiting_for_clear_lso_data_(false) {
84 DCHECK(profile); 84 DCHECK(profile);
85 clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled,
86 profile_->GetPrefs(),
87 NULL);
88 } 85 }
89 86
90 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, 87 BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
91 TimePeriod time_period, 88 TimePeriod time_period,
92 base::Time delete_end) 89 base::Time delete_end)
93 : profile_(profile), 90 : profile_(profile),
94 quota_manager_(NULL), 91 quota_manager_(NULL),
95 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()), 92 special_storage_policy_(profile->GetExtensionSpecialStoragePolicy()),
96 delete_begin_(CalculateBeginDeleteTime(time_period)), 93 delete_begin_(CalculateBeginDeleteTime(time_period)),
97 delete_end_(delete_end), 94 delete_end_(delete_end),
98 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_( 95 ALLOW_THIS_IN_INITIALIZER_LIST(cache_callback_(
99 this, &BrowsingDataRemover::DoClearCache)), 96 this, &BrowsingDataRemover::DoClearCache)),
100 next_cache_state_(STATE_NONE), 97 next_cache_state_(STATE_NONE),
101 cache_(NULL), 98 cache_(NULL),
102 main_context_getter_(profile->GetRequestContext()), 99 main_context_getter_(profile->GetRequestContext()),
103 media_context_getter_(profile->GetRequestContextForMedia()), 100 media_context_getter_(profile->GetRequestContextForMedia()),
104 waiting_for_clear_history_(false), 101 waiting_for_clear_history_(false),
105 waiting_for_clear_quota_managed_data_(false), 102 waiting_for_clear_quota_managed_data_(false),
106 waiting_for_clear_networking_history_(false), 103 waiting_for_clear_networking_history_(false),
107 waiting_for_clear_cookies_(false), 104 waiting_for_clear_cookies_(false),
108 waiting_for_clear_cache_(false), 105 waiting_for_clear_cache_(false),
109 waiting_for_clear_lso_data_(false) { 106 waiting_for_clear_lso_data_(false) {
110 DCHECK(profile); 107 DCHECK(profile);
111 clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled,
112 profile_->GetPrefs(),
113 NULL);
114 } 108 }
115 109
116 BrowsingDataRemover::~BrowsingDataRemover() { 110 BrowsingDataRemover::~BrowsingDataRemover() {
117 DCHECK(all_done()); 111 DCHECK(all_done());
118 } 112 }
119 113
120 // Static. 114 // Static.
121 void BrowsingDataRemover::set_removing(bool removing) { 115 void BrowsingDataRemover::set_removing(bool removing) {
122 DCHECK(removing_ != removing); 116 DCHECK(removing_ != removing);
123 removing_ = removing; 117 removing_ = removing;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 if (quota_manager_) { 223 if (quota_manager_) {
230 waiting_for_clear_quota_managed_data_ = true; 224 waiting_for_clear_quota_managed_data_ = true;
231 BrowserThread::PostTask( 225 BrowserThread::PostTask(
232 BrowserThread::IO, FROM_HERE, 226 BrowserThread::IO, FROM_HERE,
233 NewRunnableMethod( 227 NewRunnableMethod(
234 this, 228 this,
235 &BrowsingDataRemover::ClearQuotaManagedDataOnIOThread)); 229 &BrowsingDataRemover::ClearQuotaManagedDataOnIOThread));
236 } 230 }
237 } 231 }
238 232
239 if (remove_mask & REMOVE_LSO_DATA && *clear_plugin_lso_data_enabled_) { 233 if (remove_mask & REMOVE_LSO_DATA) {
240 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_LSOData")); 234 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_LSOData"));
241 235
242 waiting_for_clear_lso_data_ = true; 236 waiting_for_clear_lso_data_ = true;
243 if (!plugin_data_remover_.get()) 237 if (!plugin_data_remover_.get())
244 plugin_data_remover_ = new PluginDataRemover(profile_); 238 plugin_data_remover_ = new PluginDataRemover(profile_);
245 base::WaitableEvent* event = 239 base::WaitableEvent* event =
246 plugin_data_remover_->StartRemoving(delete_begin_); 240 plugin_data_remover_->StartRemoving(delete_begin_);
247 watcher_.StartWatching(event, this); 241 watcher_.StartWatching(event, this);
248 } 242 }
249 243
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 GetURLRequestContext()->cookie_store()->GetCookieMonster(); 577 GetURLRequestContext()->cookie_store()->GetCookieMonster();
584 if (cookie_monster) { 578 if (cookie_monster) {
585 cookie_monster->DeleteAllCreatedBetweenAsync( 579 cookie_monster->DeleteAllCreatedBetweenAsync(
586 delete_begin_, delete_end_, 580 delete_begin_, delete_end_,
587 base::Bind(&BrowsingDataRemover::OnClearedCookies, 581 base::Bind(&BrowsingDataRemover::OnClearedCookies,
588 base::Unretained(this))); 582 base::Unretained(this)));
589 } else { 583 } else {
590 OnClearedCookies(0); 584 OnClearedCookies(0);
591 } 585 }
592 } 586 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | chrome/browser/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698