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

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

Issue 10310124: Implement a ResourceThrottle for URL overriding in Chrome on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed chromeos build issue + rebase Created 8 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 <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 25 matching lines...) Expand all
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "content/public/browser/render_view_host.h" 37 #include "content/public/browser/render_view_host.h"
38 #include "content/public/browser/resource_context.h" 38 #include "content/public/browser/resource_context.h"
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.
joth 2012/06/13 22:32:49 nit: either move this TODO inside the #if, or spli
mkosiba (inactive) 2012/06/15 11:05:36 Done.
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)
50 #include "content/public/browser/intercept_navigation_resource_throttle.h"
49 #endif 51 #endif
50 52
51 using content::BrowserThread; 53 using content::BrowserThread;
52 using content::RenderViewHost; 54 using content::RenderViewHost;
53 using content::ResourceDispatcherHostLoginDelegate; 55 using content::ResourceDispatcherHostLoginDelegate;
54 using content::ResourceRequestInfo; 56 using content::ResourceRequestInfo;
55 57
56 namespace { 58 namespace {
57 59
58 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) { 60 void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (is_continuation_of_transferred_request) 127 if (is_continuation_of_transferred_request)
126 ChromeURLRequestUserData::Delete(request); 128 ChromeURLRequestUserData::Delete(request);
127 129
128 ChromeURLRequestUserData* user_data = 130 ChromeURLRequestUserData* user_data =
129 ChromeURLRequestUserData::Create(request); 131 ChromeURLRequestUserData::Create(request);
130 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { 132 if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) {
131 user_data->set_is_prerender(true); 133 user_data->set_is_prerender(true);
132 request->set_priority(net::IDLE); 134 request->set_priority(net::IDLE);
133 } 135 }
134 136
137 if (resource_type == ResourceType::MAIN_FRAME) {
135 #if defined(OS_CHROMEOS) 138 #if defined(OS_CHROMEOS)
136 if (resource_type == ResourceType::MAIN_FRAME) {
137 // We check offline first, then check safe browsing so that we still can 139 // We check offline first, then check safe browsing so that we still can
138 // block unsafe site after we remove offline page. 140 // block unsafe site after we remove offline page.
139 throttles->push_back(new OfflineResourceThrottle( 141 throttles->push_back(new OfflineResourceThrottle(
140 child_id, route_id, request, resource_context)); 142 child_id, route_id, request, resource_context));
143 #elif defined(OS_ANDROID)
joth 2012/06/13 22:32:49 again would be tempted to do these as unconnected
mkosiba (inactive) 2012/06/15 11:05:36 No logical reason to not have the 2 throttles toge
144 throttles->push_back(
145 content::InterceptNavigationResourceThrottle::Create(request));
146 #endif
141 } 147 }
142 #endif
143 148
144 AppendChromeMetricsHeaders(request, resource_context, resource_type); 149 AppendChromeMetricsHeaders(request, resource_context, resource_type);
145 150
146 AppendStandardResourceThrottles(request, 151 AppendStandardResourceThrottles(request,
147 resource_context, 152 resource_context,
148 child_id, 153 child_id,
149 route_id, 154 route_id,
150 resource_type, 155 resource_type,
151 throttles); 156 throttles);
152 } 157 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 if (base::Base64Encode(serialized, &hashed)) { 415 if (base::Base64Encode(serialized, &hashed)) {
411 // If successful, swap the header value with the new one. 416 // If successful, swap the header value with the new one.
412 // Note that the list of IDs and the header could be temporarily out of sync 417 // Note that the list of IDs and the header could be temporarily out of sync
413 // if IDs are added as we are recreating the header, but we're OK with those 418 // if IDs are added as we are recreating the header, but we're OK with those
414 // descrepancies. 419 // descrepancies.
415 variation_ids_header_ = hashed; 420 variation_ids_header_ = hashed;
416 } else { 421 } else {
417 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; 422 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized;
418 } 423 }
419 } 424 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698