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

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

Issue 8135017: Refactor downloads into a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated latest rounds of comments from John. 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"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/platform_file.h" 15 #include "base/platform_file.h"
16 #include "chrome/browser/autofill/personal_data_manager.h" 16 #include "chrome/browser/autofill/personal_data_manager.h"
17 #include "chrome/browser/autofill/personal_data_manager_factory.h" 17 #include "chrome/browser/autofill/personal_data_manager_factory.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/download/download_service.h"
20 #include "chrome/browser/download/download_service_factory.h"
19 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_special_storage_policy.h" 22 #include "chrome/browser/extensions/extension_special_storage_policy.h"
21 #include "chrome/browser/history/history.h" 23 #include "chrome/browser/history/history.h"
22 #include "chrome/browser/io_thread.h" 24 #include "chrome/browser/io_thread.h"
23 #include "chrome/browser/net/chrome_net_log.h" 25 #include "chrome/browser/net/chrome_net_log.h"
24 #include "chrome/browser/net/chrome_url_request_context.h" 26 #include "chrome/browser/net/chrome_url_request_context.h"
25 #include "chrome/browser/net/predictor.h" 27 #include "chrome/browser/net/predictor.h"
26 #include "chrome/browser/password_manager/password_store.h" 28 #include "chrome/browser/password_manager/password_store.h"
27 #include "chrome/browser/plugin_data_remover.h" 29 #include "chrome/browser/plugin_data_remover.h"
28 #include "chrome/browser/prefs/pref_member.h" 30 #include "chrome/browser/prefs/pref_member.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 prerender::PrerenderManagerFactory::GetForProfile(profile_); 188 prerender::PrerenderManagerFactory::GetForProfile(profile_);
187 if (prerender_manager) { 189 if (prerender_manager) {
188 prerender_manager->ClearData( 190 prerender_manager->ClearData(
189 prerender::PrerenderManager::CLEAR_PRERENDER_CONTENTS | 191 prerender::PrerenderManager::CLEAR_PRERENDER_CONTENTS |
190 prerender::PrerenderManager::CLEAR_PRERENDER_HISTORY); 192 prerender::PrerenderManager::CLEAR_PRERENDER_HISTORY);
191 } 193 }
192 } 194 }
193 195
194 if (remove_mask & REMOVE_DOWNLOADS) { 196 if (remove_mask & REMOVE_DOWNLOADS) {
195 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); 197 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads"));
196 DownloadManager* download_manager = profile_->GetDownloadManager(); 198 DownloadManager* download_manager =
199 DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager();
197 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_); 200 download_manager->RemoveDownloadsBetween(delete_begin_, delete_end_);
198 download_manager->ClearLastDownloadPath(); 201 download_manager->ClearLastDownloadPath();
199 } 202 }
200 203
201 if (remove_mask & REMOVE_COOKIES) { 204 if (remove_mask & REMOVE_COOKIES) {
202 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies")); 205 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies"));
203 // Since we are running on the UI thread don't call GetURLRequestContext(). 206 // Since we are running on the UI thread don't call GetURLRequestContext().
204 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext(); 207 net::URLRequestContextGetter* rq_context = profile_->GetRequestContext();
205 if (rq_context) { 208 if (rq_context) {
206 waiting_for_clear_cookies_ = true; 209 waiting_for_clear_cookies_ = true;
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 GetURLRequestContext()->cookie_store()->GetCookieMonster(); 585 GetURLRequestContext()->cookie_store()->GetCookieMonster();
583 if (cookie_monster) { 586 if (cookie_monster) {
584 cookie_monster->DeleteAllCreatedBetweenAsync( 587 cookie_monster->DeleteAllCreatedBetweenAsync(
585 delete_begin_, delete_end_, 588 delete_begin_, delete_end_,
586 base::Bind(&BrowsingDataRemover::OnClearedCookies, 589 base::Bind(&BrowsingDataRemover::OnClearedCookies,
587 base::Unretained(this))); 590 base::Unretained(this)));
588 } else { 591 } else {
589 OnClearedCookies(0); 592 OnClearedCookies(0);
590 } 593 }
591 } 594 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/download/chrome_download_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698