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

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

Issue 2617403005: Move HISTORY and PASSWORDS from BrowsingDataRemover to the delegate (Closed)
Patch Set: Rebase. Created 3 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_impl.h" 5 #include "chrome/browser/browsing_data/browsing_data_remover_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 12 matching lines...) Expand all
23 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
24 #include "components/browsing_data/content/storage_partition_http_cache_data_rem over.h" 24 #include "components/browsing_data/content/storage_partition_http_cache_data_rem over.h"
25 #include "components/prefs/pref_service.h" 25 #include "components/prefs/pref_service.h"
26 #include "components/web_cache/browser/web_cache_manager.h" 26 #include "components/web_cache/browser/web_cache_manager.h"
27 #include "content/public/browser/browser_context.h" 27 #include "content/public/browser/browser_context.h"
28 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/content_browser_client.h" 29 #include "content/public/browser/content_browser_client.h"
30 #include "content/public/browser/download_manager.h" 30 #include "content/public/browser/download_manager.h"
31 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
32 #include "content/public/browser/plugin_data_remover.h" 32 #include "content/public/browser/plugin_data_remover.h"
33 #include "content/public/browser/ssl_host_state_delegate.h"
34 #include "content/public/browser/storage_partition.h" 33 #include "content/public/browser/storage_partition.h"
35 #include "content/public/browser/user_metrics.h" 34 #include "content/public/browser/user_metrics.h"
36 #include "extensions/features/features.h" 35 #include "extensions/features/features.h"
37 #include "media/media_features.h" 36 #include "media/media_features.h"
38 #include "net/base/net_errors.h" 37 #include "net/base/net_errors.h"
39 #include "net/cookies/cookie_store.h" 38 #include "net/cookies/cookie_store.h"
40 #include "net/http/http_network_session.h" 39 #include "net/http/http_network_session.h"
41 #include "net/http/http_transaction_factory.h" 40 #include "net/http/http_transaction_factory.h"
42 #include "net/http/transport_security_state.h" 41 #include "net/http/transport_security_state.h"
43 #include "net/ssl/channel_id_service.h" 42 #include "net/ssl/channel_id_service.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 369
371 // Managed devices and supervised users can have restrictions on history 370 // Managed devices and supervised users can have restrictions on history
372 // deletion. 371 // deletion.
373 // TODO(crbug.com/668114): This should be provided via ContentBrowserClient 372 // TODO(crbug.com/668114): This should be provided via ContentBrowserClient
374 // once BrowsingDataRemoverImpl moves to content. 373 // once BrowsingDataRemoverImpl moves to content.
375 PrefService* prefs = 374 PrefService* prefs =
376 Profile::FromBrowserContext(browser_context_)->GetPrefs(); 375 Profile::FromBrowserContext(browser_context_)->GetPrefs();
377 bool may_delete_history = 376 bool may_delete_history =
378 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); 377 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory);
379 378
380 // All the UI entry points into the BrowsingDataRemoverImpl should be
381 // disabled, but this will fire if something was missed or added.
382 DCHECK(may_delete_history || (remove_mask & REMOVE_NOCHECKS) ||
383 (!(remove_mask & REMOVE_HISTORY) && !(remove_mask & REMOVE_DOWNLOADS)));
384
385 ////////////////////////////////////////////////////////////////////////////// 379 //////////////////////////////////////////////////////////////////////////////
386 // INITIALIZATION 380 // INITIALIZATION
387 base::Callback<bool(const GURL& url)> filter = 381 base::Callback<bool(const GURL& url)> filter =
388 filter_builder.BuildGeneralFilter(); 382 filter_builder.BuildGeneralFilter();
389 383
390 if ((remove_mask & REMOVE_HISTORY) && may_delete_history) {
391 // The SSL Host State that tracks SSL interstitial "proceed" decisions may
392 // include origins that the user has visited, so it must be cleared.
393 // TODO(msramek): We can reuse the plugin filter here, since both plugins
394 // and SSL host state are scoped to hosts and represent them as std::string.
395 // Rename the method to indicate its more general usage.
396 if (browser_context_->GetSSLHostStateDelegate()) {
397 browser_context_->GetSSLHostStateDelegate()->Clear(
398 filter_builder.IsEmptyBlacklist()
399 ? base::Callback<bool(const std::string&)>()
400 : filter_builder.BuildPluginFilter());
401 }
402 }
403
404 ////////////////////////////////////////////////////////////////////////////// 384 //////////////////////////////////////////////////////////////////////////////
405 // REMOVE_DOWNLOADS 385 // REMOVE_DOWNLOADS
406 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) { 386 if ((remove_mask & REMOVE_DOWNLOADS) && may_delete_history) {
407 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); 387 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads"));
408 content::DownloadManager* download_manager = 388 content::DownloadManager* download_manager =
409 BrowserContext::GetDownloadManager(browser_context_); 389 BrowserContext::GetDownloadManager(browser_context_);
410 download_manager->RemoveDownloadsByURLAndTime(filter, 390 download_manager->RemoveDownloadsByURLAndTime(filter,
411 delete_begin_, delete_end_); 391 delete_begin_, delete_end_);
412 } 392 }
413 393
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 558 }
579 559
580 // Tell the shader disk cache to clear. 560 // Tell the shader disk cache to clear.
581 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); 561 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache"));
582 storage_partition_remove_mask |= 562 storage_partition_remove_mask |=
583 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; 563 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE;
584 } 564 }
585 565
586 ////////////////////////////////////////////////////////////////////////////// 566 //////////////////////////////////////////////////////////////////////////////
587 // Auth cache. 567 // Auth cache.
588 if (remove_mask & REMOVE_COOKIES || remove_mask & REMOVE_PASSWORDS) { 568 if (remove_mask & REMOVE_COOKIES) {
589 scoped_refptr<net::URLRequestContextGetter> request_context = 569 scoped_refptr<net::URLRequestContextGetter> request_context =
590 BrowserContext::GetDefaultStoragePartition(browser_context_) 570 BrowserContext::GetDefaultStoragePartition(browser_context_)
591 ->GetURLRequestContext(); 571 ->GetURLRequestContext();
592 clear_http_auth_cache_.Start(); 572 clear_http_auth_cache_.Start();
593 BrowserThread::PostTaskAndReply( 573 BrowserThread::PostTaskAndReply(
594 BrowserThread::IO, FROM_HERE, 574 BrowserThread::IO, FROM_HERE,
595 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context), 575 base::Bind(&ClearHttpAuthCacheOnIOThread, std::move(request_context),
596 delete_begin_), 576 delete_begin_),
597 clear_http_auth_cache_.GetCompletionCallback()); 577 clear_http_auth_cache_.GetCompletionCallback());
598 } 578 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 746 }
767 747
768 NotifyIfDone(); 748 NotifyIfDone();
769 } 749 }
770 750
771 void BrowsingDataRemoverImpl::OnFlashDataDeleted() { 751 void BrowsingDataRemoverImpl::OnFlashDataDeleted() {
772 clear_plugin_data_count_--; 752 clear_plugin_data_count_--;
773 NotifyIfDone(); 753 NotifyIfDone();
774 } 754 }
775 #endif 755 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698