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/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 13649009: Android: Use a ResourceThrottle to intercept GET downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/browser/managed_mode/managed_mode_resource_throttle.h" 54 #include "chrome/browser/managed_mode/managed_mode_resource_throttle.h"
55 #endif 55 #endif
56 56
57 #if defined(USE_SYSTEM_PROTOBUF) 57 #if defined(USE_SYSTEM_PROTOBUF)
58 #include <google/protobuf/repeated_field.h> 58 #include <google/protobuf/repeated_field.h>
59 #else 59 #else
60 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" 60 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
61 #endif 61 #endif
62 62
63 #if defined(OS_ANDROID) 63 #if defined(OS_ANDROID)
64 #include "chrome/browser/android/intercept_download_resource_throttle.h"
64 #include "components/navigation_interception/intercept_navigation_delegate.h" 65 #include "components/navigation_interception/intercept_navigation_delegate.h"
65 #endif 66 #endif
66 67
67 #if defined(OS_CHROMEOS) 68 #if defined(OS_CHROMEOS)
68 #include "chrome/browser/chromeos/login/merge_session_throttle.h" 69 #include "chrome/browser/chromeos/login/merge_session_throttle.h"
69 // TODO(oshima): Enable this for other platforms. 70 // TODO(oshima): Enable this for other platforms.
70 #include "chrome/browser/renderer_host/offline_resource_throttle.h" 71 #include "chrome/browser/renderer_host/offline_resource_throttle.h"
71 #endif 72 #endif
72 73
73 using content::BrowserThread; 74 using content::BrowserThread;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 int child_id, 319 int child_id,
319 int route_id, 320 int route_id,
320 int request_id, 321 int request_id,
321 bool is_content_initiated, 322 bool is_content_initiated,
322 bool must_download, 323 bool must_download,
323 ScopedVector<content::ResourceThrottle>* throttles) { 324 ScopedVector<content::ResourceThrottle>* throttles) {
324 BrowserThread::PostTask( 325 BrowserThread::PostTask(
325 BrowserThread::UI, FROM_HERE, 326 BrowserThread::UI, FROM_HERE,
326 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id)); 327 base::Bind(&NotifyDownloadInitiatedOnUI, child_id, route_id));
327 328
328 // If it's from the web, we don't trust it, so we push the throttle on. 329 // If it's from the web, we don't trust it, so we push the throttle on.
joth 2013/04/05 00:54:45 sure you want your new throttle contained inside t
nilesh 2013/04/05 01:03:38 Earlier this functionality was in DownloadResource
asanka 2013/04/05 16:57:35 That's actually a good question. The DownloadResou
329 if (is_content_initiated) { 330 if (is_content_initiated) {
330 throttles->push_back(new DownloadResourceThrottle( 331 throttles->push_back(new DownloadResourceThrottle(
331 download_request_limiter_, child_id, route_id, request_id, 332 download_request_limiter_, child_id, route_id, request_id,
332 request->method())); 333 request->method()));
334 #if defined(OS_ANDROID)
335 throttles->push_back(
336 new chrome::InterceptDownloadResourceThrottle(
337 request, child_id, route_id, request_id));
338 #endif
333 } 339 }
334 340
335 // If this isn't a new request, we've seen this before and added the standard 341 // If this isn't a new request, we've seen this before and added the standard
336 // resource throttles already so no need to add it again. 342 // resource throttles already so no need to add it again.
337 if (!request->is_pending()) { 343 if (!request->is_pending()) {
338 AppendStandardResourceThrottles(request, 344 AppendStandardResourceThrottles(request,
339 resource_context, 345 resource_context,
340 child_id, 346 child_id,
341 route_id, 347 route_id,
342 ResourceType::MAIN_FRAME, 348 ResourceType::MAIN_FRAME,
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 int child_id, route_id; 631 int child_id, route_id;
626 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && 632 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) &&
627 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( 633 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView(
628 &child_id, &route_id) && 634 &child_id, &route_id) &&
629 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) { 635 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id)) {
630 prerender_tracker_->TryCancel( 636 prerender_tracker_->TryCancel(
631 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME); 637 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME);
632 request->Cancel(); 638 request->Cancel();
633 } 639 }
634 } 640 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698