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

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

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased 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) 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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
18 #include "base/metrics/user_metrics.h"
18 #include "chrome/browser/browsing_data/browsing_data_remover_delegate.h" 19 #include "chrome/browser/browsing_data/browsing_data_remover_delegate.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "components/prefs/pref_service.h" 22 #include "components/prefs/pref_service.h"
22 #include "content/public/browser/browser_context.h" 23 #include "content/public/browser/browser_context.h"
23 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/browsing_data_filter_builder.h" 25 #include "content/public/browser/browsing_data_filter_builder.h"
25 #include "content/public/browser/content_browser_client.h" 26 #include "content/public/browser/content_browser_client.h"
26 #include "content/public/browser/download_manager.h" 27 #include "content/public/browser/download_manager.h"
27 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/storage_partition.h" 29 #include "content/public/browser/storage_partition.h"
29 #include "content/public/browser/user_metrics.h"
30 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
31 #include "net/cookies/cookie_store.h" 31 #include "net/cookies/cookie_store.h"
32 #include "net/http/http_network_session.h" 32 #include "net/http/http_network_session.h"
33 #include "net/http/http_transaction_factory.h" 33 #include "net/http/http_transaction_factory.h"
34 #include "net/http/transport_security_state.h" 34 #include "net/http/transport_security_state.h"
35 #include "net/ssl/channel_id_service.h" 35 #include "net/ssl/channel_id_service.h"
36 #include "net/ssl/channel_id_store.h" 36 #include "net/ssl/channel_id_store.h"
37 #include "net/url_request/url_request_context.h" 37 #include "net/url_request/url_request_context.h"
38 #include "net/url_request/url_request_context_getter.h" 38 #include "net/url_request/url_request_context_getter.h"
39 #include "ppapi/features/features.h" 39 #include "ppapi/features/features.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); 385 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory);
386 386
387 ////////////////////////////////////////////////////////////////////////////// 387 //////////////////////////////////////////////////////////////////////////////
388 // INITIALIZATION 388 // INITIALIZATION
389 base::Callback<bool(const GURL& url)> filter = 389 base::Callback<bool(const GURL& url)> filter =
390 filter_builder.BuildGeneralFilter(); 390 filter_builder.BuildGeneralFilter();
391 391
392 ////////////////////////////////////////////////////////////////////////////// 392 //////////////////////////////////////////////////////////////////////////////
393 // DATA_TYPE_DOWNLOADS 393 // DATA_TYPE_DOWNLOADS
394 if ((remove_mask & DATA_TYPE_DOWNLOADS) && may_delete_history) { 394 if ((remove_mask & DATA_TYPE_DOWNLOADS) && may_delete_history) {
395 content::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads")); 395 base::RecordAction(UserMetricsAction("ClearBrowsingData_Downloads"));
396 content::DownloadManager* download_manager = 396 content::DownloadManager* download_manager =
397 BrowserContext::GetDownloadManager(browser_context_); 397 BrowserContext::GetDownloadManager(browser_context_);
398 download_manager->RemoveDownloadsByURLAndTime(filter, 398 download_manager->RemoveDownloadsByURLAndTime(filter,
399 delete_begin_, delete_end_); 399 delete_begin_, delete_end_);
400 } 400 }
401 401
402 ////////////////////////////////////////////////////////////////////////////// 402 //////////////////////////////////////////////////////////////////////////////
403 // DATA_TYPE_CHANNEL_IDS 403 // DATA_TYPE_CHANNEL_IDS
404 // Channel IDs are not separated for protected and unprotected web 404 // Channel IDs are not separated for protected and unprotected web
405 // origins. We check the origin_type_mask_ to prevent unintended deletion. 405 // origins. We check the origin_type_mask_ to prevent unintended deletion.
406 if (remove_mask & DATA_TYPE_CHANNEL_IDS && 406 if (remove_mask & DATA_TYPE_CHANNEL_IDS &&
407 origin_type_mask_ & ORIGIN_TYPE_UNPROTECTED_WEB) { 407 origin_type_mask_ & ORIGIN_TYPE_UNPROTECTED_WEB) {
408 content::RecordAction( 408 base::RecordAction(UserMetricsAction("ClearBrowsingData_ChannelIDs"));
409 UserMetricsAction("ClearBrowsingData_ChannelIDs"));
410 // Since we are running on the UI thread don't call GetURLRequestContext(). 409 // Since we are running on the UI thread don't call GetURLRequestContext().
411 scoped_refptr<net::URLRequestContextGetter> rq_context = 410 scoped_refptr<net::URLRequestContextGetter> rq_context =
412 content::BrowserContext::GetDefaultStoragePartition(browser_context_)-> 411 content::BrowserContext::GetDefaultStoragePartition(browser_context_)->
413 GetURLRequestContext(); 412 GetURLRequestContext();
414 clear_channel_ids_.Start(); 413 clear_channel_ids_.Start();
415 BrowserThread::PostTask( 414 BrowserThread::PostTask(
416 BrowserThread::IO, FROM_HERE, 415 BrowserThread::IO, FROM_HERE,
417 base::Bind(&ClearChannelIDsOnIOThread, 416 base::Bind(&ClearChannelIDsOnIOThread,
418 filter_builder.BuildChannelIDFilter(), 417 filter_builder.BuildChannelIDFilter(),
419 delete_begin_, delete_end_, std::move(rq_context), 418 delete_begin_, delete_end_, std::move(rq_context),
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 storage_partition_remove_mask, quota_storage_remove_mask, 505 storage_partition_remove_mask, quota_storage_remove_mask,
507 base::Bind(&DoesOriginMatchMaskAndUrls, weak_ptr_factory_.GetWeakPtr(), 506 base::Bind(&DoesOriginMatchMaskAndUrls, weak_ptr_factory_.GetWeakPtr(),
508 origin_type_mask_, filter), 507 origin_type_mask_, filter),
509 cookie_matcher, delete_begin_, delete_end_, 508 cookie_matcher, delete_begin_, delete_end_,
510 clear_storage_partition_data_.GetCompletionCallback()); 509 clear_storage_partition_data_.GetCompletionCallback());
511 } 510 }
512 511
513 ////////////////////////////////////////////////////////////////////////////// 512 //////////////////////////////////////////////////////////////////////////////
514 // CACHE 513 // CACHE
515 if (remove_mask & DATA_TYPE_CACHE) { 514 if (remove_mask & DATA_TYPE_CACHE) {
516 content::RecordAction(UserMetricsAction("ClearBrowsingData_Cache")); 515 base::RecordAction(UserMetricsAction("ClearBrowsingData_Cache"));
517 516
518 // TODO(msramek): Clear the cache of all renderers. 517 // TODO(msramek): Clear the cache of all renderers.
519 518
520 clear_cache_.Start(); 519 clear_cache_.Start();
521 storage_partition->ClearHttpAndMediaCaches( 520 storage_partition->ClearHttpAndMediaCaches(
522 delete_begin, delete_end, 521 delete_begin, delete_end,
523 filter_builder.IsEmptyBlacklist() ? base::Callback<bool(const GURL&)>() 522 filter_builder.IsEmptyBlacklist() ? base::Callback<bool(const GURL&)>()
524 : filter, 523 : filter,
525 clear_cache_.GetCompletionCallback()); 524 clear_cache_.GetCompletionCallback());
526 525
527 // Tell the shader disk cache to clear. 526 // Tell the shader disk cache to clear.
528 content::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache")); 527 base::RecordAction(UserMetricsAction("ClearBrowsingData_ShaderCache"));
529 storage_partition_remove_mask |= 528 storage_partition_remove_mask |=
530 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE; 529 content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE;
531 } 530 }
532 531
533 ////////////////////////////////////////////////////////////////////////////// 532 //////////////////////////////////////////////////////////////////////////////
534 // Auth cache. 533 // Auth cache.
535 if (remove_mask & DATA_TYPE_COOKIES) { 534 if (remove_mask & DATA_TYPE_COOKIES) {
536 scoped_refptr<net::URLRequestContextGetter> request_context = 535 scoped_refptr<net::URLRequestContextGetter> request_context =
537 BrowserContext::GetDefaultStoragePartition(browser_context_) 536 BrowserContext::GetDefaultStoragePartition(browser_context_)
538 ->GetURLRequestContext(); 537 ->GetURLRequestContext();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 661
663 if (completion_inhibitor_) { 662 if (completion_inhibitor_) {
664 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete( 663 completion_inhibitor_->OnBrowsingDataRemoverWouldComplete(
665 this, base::Bind(&BrowsingDataRemoverImpl::Notify, 664 this, base::Bind(&BrowsingDataRemoverImpl::Notify,
666 weak_ptr_factory_.GetWeakPtr())); 665 weak_ptr_factory_.GetWeakPtr()));
667 return; 666 return;
668 } 667 }
669 668
670 Notify(); 669 Notify();
671 } 670 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698