| 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/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/io_thread.h" | 12 #include "chrome/browser/io_thread.h" |
| 13 #include "chrome/browser/net/cache_stats.h" | 13 #include "chrome/browser/net/load_time_stats.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/profiles/profile_io_data.h" | 16 #include "chrome/browser/profiles/profile_io_data.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
| 21 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
| 22 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
| 23 #include "net/cookies/cookie_store.h" | 23 #include "net/cookies/cookie_store.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 const std::string& default_charset) { | 286 const std::string& default_charset) { |
| 287 GetIOContext()->OnDefaultCharsetChange(default_charset); | 287 GetIOContext()->OnDefaultCharsetChange(default_charset); |
| 288 } | 288 } |
| 289 | 289 |
| 290 // ---------------------------------------------------------------------------- | 290 // ---------------------------------------------------------------------------- |
| 291 // ChromeURLRequestContext | 291 // ChromeURLRequestContext |
| 292 // ---------------------------------------------------------------------------- | 292 // ---------------------------------------------------------------------------- |
| 293 | 293 |
| 294 ChromeURLRequestContext::ChromeURLRequestContext( | 294 ChromeURLRequestContext::ChromeURLRequestContext( |
| 295 ContextType type, | 295 ContextType type, |
| 296 chrome_browser_net::CacheStats* cache_stats) | 296 chrome_browser_net::LoadTimeStats* load_time_stats) |
| 297 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 297 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
| 298 is_incognito_(false), | 298 is_incognito_(false), |
| 299 cache_stats_(cache_stats) { | 299 load_time_stats_(load_time_stats) { |
| 300 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 300 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 301 if (cache_stats_) | 301 if (load_time_stats_) |
| 302 cache_stats_->RegisterURLRequestContext(this, type); | 302 load_time_stats_->RegisterURLRequestContext(this, type); |
| 303 } | 303 } |
| 304 | 304 |
| 305 ChromeURLRequestContext::~ChromeURLRequestContext() { | 305 ChromeURLRequestContext::~ChromeURLRequestContext() { |
| 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 307 if (cache_stats_) | 307 if (load_time_stats_) |
| 308 cache_stats_->UnregisterURLRequestContext(this); | 308 load_time_stats_->UnregisterURLRequestContext(this); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { | 311 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { |
| 312 URLRequestContext::CopyFrom(other); | 312 URLRequestContext::CopyFrom(other); |
| 313 | 313 |
| 314 // Copy ChromeURLRequestContext parameters. | 314 // Copy ChromeURLRequestContext parameters. |
| 315 // ChromeURLDataManagerBackend is unique per context. | 315 // ChromeURLDataManagerBackend is unique per context. |
| 316 set_is_incognito(other->is_incognito()); | 316 set_is_incognito(other->is_incognito()); |
| 317 } | 317 } |
| 318 | 318 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 339 net::HttpUtil::GenerateAcceptLanguageHeader(accept_language)); | 339 net::HttpUtil::GenerateAcceptLanguageHeader(accept_language)); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void ChromeURLRequestContext::OnDefaultCharsetChange( | 342 void ChromeURLRequestContext::OnDefaultCharsetChange( |
| 343 const std::string& default_charset) { | 343 const std::string& default_charset) { |
| 344 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 344 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 345 set_referrer_charset(default_charset); | 345 set_referrer_charset(default_charset); |
| 346 set_accept_charset( | 346 set_accept_charset( |
| 347 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset)); | 347 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset)); |
| 348 } | 348 } |
| OLD | NEW |