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

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: Created 8 years, 7 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"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/content_settings/host_content_settings_map.h" 12 #include "chrome/browser/content_settings/host_content_settings_map.h"
13 #include "chrome/browser/download/download_request_limiter.h" 13 #include "chrome/browser/download/download_request_limiter.h"
14 #include "chrome/browser/download/download_resource_throttle.h" 14 #include "chrome/browser/download/download_resource_throttle.h"
15 #include "chrome/browser/download/download_util.h" 15 #include "chrome/browser/download/download_util.h"
16 #include "chrome/browser/extensions/user_script_listener.h" 16 #include "chrome/browser/extensions/user_script_listener.h"
17 #include "chrome/browser/external_protocol/external_protocol_handler.h" 17 #include "chrome/browser/external_protocol/external_protocol_handler.h"
18 #include "chrome/browser/google/google_util.h" 18 #include "chrome/browser/google/google_util.h"
19 #include "chrome/browser/instant/instant_loader.h" 19 #include "chrome/browser/instant/instant_loader.h"
20 #include "chrome/browser/net/load_timing_observer.h" 20 #include "chrome/browser/net/load_timing_observer.h"
21 #include "chrome/browser/prerender/prerender_manager.h" 21 #include "chrome/browser/prerender/prerender_manager.h"
22 #include "chrome/browser/prerender/prerender_manager_factory.h" 22 #include "chrome/browser/prerender/prerender_manager_factory.h"
23 #include "chrome/browser/prerender/prerender_tracker.h" 23 #include "chrome/browser/prerender/prerender_tracker.h"
24 #include "chrome/browser/profiles/profile_io_data.h" 24 #include "chrome/browser/profiles/profile_io_data.h"
25 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" 25 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h"
26 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" 26 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h"
27 #include "chrome/browser/renderer_host/transfer_navigation_resource_throttle.h" 27 #include "chrome/browser/renderer_host/transfer_navigation_resource_throttle.h"
28 #include "chrome/browser/renderer_host/should_ignore_navigation_resource_throttl e.h"
28 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
29 #include "chrome/browser/ui/auto_login_prompter.h" 30 #include "chrome/browser/ui/auto_login_prompter.h"
30 #include "chrome/browser/ui/login/login_prompt.h" 31 #include "chrome/browser/ui/login/login_prompt.h"
31 #include "chrome/browser/ui/sync/one_click_signin_helper.h" 32 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
32 #include "chrome/common/chrome_notification_types.h" 33 #include "chrome/common/chrome_notification_types.h"
33 #include "chrome/common/extensions/user_script.h" 34 #include "chrome/common/extensions/user_script.h"
34 #include "chrome/common/metrics/experiments_helper.h" 35 #include "chrome/common/metrics/experiments_helper.h"
35 #include "chrome/common/metrics/proto/chrome_experiments.pb.h" 36 #include "chrome/common/metrics/proto/chrome_experiments.pb.h"
36 #include "chrome/common/render_messages.h" 37 #include "chrome/common/render_messages.h"
37 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 163
163 if (resource_type == ResourceType::MAIN_FRAME) { 164 if (resource_type == ResourceType::MAIN_FRAME) {
164 throttles->push_back(new TransferNavigationResourceThrottle(request)); 165 throttles->push_back(new TransferNavigationResourceThrottle(request));
165 166
166 #if defined(OS_CHROMEOS) 167 #if defined(OS_CHROMEOS)
167 // We check offline first, then check safe browsing so that we still can 168 // We check offline first, then check safe browsing so that we still can
168 // block unsafe site after we remove offline page. 169 // block unsafe site after we remove offline page.
169 throttles->push_back(new OfflineResourceThrottle( 170 throttles->push_back(new OfflineResourceThrottle(
170 child_id, route_id, request, resource_context)); 171 child_id, route_id, request, resource_context));
171 #endif 172 #endif
173
174 #if defined(OS_ANDROID)
175 throttles->push_back(new ShouldIgnoreNavigationResourceThrottle(request));
joth 2012/05/11 15:34:13 this looks like a good point to also make it condi
mkosiba (inactive) 2012/05/15 14:20:23 But we need this in browser mode! It _might_ make
joth 2012/05/15 14:30:43 Yep makes sense. As discussed I was getting mixed
176 #endif
172 } 177 }
173 178
174 AppendChromeMetricsHeaders(request, resource_context, resource_type); 179 AppendChromeMetricsHeaders(request, resource_context, resource_type);
175 180
176 AppendStandardResourceThrottles(request, 181 AppendStandardResourceThrottles(request,
177 resource_context, 182 resource_context,
178 child_id, 183 child_id,
179 route_id, 184 route_id,
180 resource_type, 185 resource_type,
181 throttles); 186 throttles);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (base::Base64Encode(serialized, &hashed)) { 444 if (base::Base64Encode(serialized, &hashed)) {
440 // If successful, swap the header value with the new one. 445 // If successful, swap the header value with the new one.
441 // Note that the list of IDs and the header could be temporarily out of sync 446 // Note that the list of IDs and the header could be temporarily out of sync
442 // if IDs are added as we are recreating the header, but we're OK with those 447 // if IDs are added as we are recreating the header, but we're OK with those
443 // descrepancies. 448 // descrepancies.
444 variation_ids_header_ = hashed; 449 variation_ids_header_ = hashed;
445 } else { 450 } else {
446 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; 451 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized;
447 } 452 }
448 } 453 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698