| OLD | NEW |
| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "net/ftp/ftp_network_layer.h" | 58 #include "net/ftp/ftp_network_layer.h" |
| 59 #include "net/http/http_cache.h" | 59 #include "net/http/http_cache.h" |
| 60 #include "net/http/http_network_session.h" | 60 #include "net/http/http_network_session.h" |
| 61 #include "net/http/http_server_properties_manager.h" | 61 #include "net/http/http_server_properties_manager.h" |
| 62 #include "net/sdch/sdch_owner.h" | 62 #include "net/sdch/sdch_owner.h" |
| 63 #include "net/ssl/channel_id_service.h" | 63 #include "net/ssl/channel_id_service.h" |
| 64 #include "net/url_request/url_request_intercepting_job_factory.h" | 64 #include "net/url_request/url_request_intercepting_job_factory.h" |
| 65 #include "net/url_request/url_request_job_factory_impl.h" | 65 #include "net/url_request/url_request_job_factory_impl.h" |
| 66 #include "storage/browser/quota/special_storage_policy.h" | 66 #include "storage/browser/quota/special_storage_policy.h" |
| 67 | 67 |
| 68 #if defined(OS_ANDROID) |
| 69 #include "chrome/browser/android/data_usage/data_use_tab_model.h" |
| 70 #include "chrome/browser/android/data_usage/data_use_ui_tab_model.h" |
| 71 #include "chrome/browser/android/data_usage/data_use_ui_tab_model_factory.h" |
| 72 #include "chrome/browser/android/data_usage/external_data_use_observer.h" |
| 73 #endif // defined(OS_ANDROID) |
| 74 |
| 68 namespace { | 75 namespace { |
| 69 | 76 |
| 70 net::BackendType ChooseCacheBackendType() { | 77 net::BackendType ChooseCacheBackendType() { |
| 71 #if defined(OS_ANDROID) | 78 #if defined(OS_ANDROID) |
| 72 return net::CACHE_BACKEND_SIMPLE; | 79 return net::CACHE_BACKEND_SIMPLE; |
| 73 #else | 80 #else |
| 74 const base::CommandLine& command_line = | 81 const base::CommandLine& command_line = |
| 75 *base::CommandLine::ForCurrentProcess(); | 82 *base::CommandLine::ForCurrentProcess(); |
| 76 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { | 83 if (command_line.HasSwitch(switches::kUseSimpleCacheBackend)) { |
| 77 const std::string opt_value = | 84 const std::string opt_value = |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 226 |
| 220 scoped_refptr<ChromeURLRequestContextGetter> | 227 scoped_refptr<ChromeURLRequestContextGetter> |
| 221 ProfileImplIOData::Handle::CreateMainRequestContextGetter( | 228 ProfileImplIOData::Handle::CreateMainRequestContextGetter( |
| 222 content::ProtocolHandlerMap* protocol_handlers, | 229 content::ProtocolHandlerMap* protocol_handlers, |
| 223 content::URLRequestInterceptorScopedVector request_interceptors, | 230 content::URLRequestInterceptorScopedVector request_interceptors, |
| 224 PrefService* local_state, | 231 PrefService* local_state, |
| 225 IOThread* io_thread) const { | 232 IOThread* io_thread) const { |
| 226 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 233 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 227 LazyInitialize(); | 234 LazyInitialize(); |
| 228 DCHECK(!main_request_context_getter_.get()); | 235 DCHECK(!main_request_context_getter_.get()); |
| 236 |
| 237 #if defined(OS_ANDROID) |
| 238 // Pass the DataUseTabModel weak pointer to DataUseUITabModel. |
| 239 chrome::android::DataUseUITabModel* data_use_ui_tab_model = |
| 240 chrome::android::DataUseUITabModelFactory::GetForBrowserContext(profile_); |
| 241 if (data_use_ui_tab_model && !io_data_->IsOffTheRecord()) { |
| 242 data_use_ui_tab_model->SetIODataUseTabModel( |
| 243 io_thread->data_use_tab_model()); |
| 244 data_use_ui_tab_model->SetUIDataUseTabModel( |
| 245 io_thread->external_data_use_observer() |
| 246 ->data_use_tab_model() |
| 247 ->GetUIWeakPtr()); |
| 248 } |
| 249 #endif // defined(OS_ANDROID) |
| 250 |
| 229 main_request_context_getter_ = ChromeURLRequestContextGetter::Create( | 251 main_request_context_getter_ = ChromeURLRequestContextGetter::Create( |
| 230 profile_, io_data_, protocol_handlers, request_interceptors.Pass()); | 252 profile_, io_data_, protocol_handlers, request_interceptors.Pass()); |
| 231 | 253 |
| 232 io_data_->predictor_ | 254 io_data_->predictor_ |
| 233 ->InitNetworkPredictor(profile_->GetPrefs(), | 255 ->InitNetworkPredictor(profile_->GetPrefs(), |
| 234 local_state, | 256 local_state, |
| 235 io_thread, | 257 io_thread, |
| 236 main_request_context_getter_.get(), | 258 main_request_context_getter_.get(), |
| 237 io_data_); | 259 io_data_); |
| 238 | 260 |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 const base::Closure& completion) { | 812 const base::Closure& completion) { |
| 791 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 813 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 792 DCHECK(initialized()); | 814 DCHECK(initialized()); |
| 793 | 815 |
| 794 DCHECK(transport_security_state()); | 816 DCHECK(transport_security_state()); |
| 795 // Completes synchronously. | 817 // Completes synchronously. |
| 796 transport_security_state()->DeleteAllDynamicDataSince(time); | 818 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 797 DCHECK(http_server_properties_manager_); | 819 DCHECK(http_server_properties_manager_); |
| 798 http_server_properties_manager_->Clear(completion); | 820 http_server_properties_manager_->Clear(completion); |
| 799 } | 821 } |
| OLD | NEW |