| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 FactoryForMedia(Profile* profile, | 443 FactoryForMedia(Profile* profile, |
| 444 const FilePath& disk_cache_path, | 444 const FilePath& disk_cache_path, |
| 445 int cache_size, | 445 int cache_size, |
| 446 bool off_the_record) | 446 bool off_the_record) |
| 447 : ChromeURLRequestContextFactory(profile), | 447 : ChromeURLRequestContextFactory(profile), |
| 448 main_context_getter_( | 448 main_context_getter_( |
| 449 static_cast<ChromeURLRequestContextGetter*>( | 449 static_cast<ChromeURLRequestContextGetter*>( |
| 450 profile->GetRequestContext())), | 450 profile->GetRequestContext())), |
| 451 disk_cache_path_(disk_cache_path), | 451 disk_cache_path_(disk_cache_path), |
| 452 cache_size_(cache_size) { | 452 cache_size_(cache_size) { |
| 453 is_media_ = true; | |
| 454 is_off_the_record_ = off_the_record; | 453 is_off_the_record_ = off_the_record; |
| 455 } | 454 } |
| 456 | 455 |
| 457 virtual ChromeURLRequestContext* Create(); | 456 virtual ChromeURLRequestContext* Create(); |
| 458 | 457 |
| 459 private: | 458 private: |
| 460 scoped_refptr<ChromeURLRequestContextGetter> main_context_getter_; | 459 scoped_refptr<ChromeURLRequestContextGetter> main_context_getter_; |
| 461 | 460 |
| 462 FilePath disk_cache_path_; | 461 FilePath disk_cache_path_; |
| 463 int cache_size_; | 462 int cache_size_; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 // Note that CookieStore is refcounted, yet we do not add a reference. | 759 // Note that CookieStore is refcounted, yet we do not add a reference. |
| 761 *result = GetURLRequestContext()->cookie_store(); | 760 *result = GetURLRequestContext()->cookie_store(); |
| 762 completion->Signal(); | 761 completion->Signal(); |
| 763 } | 762 } |
| 764 | 763 |
| 765 // ---------------------------------------------------------------------------- | 764 // ---------------------------------------------------------------------------- |
| 766 // ChromeURLRequestContext | 765 // ChromeURLRequestContext |
| 767 // ---------------------------------------------------------------------------- | 766 // ---------------------------------------------------------------------------- |
| 768 | 767 |
| 769 ChromeURLRequestContext::ChromeURLRequestContext() | 768 ChromeURLRequestContext::ChromeURLRequestContext() |
| 770 : is_media_(false), | 769 : is_off_the_record_(false) { |
| 771 is_off_the_record_(false) { | |
| 772 CheckCurrentlyOnIOThread(); | 770 CheckCurrentlyOnIOThread(); |
| 773 } | 771 } |
| 774 | 772 |
| 775 ChromeURLRequestContext::~ChromeURLRequestContext() { | 773 ChromeURLRequestContext::~ChromeURLRequestContext() { |
| 776 CheckCurrentlyOnIOThread(); | 774 CheckCurrentlyOnIOThread(); |
| 777 | 775 |
| 778 if (appcache_service_.get() && appcache_service_->request_context() == this) | 776 if (appcache_service_.get() && appcache_service_->request_context() == this) |
| 779 appcache_service_->set_request_context(NULL); | 777 appcache_service_->set_request_context(NULL); |
| 780 | 778 |
| 781 if (proxy_service_ && | 779 if (proxy_service_ && |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 | 834 |
| 837 // ---------------------------------------------------------------------------- | 835 // ---------------------------------------------------------------------------- |
| 838 // ChromeURLRequestContextFactory | 836 // ChromeURLRequestContextFactory |
| 839 // ---------------------------------------------------------------------------- | 837 // ---------------------------------------------------------------------------- |
| 840 | 838 |
| 841 // Extract values from |profile| and copy them into | 839 // Extract values from |profile| and copy them into |
| 842 // ChromeURLRequestContextFactory. We will use them later when constructing the | 840 // ChromeURLRequestContextFactory. We will use them later when constructing the |
| 843 // ChromeURLRequestContext on the IO thread (see | 841 // ChromeURLRequestContext on the IO thread (see |
| 844 // ApplyProfileParametersToContext() which reverses this). | 842 // ApplyProfileParametersToContext() which reverses this). |
| 845 ChromeURLRequestContextFactory::ChromeURLRequestContextFactory(Profile* profile) | 843 ChromeURLRequestContextFactory::ChromeURLRequestContextFactory(Profile* profile) |
| 846 : is_media_(false), | 844 : is_off_the_record_(profile->IsOffTheRecord()), |
| 847 is_off_the_record_(profile->IsOffTheRecord()), | |
| 848 io_thread_(g_browser_process->io_thread()) { | 845 io_thread_(g_browser_process->io_thread()) { |
| 849 CheckCurrentlyOnMainThread(); | 846 CheckCurrentlyOnMainThread(); |
| 850 PrefService* prefs = profile->GetPrefs(); | 847 PrefService* prefs = profile->GetPrefs(); |
| 851 | 848 |
| 852 // Set up Accept-Language and Accept-Charset header values | 849 // Set up Accept-Language and Accept-Charset header values |
| 853 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( | 850 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( |
| 854 prefs->GetString(prefs::kAcceptLanguages)); | 851 prefs->GetString(prefs::kAcceptLanguages)); |
| 855 std::string default_charset = prefs->GetString(prefs::kDefaultCharset); | 852 std::string default_charset = prefs->GetString(prefs::kDefaultCharset); |
| 856 accept_charset_ = | 853 accept_charset_ = |
| 857 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); | 854 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 } | 887 } |
| 891 | 888 |
| 892 ChromeURLRequestContextFactory::~ChromeURLRequestContextFactory() { | 889 ChromeURLRequestContextFactory::~ChromeURLRequestContextFactory() { |
| 893 CheckCurrentlyOnIOThread(); | 890 CheckCurrentlyOnIOThread(); |
| 894 } | 891 } |
| 895 | 892 |
| 896 void ChromeURLRequestContextFactory::ApplyProfileParametersToContext( | 893 void ChromeURLRequestContextFactory::ApplyProfileParametersToContext( |
| 897 ChromeURLRequestContext* context) { | 894 ChromeURLRequestContext* context) { |
| 898 // Apply all the parameters. NOTE: keep this in sync with | 895 // Apply all the parameters. NOTE: keep this in sync with |
| 899 // ChromeURLRequestContextFactory(Profile*). | 896 // ChromeURLRequestContextFactory(Profile*). |
| 900 context->set_is_media(is_media_); | |
| 901 context->set_is_off_the_record(is_off_the_record_); | 897 context->set_is_off_the_record(is_off_the_record_); |
| 902 context->set_accept_language(accept_language_); | 898 context->set_accept_language(accept_language_); |
| 903 context->set_accept_charset(accept_charset_); | 899 context->set_accept_charset(accept_charset_); |
| 904 context->set_referrer_charset(referrer_charset_); | 900 context->set_referrer_charset(referrer_charset_); |
| 905 context->set_user_script_dir_path(user_script_dir_path_); | 901 context->set_user_script_dir_path(user_script_dir_path_); |
| 906 context->set_host_content_settings_map(host_content_settings_map_); | 902 context->set_host_content_settings_map(host_content_settings_map_); |
| 907 context->set_host_zoom_map(host_zoom_map_); | 903 context->set_host_zoom_map(host_zoom_map_); |
| 908 context->set_transport_security_state( | 904 context->set_transport_security_state( |
| 909 transport_security_state_); | 905 transport_security_state_); |
| 910 context->set_ssl_config_service(ssl_config_service_); | 906 context->set_ssl_config_service(ssl_config_service_); |
| 911 context->set_appcache_service(appcache_service_); | 907 context->set_appcache_service(appcache_service_); |
| 912 context->set_database_tracker(database_tracker_); | 908 context->set_database_tracker(database_tracker_); |
| 913 context->set_blob_storage_context(blob_storage_context_); | 909 context->set_blob_storage_context(blob_storage_context_); |
| 914 context->set_file_system_context(file_system_context_); | 910 context->set_file_system_context(file_system_context_); |
| 915 context->set_extension_info_map(extension_info_map_); | 911 context->set_extension_info_map(extension_info_map_); |
| 916 context->set_prerender_manager(prerender_manager_); | 912 context->set_prerender_manager(prerender_manager_); |
| 917 } | 913 } |
| OLD | NEW |