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

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

Issue 2647683002: Consolidate Origin- and RegistrableDomain- FilterBuilder into one class (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
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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
28 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
29 #include "base/threading/sequenced_worker_pool.h" 29 #include "base/threading/sequenced_worker_pool.h"
30 #include "base/threading/thread_task_runner_handle.h" 30 #include "base/threading/thread_task_runner_handle.h"
31 #include "build/build_config.h" 31 #include "build/build_config.h"
32 #include "chrome/browser/after_startup_task_utils.h" 32 #include "chrome/browser/after_startup_task_utils.h"
33 #include "chrome/browser/apps/app_url_redirector.h" 33 #include "chrome/browser/apps/app_url_redirector.h"
34 #include "chrome/browser/browser_about_handler.h" 34 #include "chrome/browser/browser_about_handler.h"
35 #include "chrome/browser/browser_process.h" 35 #include "chrome/browser/browser_process.h"
36 #include "chrome/browser/browser_shutdown.h" 36 #include "chrome/browser/browser_shutdown.h"
37 #include "chrome/browser/browsing_data/browsing_data_filter_builder.h"
37 #include "chrome/browser/browsing_data/browsing_data_helper.h" 38 #include "chrome/browser/browsing_data/browsing_data_helper.h"
38 #include "chrome/browser/browsing_data/browsing_data_remover.h" 39 #include "chrome/browser/browsing_data/browsing_data_remover.h"
39 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 40 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
40 #include "chrome/browser/browsing_data/origin_filter_builder.h"
41 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h"
42 #include "chrome/browser/budget_service/budget_service_impl.h" 41 #include "chrome/browser/budget_service/budget_service_impl.h"
43 #include "chrome/browser/chrome_content_browser_client_parts.h" 42 #include "chrome/browser/chrome_content_browser_client_parts.h"
44 #include "chrome/browser/chrome_quota_permission_context.h" 43 #include "chrome/browser/chrome_quota_permission_context.h"
45 #include "chrome/browser/content_settings/cookie_settings_factory.h" 44 #include "chrome/browser/content_settings/cookie_settings_factory.h"
46 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 45 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
47 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 46 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
48 #include "chrome/browser/defaults.h" 47 #include "chrome/browser/defaults.h"
49 #include "chrome/browser/download/download_prefs.h" 48 #include "chrome/browser/download/download_prefs.h"
50 #include "chrome/browser/engagement/site_engagement_eviction_policy.h" 49 #include "chrome/browser/engagement/site_engagement_eviction_policy.h"
51 #include "chrome/browser/field_trial_recorder.h" 50 #include "chrome/browser/field_trial_recorder.h"
(...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 // b) |origin|'s host exactly if it is an IP address or an internal hostname 2631 // b) |origin|'s host exactly if it is an IP address or an internal hostname
2633 // (e.g. "localhost" or "fileserver"). 2632 // (e.g. "localhost" or "fileserver").
2634 if (remove_cookies) { 2633 if (remove_cookies) {
2635 std::string domain = GetDomainAndRegistry( 2634 std::string domain = GetDomainAndRegistry(
2636 origin.host(), 2635 origin.host(),
2637 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 2636 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
2638 2637
2639 if (domain.empty()) 2638 if (domain.empty())
2640 domain = origin.host(); // IP address or internal hostname. 2639 domain = origin.host(); // IP address or internal hostname.
2641 2640
2642 std::unique_ptr<RegistrableDomainFilterBuilder> domain_filter_builder( 2641 std::unique_ptr<BrowsingDataFilterBuilder> domain_filter_builder(
2643 new RegistrableDomainFilterBuilder( 2642 BrowsingDataFilterBuilder::Create(
2644 BrowsingDataFilterBuilder::WHITELIST)); 2643 BrowsingDataFilterBuilder::WHITELIST));
2645 domain_filter_builder->AddRegisterableDomain(domain); 2644 domain_filter_builder->AddRegisterableDomain(domain);
2646 2645
2647 remover->RemoveWithFilterAndReply( 2646 remover->RemoveWithFilterAndReply(
2648 base::Time(), base::Time::Max(), 2647 base::Time(), base::Time::Max(),
2649 BrowsingDataRemover::REMOVE_COOKIES | 2648 BrowsingDataRemover::REMOVE_COOKIES |
2650 BrowsingDataRemover::REMOVE_CHANNEL_IDS | 2649 BrowsingDataRemover::REMOVE_CHANNEL_IDS |
2651 BrowsingDataRemover::REMOVE_PLUGIN_DATA, 2650 BrowsingDataRemover::REMOVE_PLUGIN_DATA,
2652 BrowsingDataHelper::ALL, std::move(domain_filter_builder), observer); 2651 BrowsingDataHelper::ALL, std::move(domain_filter_builder), observer);
2653 } else { 2652 } else {
2654 // The first removal task is a no-op. 2653 // The first removal task is a no-op.
2655 observer->OnBrowsingDataRemoverDone(); 2654 observer->OnBrowsingDataRemoverDone();
2656 } 2655 }
2657 2656
2658 // Delete origin-scoped data. 2657 // Delete origin-scoped data.
2659 int remove_mask = 0; 2658 int remove_mask = 0;
2660 if (remove_storage) { 2659 if (remove_storage) {
2661 remove_mask |= BrowsingDataRemover::REMOVE_SITE_DATA & 2660 remove_mask |= BrowsingDataRemover::REMOVE_SITE_DATA &
2662 ~BrowsingDataRemover::REMOVE_COOKIES & 2661 ~BrowsingDataRemover::REMOVE_COOKIES &
2663 ~BrowsingDataRemover::REMOVE_CHANNEL_IDS & 2662 ~BrowsingDataRemover::REMOVE_CHANNEL_IDS &
2664 ~BrowsingDataRemover::REMOVE_PLUGIN_DATA; 2663 ~BrowsingDataRemover::REMOVE_PLUGIN_DATA;
2665 } 2664 }
2666 if (remove_cache) 2665 if (remove_cache)
2667 remove_mask |= BrowsingDataRemover::REMOVE_CACHE; 2666 remove_mask |= BrowsingDataRemover::REMOVE_CACHE;
2668 2667
2669 if (remove_mask) { 2668 if (remove_mask) {
2670 std::unique_ptr<OriginFilterBuilder> origin_filter_builder( 2669 std::unique_ptr<BrowsingDataFilterBuilder> origin_filter_builder(
2671 new OriginFilterBuilder(BrowsingDataFilterBuilder::WHITELIST)); 2670 BrowsingDataFilterBuilder::Create(
2671 BrowsingDataFilterBuilder::WHITELIST));
2672 origin_filter_builder->AddOrigin(origin); 2672 origin_filter_builder->AddOrigin(origin);
2673 2673
2674 remover->RemoveWithFilterAndReply( 2674 remover->RemoveWithFilterAndReply(
2675 base::Time(), base::Time::Max(), 2675 base::Time(), base::Time::Max(),
2676 remove_mask, BrowsingDataHelper::ALL, std::move(origin_filter_builder), 2676 remove_mask, BrowsingDataHelper::ALL, std::move(origin_filter_builder),
2677 observer); 2677 observer);
2678 } else { 2678 } else {
2679 // The second removal task is a no-op. 2679 // The second removal task is a no-op.
2680 observer->OnBrowsingDataRemoverDone(); 2680 observer->OnBrowsingDataRemoverDone();
2681 } 2681 }
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
3403 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { 3403 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() {
3404 return variations::GetVariationParamValue( 3404 return variations::GetVariationParamValue(
3405 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; 3405 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true";
3406 } 3406 }
3407 3407
3408 bool ChromeContentBrowserClient:: 3408 bool ChromeContentBrowserClient::
3409 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3409 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3410 return variations::GetVariationParamValue( 3410 return variations::GetVariationParamValue(
3411 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3411 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3412 } 3412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698