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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 2025683003: First experimental implementation of the Clear-Site-Data header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/base64.h" 12 #include "base/base64.h"
13 #include "base/guid.h" 13 #include "base/guid.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
16 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/browsing_data/clear_site_data_throttle.h"
Mike West 2016/05/31 05:35:52 All the throttle machinery should be in //content,
msramek 2016/06/01 14:20:41 Done. Moved to content. It actually made some thin
20 #include "chrome/browser/chrome_notification_types.h" 21 #include "chrome/browser/chrome_notification_types.h"
21 #include "chrome/browser/component_updater/component_updater_resource_throttle.h " 22 #include "chrome/browser/component_updater/component_updater_resource_throttle.h "
22 #include "chrome/browser/download/download_request_limiter.h" 23 #include "chrome/browser/download/download_request_limiter.h"
23 #include "chrome/browser/download/download_resource_throttle.h" 24 #include "chrome/browser/download/download_resource_throttle.h"
24 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" 25 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h"
25 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" 26 #include "chrome/browser/net/resource_prefetch_predictor_observer.h"
26 #include "chrome/browser/plugins/plugin_prefs.h" 27 #include "chrome/browser/plugins/plugin_prefs.h"
27 #include "chrome/browser/prerender/prerender_manager.h" 28 #include "chrome/browser/prerender/prerender_manager.h"
28 #include "chrome/browser/prerender/prerender_manager_factory.h" 29 #include "chrome/browser/prerender/prerender_manager_factory.h"
29 #include "chrome/browser/prerender/prerender_resource_throttle.h" 30 #include "chrome/browser/prerender/prerender_resource_throttle.h"
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 } 612 }
612 #endif 613 #endif
613 614
614 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 615 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
615 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { 616 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) {
616 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); 617 throttles->push_back(new prerender::PrerenderResourceThrottle(request));
617 } 618 }
618 619
619 if (ThreadHopResourceThrottle::IsEnabled()) 620 if (ThreadHopResourceThrottle::IsEnabled())
620 throttles->push_back(new ThreadHopResourceThrottle); 621 throttles->push_back(new ThreadHopResourceThrottle);
622
623 // Experimental Clear-Site-Data throttle. Create only for the main frame.
Mike West 2016/05/31 05:35:52 This is fine to start with, but an eventual goal s
msramek 2016/06/01 14:20:41 I removed the condition for now. My intention was
624 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME)
625 throttles->push_back(new ClearSiteDataThrottle(request));
621 } 626 }
622 627
623 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( 628 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource(
624 const GURL& url, const std::string& mime_type) { 629 const GURL& url, const std::string& mime_type) {
625 #if defined(ENABLE_EXTENSIONS) 630 #if defined(ENABLE_EXTENSIONS)
626 // Special-case user scripts to get downloaded instead of viewed. 631 // Special-case user scripts to get downloaded instead of viewed.
627 return extensions::UserScript::IsURLUserScript(url, mime_type); 632 return extensions::UserScript::IsURLUserScript(url, mime_type);
628 #else 633 #else
629 return false; 634 return false;
630 #endif 635 #endif
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data = 842 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data =
838 data_reduction_proxy::DataReductionProxyData::GetData(*request); 843 data_reduction_proxy::DataReductionProxyData::GetData(*request);
839 // DeepCopy the DataReductionProxyData from the URLRequest to prevent the 844 // DeepCopy the DataReductionProxyData from the URLRequest to prevent the
840 // URLRequest and DataReductionProxyData from both having ownership of the 845 // URLRequest and DataReductionProxyData from both having ownership of the
841 // same object. This copy will be shortlived as it will be deep copied again 846 // same object. This copy will be shortlived as it will be deep copied again
842 // when content makes a clone of NavigationData for the UI thread. 847 // when content makes a clone of NavigationData for the UI thread.
843 if (data_reduction_proxy_data) 848 if (data_reduction_proxy_data)
844 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy()); 849 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy());
845 return data; 850 return data;
846 } 851 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698