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

Side by Side Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 6338002: net: Remove typedef net::URLRequestContext URLRequestContext; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for real Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 g_browser_process->file_thread()->message_loop()); 86 g_browser_process->file_thread()->message_loop());
87 #endif // defined(OS_CHROMEOS) 87 #endif // defined(OS_CHROMEOS)
88 88
89 return new PrefProxyConfigService(profile->GetProxyConfigTracker(), 89 return new PrefProxyConfigService(profile->GetProxyConfigTracker(),
90 base_service); 90 base_service);
91 } 91 }
92 92
93 // Create a proxy service according to the options on command line. 93 // Create a proxy service according to the options on command line.
94 net::ProxyService* CreateProxyService( 94 net::ProxyService* CreateProxyService(
95 net::NetLog* net_log, 95 net::NetLog* net_log,
96 URLRequestContext* context, 96 net::URLRequestContext* context,
97 net::ProxyConfigService* proxy_config_service, 97 net::ProxyConfigService* proxy_config_service,
98 const CommandLine& command_line) { 98 const CommandLine& command_line) {
99 CheckCurrentlyOnIOThread(); 99 CheckCurrentlyOnIOThread();
100 100
101 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); 101 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver);
102 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { 102 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) {
103 // See the note about V8 multithreading in net/proxy/proxy_resolver_v8.h 103 // See the note about V8 multithreading in net/proxy/proxy_resolver_v8.h
104 // to understand why we have this limitation. 104 // to understand why we have this limitation.
105 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; 105 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode.";
106 use_v8 = false; // Fallback to non-v8 implementation. 106 use_v8 = false; // Fallback to non-v8 implementation.
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // If a base profile was specified, listen for changes to the preferences. 541 // If a base profile was specified, listen for changes to the preferences.
542 if (profile) 542 if (profile)
543 RegisterPrefsObserver(profile); 543 RegisterPrefsObserver(profile);
544 } 544 }
545 545
546 ChromeURLRequestContextGetter::~ChromeURLRequestContextGetter() { 546 ChromeURLRequestContextGetter::~ChromeURLRequestContextGetter() {
547 CheckCurrentlyOnIOThread(); 547 CheckCurrentlyOnIOThread();
548 548
549 DCHECK(registrar_.IsEmpty()) << "Probably didn't call CleanupOnUIThread"; 549 DCHECK(registrar_.IsEmpty()) << "Probably didn't call CleanupOnUIThread";
550 550
551 // Either we already transformed the factory into a URLRequestContext, or 551 // Either we already transformed the factory into a net::URLRequestContext, or
552 // we still have a pending factory. 552 // we still have a pending factory.
553 DCHECK((factory_.get() && !url_request_context_.get()) || 553 DCHECK((factory_.get() && !url_request_context_.get()) ||
554 (!factory_.get() && url_request_context_.get())); 554 (!factory_.get() && url_request_context_.get()));
555 555
556 if (url_request_context_) 556 if (url_request_context_)
557 io_thread_->UnregisterURLRequestContextGetter(this); 557 io_thread_->UnregisterURLRequestContextGetter(this);
558 558
559 // The scoped_refptr / scoped_ptr destructors take care of releasing 559 // The scoped_refptr / scoped_ptr destructors take care of releasing
560 // |factory_| and |url_request_context_| now. 560 // |factory_| and |url_request_context_| now.
561 } 561 }
562 562
563 // Lazily create a ChromeURLRequestContext using our factory. 563 // Lazily create a ChromeURLRequestContext using our factory.
564 URLRequestContext* ChromeURLRequestContextGetter::GetURLRequestContext() { 564 net::URLRequestContext* ChromeURLRequestContextGetter::GetURLRequestContext() {
565 CheckCurrentlyOnIOThread(); 565 CheckCurrentlyOnIOThread();
566 566
567 if (!url_request_context_) { 567 if (!url_request_context_) {
568 DCHECK(factory_.get()); 568 DCHECK(factory_.get());
569 url_request_context_ = factory_->Create(); 569 url_request_context_ = factory_->Create();
570 if (is_main()) { 570 if (is_main()) {
571 url_request_context_->set_is_main(true); 571 url_request_context_->set_is_main(true);
572 #if defined(USE_NSS) 572 #if defined(USE_NSS)
573 // TODO(ukai): find a better way to set the URLRequestContext for OCSP. 573 // TODO(ukai): find a better way to set the net::URLRequestContext for
574 // OCSP.
574 net::SetURLRequestContextForOCSP(url_request_context_); 575 net::SetURLRequestContextForOCSP(url_request_context_);
575 #endif 576 #endif
576 } 577 }
577 578
578 factory_.reset(); 579 factory_.reset();
579 io_thread_->RegisterURLRequestContextGetter(this); 580 io_thread_->RegisterURLRequestContextGetter(this);
580 } 581 }
581 582
582 return url_request_context_; 583 return url_request_context_;
583 } 584 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 780
780 if (proxy_service_ && 781 if (proxy_service_ &&
781 proxy_service_->GetProxyScriptFetcher() && 782 proxy_service_->GetProxyScriptFetcher() &&
782 proxy_service_->GetProxyScriptFetcher()->GetRequestContext() == this) { 783 proxy_service_->GetProxyScriptFetcher()->GetRequestContext() == this) {
783 // Remove the ProxyScriptFetcher's weak reference to this context. 784 // Remove the ProxyScriptFetcher's weak reference to this context.
784 proxy_service_->SetProxyScriptFetcher(NULL); 785 proxy_service_->SetProxyScriptFetcher(NULL);
785 } 786 }
786 787
787 #if defined(USE_NSS) 788 #if defined(USE_NSS)
788 if (is_main()) { 789 if (is_main()) {
789 URLRequestContext* ocsp_context = net::GetURLRequestContextForOCSP(); 790 net::URLRequestContext* ocsp_context = net::GetURLRequestContextForOCSP();
790 if (ocsp_context) { 791 if (ocsp_context) {
791 DCHECK_EQ(this, ocsp_context); 792 DCHECK_EQ(this, ocsp_context);
792 // We are releasing the URLRequestContext used by OCSP handlers. 793 // We are releasing the net::URLRequestContext used by OCSP handlers.
793 net::SetURLRequestContextForOCSP(NULL); 794 net::SetURLRequestContextForOCSP(NULL);
794 } 795 }
795 } 796 }
796 #endif 797 #endif
797 798
798 NotificationService::current()->Notify( 799 NotificationService::current()->Notify(
799 NotificationType::URL_REQUEST_CONTEXT_RELEASED, 800 NotificationType::URL_REQUEST_CONTEXT_RELEASED,
800 Source<URLRequestContext>(this), 801 Source<net::URLRequestContext>(this),
801 NotificationService::NoDetails()); 802 NotificationService::NoDetails());
802 803
803 delete ftp_transaction_factory_; 804 delete ftp_transaction_factory_;
804 delete http_transaction_factory_; 805 delete http_transaction_factory_;
805 806
806 // cookie_policy_'s lifetime is auto-managed by chrome_cookie_policy_. We 807 // cookie_policy_'s lifetime is auto-managed by chrome_cookie_policy_. We
807 // null this out here to avoid a dangling reference to chrome_cookie_policy_ 808 // null this out here to avoid a dangling reference to chrome_cookie_policy_
808 // when ~URLRequestContext runs. 809 // when ~net::URLRequestContext runs.
809 cookie_policy_ = NULL; 810 cookie_policy_ = NULL;
810 } 811 }
811 812
812 const std::string& ChromeURLRequestContext::GetUserAgent( 813 const std::string& ChromeURLRequestContext::GetUserAgent(
813 const GURL& url) const { 814 const GURL& url) const {
814 return webkit_glue::GetUserAgent(url); 815 return webkit_glue::GetUserAgent(url);
815 } 816 }
816 817
817 bool ChromeURLRequestContext::IsExternal() const { 818 bool ChromeURLRequestContext::IsExternal() const {
818 return false; 819 return false;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 context->set_transport_security_state( 908 context->set_transport_security_state(
908 transport_security_state_); 909 transport_security_state_);
909 context->set_ssl_config_service(ssl_config_service_); 910 context->set_ssl_config_service(ssl_config_service_);
910 context->set_appcache_service(appcache_service_); 911 context->set_appcache_service(appcache_service_);
911 context->set_database_tracker(database_tracker_); 912 context->set_database_tracker(database_tracker_);
912 context->set_blob_storage_context(blob_storage_context_); 913 context->set_blob_storage_context(blob_storage_context_);
913 context->set_file_system_context(file_system_context_); 914 context->set_file_system_context(file_system_context_);
914 context->set_extension_info_map(extension_info_map_); 915 context->set_extension_info_map(extension_info_map_);
915 context->set_prerender_manager(prerender_manager_); 916 context->set_prerender_manager(prerender_manager_);
916 } 917 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698