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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 2245733004: Serve offline page for online URL on disconnected or bad networks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment in test Created 4 years, 3 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/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "net/http/http_cache.h" 62 #include "net/http/http_cache.h"
63 #include "net/http/http_network_session.h" 63 #include "net/http/http_network_session.h"
64 #include "net/http/http_server_properties_manager.h" 64 #include "net/http/http_server_properties_manager.h"
65 #include "net/sdch/sdch_owner.h" 65 #include "net/sdch/sdch_owner.h"
66 #include "net/ssl/channel_id_service.h" 66 #include "net/ssl/channel_id_service.h"
67 #include "net/url_request/url_request_intercepting_job_factory.h" 67 #include "net/url_request/url_request_intercepting_job_factory.h"
68 #include "net/url_request/url_request_job_factory_impl.h" 68 #include "net/url_request/url_request_job_factory_impl.h"
69 #include "storage/browser/quota/special_storage_policy.h" 69 #include "storage/browser/quota/special_storage_policy.h"
70 70
71 #if defined(OS_ANDROID) 71 #if defined(OS_ANDROID)
72 #include "chrome/browser/android/offline_pages/offline_page_request_handler.h" 72 #include "chrome/browser/android/offline_pages/offline_page_request_interceptor. h"
73 #endif // defined(OS_ANDROID) 73 #endif // defined(OS_ANDROID)
74 74
75 namespace { 75 namespace {
76 76
77 net::BackendType ChooseCacheBackendType() { 77 net::BackendType ChooseCacheBackendType() {
78 #if !defined(OS_ANDROID) 78 #if !defined(OS_ANDROID)
79 const base::CommandLine& command_line = 79 const base::CommandLine& command_line =
80 *base::CommandLine::ForCurrentProcess(); 80 *base::CommandLine::ForCurrentProcess();
81 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { 81 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) {
82 const std::string opt_value = 82 const std::string opt_value =
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 ftp_factory_.reset( 525 ftp_factory_.reset(
526 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); 526 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get()));
527 #endif // !defined(DISABLE_FTP_SUPPORT) 527 #endif // !defined(DISABLE_FTP_SUPPORT)
528 528
529 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory( 529 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
530 new net::URLRequestJobFactoryImpl()); 530 new net::URLRequestJobFactoryImpl());
531 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); 531 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
532 532
533 // Install the Offline Page Interceptor. 533 // Install the Offline Page Interceptor.
534 #if defined(OS_ANDROID) 534 #if defined(OS_ANDROID)
535 std::unique_ptr<net::URLRequestInterceptor> offline_page_interceptor = 535 request_interceptors.push_back(std::unique_ptr<net::URLRequestInterceptor>(
536 offline_pages::OfflinePageRequestHandler::CreateInterceptor( 536 new offline_pages::OfflinePageRequestInterceptor(
537 profile_params->profile); 537 profile_params->profile)));
538 if (offline_page_interceptor)
539 request_interceptors.push_back(std::move(offline_page_interceptor));
540 #endif 538 #endif
541 539
542 // The data reduction proxy interceptor should be as close to the network 540 // The data reduction proxy interceptor should be as close to the network
543 // as possible. 541 // as possible.
544 request_interceptors.insert( 542 request_interceptors.insert(
545 request_interceptors.begin(), 543 request_interceptors.begin(),
546 data_reduction_proxy_io_data()->CreateInterceptor().release()); 544 data_reduction_proxy_io_data()->CreateInterceptor().release());
547 main_job_factory_ = SetUpJobFactoryDefaults( 545 main_job_factory_ = SetUpJobFactoryDefaults(
548 std::move(main_job_factory), std::move(request_interceptors), 546 std::move(main_job_factory), std::move(request_interceptors),
549 std::move(profile_params->protocol_handler_interceptor), 547 std::move(profile_params->protocol_handler_interceptor),
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 const base::Closure& completion) { 792 const base::Closure& completion) {
795 DCHECK_CURRENTLY_ON(BrowserThread::IO); 793 DCHECK_CURRENTLY_ON(BrowserThread::IO);
796 DCHECK(initialized()); 794 DCHECK(initialized());
797 795
798 DCHECK(transport_security_state()); 796 DCHECK(transport_security_state());
799 // Completes synchronously. 797 // Completes synchronously.
800 transport_security_state()->DeleteAllDynamicDataSince(time); 798 transport_security_state()->DeleteAllDynamicDataSince(time);
801 DCHECK(http_server_properties_manager_); 799 DCHECK(http_server_properties_manager_);
802 http_server_properties_manager_->Clear(completion); 800 http_server_properties_manager_->Clear(completion);
803 } 801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698