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

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

Issue 10946008: Componentize IgnoreNavigationResourceThrottle and add chrome and webview specific implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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 <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 28 matching lines...) Expand all
39 #include "content/public/browser/resource_dispatcher_host.h" 39 #include "content/public/browser/resource_dispatcher_host.h"
40 #include "content/public/browser/resource_request_info.h" 40 #include "content/public/browser/resource_request_info.h"
41 #include "net/base/load_flags.h" 41 #include "net/base/load_flags.h"
42 #include "net/base/ssl_config_service.h" 42 #include "net/base/ssl_config_service.h"
43 #include "net/url_request/url_request.h" 43 #include "net/url_request/url_request.h"
44 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" 44 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
45 45
46 // TODO(oshima): Enable this for other platforms. 46 // TODO(oshima): Enable this for other platforms.
47 #if defined(OS_CHROMEOS) 47 #if defined(OS_CHROMEOS)
48 #include "chrome/browser/renderer_host/offline_resource_throttle.h" 48 #include "chrome/browser/renderer_host/offline_resource_throttle.h"
49 #elif defined(OS_ANDROID)
benm (inactive) 2012/09/19 11:04:04 should this be it's own #if? Doesn't seem like an
mkosiba (inactive) 2012/09/25 18:01:47 Done.
50 #include "chrome/browser/android/chrome_intercept_navigation_resource_throttle.h "
51 using chrome::android::ChromeInterceptNavigationResourceThrottle;
49 #endif 52 #endif
50 53
51 using content::BrowserThread; 54 using content::BrowserThread;
52 using content::RenderViewHost; 55 using content::RenderViewHost;
53 using content::ResourceDispatcherHostLoginDelegate; 56 using content::ResourceDispatcherHostLoginDelegate;
54 using content::ResourceRequestInfo; 57 using content::ResourceRequestInfo;
55 58
56 namespace { 59 namespace {
57 60
58 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) { 61 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (is_continuation_of_transferred_request) 129 if (is_continuation_of_transferred_request)
127 ChromeURLRequestUserData::Delete(request); 130 ChromeURLRequestUserData::Delete(request);
128 131
129 ChromeURLRequestUserData* user_data = 132 ChromeURLRequestUserData* user_data =
130 ChromeURLRequestUserData::Create(request); 133 ChromeURLRequestUserData::Create(request);
131 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { 134 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) {
132 user_data->set_is_prerender(true); 135 user_data->set_is_prerender(true);
133 request->set_priority(net::IDLE); 136 request->set_priority(net::IDLE);
134 } 137 }
135 138
139 if (resource_type == ResourceType::MAIN_FRAME) {
136 #if defined(OS_CHROMEOS) 140 #if defined(OS_CHROMEOS)
137 if (resource_type == ResourceType::MAIN_FRAME) {
138 // We check offline first, then check safe browsing so that we still can 141 // We check offline first, then check safe browsing so that we still can
139 // block unsafe site after we remove offline page. 142 // block unsafe site after we remove offline page.
140 throttles->push_back(new OfflineResourceThrottle( 143 throttles->push_back(new OfflineResourceThrottle(
141 child_id, route_id, request, appcache_service)); 144 child_id, route_id, request, appcache_service));
145 #elif defined(OS_ANDROID)
146 throttles->push_back(ChromeInterceptNavigationResourceThrottle::Create(
147 request));
148 #endif
142 } 149 }
143 #endif
144 150
145 AppendChromeMetricsHeaders(request, resource_context, resource_type); 151 AppendChromeMetricsHeaders(request, resource_context, resource_type);
146 152
147 AppendStandardResourceThrottles(request, 153 AppendStandardResourceThrottles(request,
148 resource_context, 154 resource_context,
149 child_id, 155 child_id,
150 route_id, 156 route_id,
151 resource_type, 157 resource_type,
152 throttles); 158 throttles);
153 159
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 if (base::Base64Encode(serialized, &hashed)) { 450 if (base::Base64Encode(serialized, &hashed)) {
445 // If successful, swap the header value with the new one. 451 // If successful, swap the header value with the new one.
446 // Note that the list of IDs and the header could be temporarily out of sync 452 // Note that the list of IDs and the header could be temporarily out of sync
447 // if IDs are added as the header is recreated. The receiving servers are OK 453 // if IDs are added as the header is recreated. The receiving servers are OK
448 // with such descrepancies. 454 // with such descrepancies.
449 variation_ids_header_ = hashed; 455 variation_ids_header_ = hashed;
450 } else { 456 } else {
451 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; 457 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized;
452 } 458 }
453 } 459 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698