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

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

Issue 2772853002: Fix an issue that OMA download is not intercepted on Android (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTest.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/loader/chrome_resource_dispatcher_host_delegate.h" 5 #include "chrome/browser/loader/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>
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 555 }
556 556
557 // If this isn't a new request, the standard resource throttles have already 557 // If this isn't a new request, the standard resource throttles have already
558 // been added, so no need to add them again. 558 // been added, so no need to add them again.
559 if (is_new_request) { 559 if (is_new_request) {
560 AppendStandardResourceThrottles(request, 560 AppendStandardResourceThrottles(request,
561 resource_context, 561 resource_context,
562 content::RESOURCE_TYPE_MAIN_FRAME, 562 content::RESOURCE_TYPE_MAIN_FRAME,
563 throttles); 563 throttles);
564 #if defined(OS_ANDROID) 564 #if defined(OS_ANDROID)
565 throttles->push_back(
566 base::MakeUnique<InterceptDownloadResourceThrottle>(
567 request, info->GetWebContentsGetterForRequest()));
568 // On Android, forward text/html downloads to OfflinePages backend. 565 // On Android, forward text/html downloads to OfflinePages backend.
569 throttles->push_back( 566 throttles->push_back(
570 base::MakeUnique<offline_pages::downloads::ResourceThrottle>(request)); 567 base::MakeUnique<offline_pages::downloads::ResourceThrottle>(request));
571 #endif 568 #endif
572 } 569 }
570
571 #if defined(OS_ANDROID)
572 // Add the InterceptDownloadResourceThrottle after calling
573 // AppendStandardResourceThrottles so the download will not bypass
574 // safebrowsing checks.
575 if (is_content_initiated) {
576 throttles->push_back(base::MakeUnique<InterceptDownloadResourceThrottle>(
577 request, info->GetWebContentsGetterForRequest()));
578 }
579 #endif
573 } 580 }
574 581
575 ResourceDispatcherHostLoginDelegate* 582 ResourceDispatcherHostLoginDelegate*
576 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( 583 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate(
577 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { 584 net::AuthChallengeInfo* auth_info, net::URLRequest* request) {
578 return CreateLoginPrompt(auth_info, request); 585 return CreateLoginPrompt(auth_info, request);
579 } 586 }
580 587
581 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( 588 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol(
582 const GURL& url, 589 const GURL& url,
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 941 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
935 base::Unretained(this), url, request_loading_time)); 942 base::Unretained(this), url, request_loading_time));
936 return; 943 return;
937 } 944 }
938 945
939 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 946 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
940 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 947 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
941 rappor::SampleDomainAndRegistryFromGURL( 948 rappor::SampleDomainAndRegistryFromGURL(
942 g_browser_process->rappor_service(), metric_name, url); 949 g_browser_process->rappor_service(), metric_name, url);
943 } 950 }
OLDNEW
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698