| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/io_thread.h" | 10 #include "chrome/browser/io_thread.h" |
| 11 #include "chrome/browser/net/chrome_cookie_policy.h" | |
| 12 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/profiles/profile_io_data.h" | 12 #include "chrome/browser/profiles/profile_io_data.h" |
| 14 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 13 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
| 15 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 16 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
| 17 #include "content/common/notification_service.h" | 16 #include "content/common/notification_service.h" |
| 18 #include "net/base/cookie_store.h" | 17 #include "net/base/cookie_store.h" |
| 19 #include "net/ftp/ftp_transaction_factory.h" | 18 #include "net/ftp/ftp_transaction_factory.h" |
| 20 #include "net/http/http_transaction_factory.h" | 19 #include "net/http/http_transaction_factory.h" |
| 21 #include "net/http/http_util.h" | 20 #include "net/http/http_util.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 368 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 370 } | 369 } |
| 371 | 370 |
| 372 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { | 371 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { |
| 373 URLRequestContext::CopyFrom(other); | 372 URLRequestContext::CopyFrom(other); |
| 374 | 373 |
| 375 // Copy ChromeURLRequestContext parameters. | 374 // Copy ChromeURLRequestContext parameters. |
| 376 set_user_script_dir_path(other->user_script_dir_path()); | 375 set_user_script_dir_path(other->user_script_dir_path()); |
| 377 set_appcache_service(other->appcache_service()); | 376 set_appcache_service(other->appcache_service()); |
| 378 set_database_tracker(other->database_tracker()); | 377 set_database_tracker(other->database_tracker()); |
| 379 set_chrome_cookie_policy(other->chrome_cookie_policy_); | |
| 380 set_host_content_settings_map(other->host_content_settings_map()); | 378 set_host_content_settings_map(other->host_content_settings_map()); |
| 381 set_host_zoom_map(other->host_zoom_map_); | 379 set_host_zoom_map(other->host_zoom_map_); |
| 382 set_blob_storage_context(other->blob_storage_context()); | 380 set_blob_storage_context(other->blob_storage_context()); |
| 383 set_file_system_context(other->file_system_context()); | 381 set_file_system_context(other->file_system_context()); |
| 384 set_extension_info_map(other->extension_info_map_); | 382 set_extension_info_map(other->extension_info_map_); |
| 385 set_prerender_manager(other->prerender_manager()); | 383 set_prerender_manager(other->prerender_manager()); |
| 386 // ChromeURLDataManagerBackend is unique per context. | 384 // ChromeURLDataManagerBackend is unique per context. |
| 387 set_is_incognito(other->is_incognito()); | 385 set_is_incognito(other->is_incognito()); |
| 388 } | 386 } |
| 389 | 387 |
| 390 void ChromeURLRequestContext::set_chrome_cookie_policy( | |
| 391 ChromeCookiePolicy* cookie_policy) { | |
| 392 chrome_cookie_policy_ = cookie_policy; // Take a strong reference. | |
| 393 set_cookie_policy(cookie_policy); | |
| 394 } | |
| 395 | |
| 396 ChromeURLDataManagerBackend* | 388 ChromeURLDataManagerBackend* |
| 397 ChromeURLRequestContext::GetChromeURLDataManagerBackend() { | 389 ChromeURLRequestContext::GetChromeURLDataManagerBackend() { |
| 398 if (!chrome_url_data_manager_backend_.get()) | 390 if (!chrome_url_data_manager_backend_.get()) |
| 399 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend()); | 391 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend()); |
| 400 return chrome_url_data_manager_backend_.get(); | 392 return chrome_url_data_manager_backend_.get(); |
| 401 } | 393 } |
| 402 | 394 |
| 403 ChromeURLRequestContext::~ChromeURLRequestContext() { | 395 ChromeURLRequestContext::~ChromeURLRequestContext() { |
| 404 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 396 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 405 | 397 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 net::HttpUtil::GenerateAcceptLanguageHeader(accept_language)); | 432 net::HttpUtil::GenerateAcceptLanguageHeader(accept_language)); |
| 441 } | 433 } |
| 442 | 434 |
| 443 void ChromeURLRequestContext::OnDefaultCharsetChange( | 435 void ChromeURLRequestContext::OnDefaultCharsetChange( |
| 444 const std::string& default_charset) { | 436 const std::string& default_charset) { |
| 445 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 437 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 446 set_referrer_charset(default_charset); | 438 set_referrer_charset(default_charset); |
| 447 set_accept_charset( | 439 set_accept_charset( |
| 448 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset)); | 440 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset)); |
| 449 } | 441 } |
| OLD | NEW |