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

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

Issue 2578723002: Reduce BrowsingDataRemover's dependencies on Chrome (Closed)
Patch Set: A new callsite appeared through rebase - fixed the compilation error. 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #include "chrome/common/renderer_configuration.mojom.h" 114 #include "chrome/common/renderer_configuration.mojom.h"
115 #include "chrome/common/secure_origin_whitelist.h" 115 #include "chrome/common/secure_origin_whitelist.h"
116 #include "chrome/common/stack_sampling_configuration.h" 116 #include "chrome/common/stack_sampling_configuration.h"
117 #include "chrome/common/url_constants.h" 117 #include "chrome/common/url_constants.h"
118 #include "chrome/grit/browser_resources.h" 118 #include "chrome/grit/browser_resources.h"
119 #include "chrome/grit/generated_resources.h" 119 #include "chrome/grit/generated_resources.h"
120 #include "chrome/installer/util/google_update_settings.h" 120 #include "chrome/installer/util/google_update_settings.h"
121 #include "chromeos/chromeos_constants.h" 121 #include "chromeos/chromeos_constants.h"
122 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 122 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
123 #include "components/autofill/core/common/autofill_switches.h" 123 #include "components/autofill/core/common/autofill_switches.h"
124 #include "components/browsing_data/core/browsing_data_utils.h"
124 #include "components/cdm/browser/cdm_message_filter_android.h" 125 #include "components/cdm/browser/cdm_message_filter_android.h"
125 #include "components/cloud_devices/common/cloud_devices_switches.h" 126 #include "components/cloud_devices/common/cloud_devices_switches.h"
126 #include "components/content_settings/core/browser/content_settings_utils.h" 127 #include "components/content_settings/core/browser/content_settings_utils.h"
127 #include "components/content_settings/core/browser/cookie_settings.h" 128 #include "components/content_settings/core/browser/cookie_settings.h"
128 #include "components/content_settings/core/browser/host_content_settings_map.h" 129 #include "components/content_settings/core/browser/host_content_settings_map.h"
129 #include "components/content_settings/core/common/content_settings.h" 130 #include "components/content_settings/core/common/content_settings.h"
130 #include "components/content_settings/core/common/content_settings_types.h" 131 #include "components/content_settings/core/common/content_settings_types.h"
131 #include "components/dom_distiller/core/dom_distiller_switches.h" 132 #include "components/dom_distiller/core/dom_distiller_switches.h"
132 #include "components/dom_distiller/core/url_constants.h" 133 #include "components/dom_distiller/core/url_constants.h"
133 #include "components/error_page/common/error_page_switches.h" 134 #include "components/error_page/common/error_page_switches.h"
(...skipping 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 2576
2576 // chrome: & friends. 2577 // chrome: & friends.
2577 handler->AddHandlerPair(&HandleWebUI, &HandleWebUIReverse); 2578 handler->AddHandlerPair(&HandleWebUI, &HandleWebUIReverse);
2578 } 2579 }
2579 2580
2580 void ChromeContentBrowserClient::ClearCache(RenderFrameHost* rfh) { 2581 void ChromeContentBrowserClient::ClearCache(RenderFrameHost* rfh) {
2581 Profile* profile = Profile::FromBrowserContext( 2582 Profile* profile = Profile::FromBrowserContext(
2582 rfh->GetSiteInstance()->GetProcess()->GetBrowserContext()); 2583 rfh->GetSiteInstance()->GetProcess()->GetBrowserContext());
2583 BrowsingDataRemover* remover = 2584 BrowsingDataRemover* remover =
2584 BrowsingDataRemoverFactory::GetForBrowserContext(profile); 2585 BrowsingDataRemoverFactory::GetForBrowserContext(profile);
2585 remover->Remove(BrowsingDataRemover::Unbounded(), 2586 remover->Remove(base::Time(), base::Time::Max(),
2586 BrowsingDataRemover::REMOVE_CACHE, 2587 BrowsingDataRemover::REMOVE_CACHE,
2587 BrowsingDataHelper::UNPROTECTED_WEB); 2588 BrowsingDataHelper::UNPROTECTED_WEB);
2588 } 2589 }
2589 2590
2590 void ChromeContentBrowserClient::ClearCookies(RenderFrameHost* rfh) { 2591 void ChromeContentBrowserClient::ClearCookies(RenderFrameHost* rfh) {
2591 Profile* profile = Profile::FromBrowserContext( 2592 Profile* profile = Profile::FromBrowserContext(
2592 rfh->GetSiteInstance()->GetProcess()->GetBrowserContext()); 2593 rfh->GetSiteInstance()->GetProcess()->GetBrowserContext());
2593 BrowsingDataRemover* remover = 2594 BrowsingDataRemover* remover =
2594 BrowsingDataRemoverFactory::GetForBrowserContext(profile); 2595 BrowsingDataRemoverFactory::GetForBrowserContext(profile);
2595 int remove_mask = BrowsingDataRemover::REMOVE_SITE_DATA; 2596 int remove_mask = BrowsingDataRemover::REMOVE_SITE_DATA;
2596 remover->Remove(BrowsingDataRemover::Unbounded(), remove_mask, 2597 remover->Remove(base::Time(), base::Time::Max(), remove_mask,
2597 BrowsingDataHelper::UNPROTECTED_WEB); 2598 BrowsingDataHelper::UNPROTECTED_WEB);
2598 } 2599 }
2599 2600
2600 void ChromeContentBrowserClient::ClearSiteData( 2601 void ChromeContentBrowserClient::ClearSiteData(
2601 content::BrowserContext* browser_context, 2602 content::BrowserContext* browser_context,
2602 const url::Origin& origin, 2603 const url::Origin& origin,
2603 bool remove_cookies, 2604 bool remove_cookies,
2604 bool remove_storage, 2605 bool remove_storage,
2605 bool remove_cache, 2606 bool remove_cache,
2606 const base::Closure& callback) { 2607 const base::Closure& callback) {
(...skipping 17 matching lines...) Expand all
2624 2625
2625 if (domain.empty()) 2626 if (domain.empty())
2626 domain = origin.host(); // IP address or internal hostname. 2627 domain = origin.host(); // IP address or internal hostname.
2627 2628
2628 std::unique_ptr<RegistrableDomainFilterBuilder> domain_filter_builder( 2629 std::unique_ptr<RegistrableDomainFilterBuilder> domain_filter_builder(
2629 new RegistrableDomainFilterBuilder( 2630 new RegistrableDomainFilterBuilder(
2630 BrowsingDataFilterBuilder::WHITELIST)); 2631 BrowsingDataFilterBuilder::WHITELIST));
2631 domain_filter_builder->AddRegisterableDomain(domain); 2632 domain_filter_builder->AddRegisterableDomain(domain);
2632 2633
2633 remover->RemoveWithFilterAndReply( 2634 remover->RemoveWithFilterAndReply(
2634 BrowsingDataRemover::Period(browsing_data::TimePeriod::ALL_TIME), 2635 base::Time(), base::Time::Max(),
2635 BrowsingDataRemover::REMOVE_COOKIES | 2636 BrowsingDataRemover::REMOVE_COOKIES |
2636 BrowsingDataRemover::REMOVE_CHANNEL_IDS | 2637 BrowsingDataRemover::REMOVE_CHANNEL_IDS |
2637 BrowsingDataRemover::REMOVE_PLUGIN_DATA, 2638 BrowsingDataRemover::REMOVE_PLUGIN_DATA,
2638 BrowsingDataHelper::ALL, std::move(domain_filter_builder), observer); 2639 BrowsingDataHelper::ALL, std::move(domain_filter_builder), observer);
2639 } else { 2640 } else {
2640 // The first removal task is a no-op. 2641 // The first removal task is a no-op.
2641 observer->OnBrowsingDataRemoverDone(); 2642 observer->OnBrowsingDataRemoverDone();
2642 } 2643 }
2643 2644
2644 // Delete origin-scoped data. 2645 // Delete origin-scoped data.
2645 int remove_mask = 0; 2646 int remove_mask = 0;
2646 if (remove_storage) { 2647 if (remove_storage) {
2647 remove_mask |= BrowsingDataRemover::REMOVE_SITE_DATA & 2648 remove_mask |= BrowsingDataRemover::REMOVE_SITE_DATA &
2648 ~BrowsingDataRemover::REMOVE_COOKIES & 2649 ~BrowsingDataRemover::REMOVE_COOKIES &
2649 ~BrowsingDataRemover::REMOVE_CHANNEL_IDS & 2650 ~BrowsingDataRemover::REMOVE_CHANNEL_IDS &
2650 ~BrowsingDataRemover::REMOVE_PLUGIN_DATA; 2651 ~BrowsingDataRemover::REMOVE_PLUGIN_DATA;
2651 } 2652 }
2652 if (remove_cache) 2653 if (remove_cache)
2653 remove_mask |= BrowsingDataRemover::REMOVE_CACHE; 2654 remove_mask |= BrowsingDataRemover::REMOVE_CACHE;
2654 2655
2655 if (remove_mask) { 2656 if (remove_mask) {
2656 std::unique_ptr<OriginFilterBuilder> origin_filter_builder( 2657 std::unique_ptr<OriginFilterBuilder> origin_filter_builder(
2657 new OriginFilterBuilder(BrowsingDataFilterBuilder::WHITELIST)); 2658 new OriginFilterBuilder(BrowsingDataFilterBuilder::WHITELIST));
2658 origin_filter_builder->AddOrigin(origin); 2659 origin_filter_builder->AddOrigin(origin);
2659 2660
2660 remover->RemoveWithFilterAndReply( 2661 remover->RemoveWithFilterAndReply(
2661 BrowsingDataRemover::Period(browsing_data::TimePeriod::ALL_TIME), 2662 base::Time(), base::Time::Max(),
2662 remove_mask, BrowsingDataHelper::ALL, std::move(origin_filter_builder), 2663 remove_mask, BrowsingDataHelper::ALL, std::move(origin_filter_builder),
2663 observer); 2664 observer);
2664 } else { 2665 } else {
2665 // The second removal task is a no-op. 2666 // The second removal task is a no-op.
2666 observer->OnBrowsingDataRemoverDone(); 2667 observer->OnBrowsingDataRemoverDone();
2667 } 2668 }
2668 } 2669 }
2669 2670
2670 base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { 2671 base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
2671 return DownloadPrefs::GetDefaultDownloadDirectory(); 2672 return DownloadPrefs::GetDefaultDownloadDirectory();
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
3375 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { 3376 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() {
3376 return variations::GetVariationParamValue( 3377 return variations::GetVariationParamValue(
3377 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; 3378 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true";
3378 } 3379 }
3379 3380
3380 bool ChromeContentBrowserClient:: 3381 bool ChromeContentBrowserClient::
3381 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { 3382 RedirectNonUINonIOBrowserThreadsToTaskScheduler() {
3382 return variations::GetVariationParamValue( 3383 return variations::GetVariationParamValue(
3383 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; 3384 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true";
3384 } 3385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698