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

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

Issue 2578723002: Reduce BrowsingDataRemover's dependencies on Chrome (Closed)
Patch Set: Created 4 years 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 #include "chrome/common/renderer_configuration.mojom.h" 112 #include "chrome/common/renderer_configuration.mojom.h"
113 #include "chrome/common/secure_origin_whitelist.h" 113 #include "chrome/common/secure_origin_whitelist.h"
114 #include "chrome/common/stack_sampling_configuration.h" 114 #include "chrome/common/stack_sampling_configuration.h"
115 #include "chrome/common/url_constants.h" 115 #include "chrome/common/url_constants.h"
116 #include "chrome/grit/browser_resources.h" 116 #include "chrome/grit/browser_resources.h"
117 #include "chrome/grit/generated_resources.h" 117 #include "chrome/grit/generated_resources.h"
118 #include "chrome/installer/util/google_update_settings.h" 118 #include "chrome/installer/util/google_update_settings.h"
119 #include "chromeos/chromeos_constants.h" 119 #include "chromeos/chromeos_constants.h"
120 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 120 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
121 #include "components/autofill/core/common/autofill_switches.h" 121 #include "components/autofill/core/common/autofill_switches.h"
122 #include "components/browsing_data/core/browsing_data_utils.h"
122 #include "components/cdm/browser/cdm_message_filter_android.h" 123 #include "components/cdm/browser/cdm_message_filter_android.h"
123 #include "components/cloud_devices/common/cloud_devices_switches.h" 124 #include "components/cloud_devices/common/cloud_devices_switches.h"
124 #include "components/content_settings/core/browser/content_settings_utils.h" 125 #include "components/content_settings/core/browser/content_settings_utils.h"
125 #include "components/content_settings/core/browser/cookie_settings.h" 126 #include "components/content_settings/core/browser/cookie_settings.h"
126 #include "components/content_settings/core/browser/host_content_settings_map.h" 127 #include "components/content_settings/core/browser/host_content_settings_map.h"
127 #include "components/content_settings/core/common/content_settings.h" 128 #include "components/content_settings/core/common/content_settings.h"
128 #include "components/content_settings/core/common/content_settings_types.h" 129 #include "components/content_settings/core/common/content_settings_types.h"
129 #include "components/dom_distiller/core/dom_distiller_switches.h" 130 #include "components/dom_distiller/core/dom_distiller_switches.h"
130 #include "components/dom_distiller/core/url_constants.h" 131 #include "components/dom_distiller/core/url_constants.h"
131 #include "components/error_page/common/error_page_switches.h" 132 #include "components/error_page/common/error_page_switches.h"
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 2592
2592 // chrome: & friends. 2593 // chrome: & friends.
2593 handler->AddHandlerPair(&HandleWebUI, &HandleWebUIReverse); 2594 handler->AddHandlerPair(&HandleWebUI, &HandleWebUIReverse);
2594 } 2595 }
2595 2596
2596 void ChromeContentBrowserClient::ClearCache(RenderFrameHost* rfh) { 2597 void ChromeContentBrowserClient::ClearCache(RenderFrameHost* rfh) {
2597 Profile* profile = Profile::FromBrowserContext( 2598 Profile* profile = Profile::FromBrowserContext(
2598 rfh->GetSiteInstance()->GetProcess()->GetBrowserContext()); 2599 rfh->GetSiteInstance()->GetProcess()->GetBrowserContext());
2599 BrowsingDataRemover* remover = 2600 BrowsingDataRemover* remover =
2600 BrowsingDataRemoverFactory::GetForBrowserContext(profile); 2601 BrowsingDataRemoverFactory::GetForBrowserContext(profile);
2601 remover->Remove(BrowsingDataRemover::Unbounded(), 2602 remover->Remove(base::Time(), base::Time::Max(),
2602 BrowsingDataRemover::REMOVE_CACHE, 2603 BrowsingDataRemover::REMOVE_CACHE,
2603 BrowsingDataHelper::UNPROTECTED_WEB); 2604 BrowsingDataHelper::UNPROTECTED_WEB);
2604 } 2605 }
2605 2606
2606 void ChromeContentBrowserClient::ClearCookies(RenderFrameHost* rfh) { 2607 void ChromeContentBrowserClient::ClearCookies(RenderFrameHost* rfh) {
2607 Profile* profile = Profile::FromBrowserContext( 2608 Profile* profile = Profile::FromBrowserContext(
2608 rfh->GetSiteInstance()->GetProcess()->GetBrowserContext()); 2609 rfh->GetSiteInstance()->GetProcess()->GetBrowserContext());
2609 BrowsingDataRemover* remover = 2610 BrowsingDataRemover* remover =
2610 BrowsingDataRemoverFactory::GetForBrowserContext(profile); 2611 BrowsingDataRemoverFactory::GetForBrowserContext(profile);
2611 int remove_mask = BrowsingDataRemover::REMOVE_SITE_DATA; 2612 int remove_mask = BrowsingDataRemover::REMOVE_SITE_DATA;
2612 remover->Remove(BrowsingDataRemover::Unbounded(), remove_mask, 2613 remover->Remove(base::Time(), base::Time::Max(), remove_mask,
2613 BrowsingDataHelper::UNPROTECTED_WEB); 2614 BrowsingDataHelper::UNPROTECTED_WEB);
2614 } 2615 }
2615 2616
2616 void ChromeContentBrowserClient::ClearSiteData( 2617 void ChromeContentBrowserClient::ClearSiteData(
2617 content::BrowserContext* browser_context, 2618 content::BrowserContext* browser_context,
2618 const url::Origin& origin, 2619 const url::Origin& origin,
2619 bool remove_cookies, 2620 bool remove_cookies,
2620 bool remove_storage, 2621 bool remove_storage,
2621 bool remove_cache, 2622 bool remove_cache,
2622 const base::Closure& callback) { 2623 const base::Closure& callback) {
(...skipping 17 matching lines...) Expand all
2640 2641
2641 if (domain.empty()) 2642 if (domain.empty())
2642 domain = origin.host(); // IP address or internal hostname. 2643 domain = origin.host(); // IP address or internal hostname.
2643 2644
2644 std::unique_ptr<RegistrableDomainFilterBuilder> domain_filter_builder( 2645 std::unique_ptr<RegistrableDomainFilterBuilder> domain_filter_builder(
2645 new RegistrableDomainFilterBuilder( 2646 new RegistrableDomainFilterBuilder(
2646 BrowsingDataFilterBuilder::WHITELIST)); 2647 BrowsingDataFilterBuilder::WHITELIST));
2647 domain_filter_builder->AddRegisterableDomain(domain); 2648 domain_filter_builder->AddRegisterableDomain(domain);
2648 2649
2649 remover->RemoveWithFilterAndReply( 2650 remover->RemoveWithFilterAndReply(
2650 BrowsingDataRemover::Period(browsing_data::TimePeriod::ALL_TIME), 2651 base::Time(), base::Time::Max(),
2651 BrowsingDataRemover::REMOVE_COOKIES | 2652 BrowsingDataRemover::REMOVE_COOKIES |
2652 BrowsingDataRemover::REMOVE_CHANNEL_IDS | 2653 BrowsingDataRemover::REMOVE_CHANNEL_IDS |
2653 BrowsingDataRemover::REMOVE_PLUGIN_DATA, 2654 BrowsingDataRemover::REMOVE_PLUGIN_DATA,
2654 BrowsingDataHelper::ALL, std::move(domain_filter_builder), observer); 2655 BrowsingDataHelper::ALL, std::move(domain_filter_builder), observer);
2655 } else { 2656 } else {
2656 // The first removal task is a no-op. 2657 // The first removal task is a no-op.
2657 observer->OnBrowsingDataRemoverDone(); 2658 observer->OnBrowsingDataRemoverDone();
2658 } 2659 }
2659 2660
2660 // Delete origin-scoped data. 2661 // Delete origin-scoped data.
2661 int remove_mask = 0; 2662 int remove_mask = 0;
2662 if (remove_storage) { 2663 if (remove_storage) {
2663 remove_mask |= BrowsingDataRemover::REMOVE_SITE_DATA & 2664 remove_mask |= BrowsingDataRemover::REMOVE_SITE_DATA &
2664 ~BrowsingDataRemover::REMOVE_COOKIES & 2665 ~BrowsingDataRemover::REMOVE_COOKIES &
2665 ~BrowsingDataRemover::REMOVE_CHANNEL_IDS & 2666 ~BrowsingDataRemover::REMOVE_CHANNEL_IDS &
2666 ~BrowsingDataRemover::REMOVE_PLUGIN_DATA; 2667 ~BrowsingDataRemover::REMOVE_PLUGIN_DATA;
2667 } 2668 }
2668 if (remove_cache) 2669 if (remove_cache)
2669 remove_mask |= BrowsingDataRemover::REMOVE_CACHE; 2670 remove_mask |= BrowsingDataRemover::REMOVE_CACHE;
2670 2671
2671 if (remove_mask) { 2672 if (remove_mask) {
2672 std::unique_ptr<OriginFilterBuilder> origin_filter_builder( 2673 std::unique_ptr<OriginFilterBuilder> origin_filter_builder(
2673 new OriginFilterBuilder(BrowsingDataFilterBuilder::WHITELIST)); 2674 new OriginFilterBuilder(BrowsingDataFilterBuilder::WHITELIST));
2674 origin_filter_builder->AddOrigin(origin); 2675 origin_filter_builder->AddOrigin(origin);
2675 2676
2676 remover->RemoveWithFilterAndReply( 2677 remover->RemoveWithFilterAndReply(
2677 BrowsingDataRemover::Period(browsing_data::TimePeriod::ALL_TIME), 2678 base::Time(), base::Time::Max(),
2678 remove_mask, BrowsingDataHelper::ALL, std::move(origin_filter_builder), 2679 remove_mask, BrowsingDataHelper::ALL, std::move(origin_filter_builder),
2679 observer); 2680 observer);
2680 } else { 2681 } else {
2681 // The second removal task is a no-op. 2682 // The second removal task is a no-op.
2682 observer->OnBrowsingDataRemoverDone(); 2683 observer->OnBrowsingDataRemoverDone();
2683 } 2684 }
2684 } 2685 }
2685 2686
2686 base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { 2687 base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
2687 return DownloadPrefs::GetDefaultDownloadDirectory(); 2688 return DownloadPrefs::GetDefaultDownloadDirectory();
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
3349 GetBrowserSchedulerWorkerPoolParamsFromVariations(); 3350 GetBrowserSchedulerWorkerPoolParamsFromVariations();
3350 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization:: 3351 *index_to_traits_callback = base::Bind(&task_scheduler_util::initialization::
3351 BrowserWorkerPoolIndexForTraits); 3352 BrowserWorkerPoolIndexForTraits);
3352 } 3353 }
3353 3354
3354 void ChromeContentBrowserClient:: 3355 void ChromeContentBrowserClient::
3355 PerformExperimentalTaskSchedulerRedirections() { 3356 PerformExperimentalTaskSchedulerRedirections() {
3356 task_scheduler_util::variations:: 3357 task_scheduler_util::variations::
3357 MaybePerformBrowserTaskSchedulerRedirection(); 3358 MaybePerformBrowserTaskSchedulerRedirection();
3358 } 3359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698