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

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

Issue 2002433002: Handle online and offline redirects via interceptor and offline scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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/browser/profiles/profile_io_data.cc ('k') | chrome/chrome_browser.gypi » ('j') | 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/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #endif 93 #endif
94 94
95 #if defined(USE_SYSTEM_PROTOBUF) 95 #if defined(USE_SYSTEM_PROTOBUF)
96 #include <google/protobuf/repeated_field.h> 96 #include <google/protobuf/repeated_field.h>
97 #else 97 #else
98 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" 98 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
99 #endif 99 #endif
100 100
101 #if BUILDFLAG(ANDROID_JAVA_UI) 101 #if BUILDFLAG(ANDROID_JAVA_UI)
102 #include "chrome/browser/android/intercept_download_resource_throttle.h" 102 #include "chrome/browser/android/intercept_download_resource_throttle.h"
103 #include "chrome/browser/android/offline_pages/offline_page_request_handler.h"
103 #endif 104 #endif
104 105
105 #if defined(OS_ANDROID) 106 #if defined(OS_ANDROID)
106 #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_an droid.h" 107 #include "chrome/browser/renderer_host/data_reduction_proxy_resource_throttle_an droid.h"
107 #include "components/navigation_interception/intercept_navigation_delegate.h" 108 #include "components/navigation_interception/intercept_navigation_delegate.h"
108 #endif 109 #endif
109 110
110 #if defined(OS_CHROMEOS) 111 #if defined(OS_CHROMEOS)
111 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h " 112 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h "
112 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" 113 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 381
381 // If prefetch is disabled, kill the request. 382 // If prefetch is disabled, kill the request.
382 std::string prefetch_experiment = 383 std::string prefetch_experiment =
383 base::FieldTrialList::FindFullName("Prefetch"); 384 base::FieldTrialList::FindFullName("Prefetch");
384 if (base::StartsWith(prefetch_experiment, "ExperimentDisable", 385 if (base::StartsWith(prefetch_experiment, "ExperimentDisable",
385 base::CompareCase::INSENSITIVE_ASCII)) { 386 base::CompareCase::INSENSITIVE_ASCII)) {
386 return false; 387 return false;
387 } 388 }
388 } 389 }
389 390
391 #if defined(OS_ANDROID)
392 // Offline URL cannot be loaded as non-main resource.
393 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME &&
394 url.SchemeIs(chrome::kOfflinePageScheme)) {
395 return false;
396 }
397 #endif
398
390 return true; 399 return true;
391 } 400 }
392 401
393 void ChromeResourceDispatcherHostDelegate::RequestBeginning( 402 void ChromeResourceDispatcherHostDelegate::RequestBeginning(
394 net::URLRequest* request, 403 net::URLRequest* request,
395 content::ResourceContext* resource_context, 404 content::ResourceContext* resource_context,
396 content::AppCacheService* appcache_service, 405 content::AppCacheService* appcache_service,
397 ResourceType resource_type, 406 ResourceType resource_type,
398 ScopedVector<content::ResourceThrottle>* throttles) { 407 ScopedVector<content::ResourceThrottle>* throttles) {
399 if (safe_browsing_.get()) 408 if (safe_browsing_.get())
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 resource_context, 474 resource_context,
466 resource_type, 475 resource_type,
467 throttles); 476 throttles);
468 } 477 }
469 #endif 478 #endif
470 479
471 if (io_data->resource_prefetch_predictor_observer()) { 480 if (io_data->resource_prefetch_predictor_observer()) {
472 io_data->resource_prefetch_predictor_observer()->OnRequestStarted( 481 io_data->resource_prefetch_predictor_observer()->OnRequestStarted(
473 request, resource_type, info->GetChildID(), info->GetRenderFrameID()); 482 request, resource_type, info->GetChildID(), info->GetRenderFrameID());
474 } 483 }
484
485 #if defined(OS_ANDROID)
486 offline_pages::OfflinePageRequestHandler::InitializeHandler(
487 request, resource_type);
488 #endif
475 } 489 }
476 490
477 void ChromeResourceDispatcherHostDelegate::DownloadStarting( 491 void ChromeResourceDispatcherHostDelegate::DownloadStarting(
478 net::URLRequest* request, 492 net::URLRequest* request,
479 content::ResourceContext* resource_context, 493 content::ResourceContext* resource_context,
480 int child_id, 494 int child_id,
481 int route_id, 495 int route_id,
482 bool is_content_initiated, 496 bool is_content_initiated,
483 bool must_download, 497 bool must_download,
484 ScopedVector<content::ResourceThrottle>* throttles) { 498 ScopedVector<content::ResourceThrottle>* throttles) {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy()); 863 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy());
850 return data; 864 return data;
851 } 865 }
852 866
853 std::unique_ptr<net::ClientCertStore> 867 std::unique_ptr<net::ClientCertStore>
854 ChromeResourceDispatcherHostDelegate::CreateClientCertStore( 868 ChromeResourceDispatcherHostDelegate::CreateClientCertStore(
855 content::ResourceContext* resource_context) { 869 content::ResourceContext* resource_context) {
856 return ProfileIOData::FromResourceContext(resource_context)-> 870 return ProfileIOData::FromResourceContext(resource_context)->
857 CreateClientCertStore(); 871 CreateClientCertStore();
858 } 872 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698