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

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

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed whitespaces in mac files 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) 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 io_thread_globals->http_auth_handler_factory.get()); 373 io_thread_globals->http_auth_handler_factory.get());
374 374
375 return context; 375 return context;
376 } 376 }
377 377
378 // Factory that creates the ChromeURLRequestContext for incognito profile. 378 // Factory that creates the ChromeURLRequestContext for incognito profile.
379 class FactoryForOffTheRecord : public ChromeURLRequestContextFactory { 379 class FactoryForOffTheRecord : public ChromeURLRequestContextFactory {
380 public: 380 public:
381 explicit FactoryForOffTheRecord(Profile* profile) 381 explicit FactoryForOffTheRecord(Profile* profile)
382 : ChromeURLRequestContextFactory(profile), 382 : ChromeURLRequestContextFactory(profile),
383 proxy_config_service_(CreateProxyConfigService(profile)),
383 original_context_getter_( 384 original_context_getter_(
384 static_cast<ChromeURLRequestContextGetter*>( 385 static_cast<ChromeURLRequestContextGetter*>(
385 profile->GetOriginalProfile()->GetRequestContext())) { 386 profile->GetOriginalProfile()->GetRequestContext())) {
386 } 387 }
387 388
388 virtual ChromeURLRequestContext* Create(); 389 virtual ChromeURLRequestContext* Create();
389 390
390 private: 391 private:
392 scoped_ptr<net::ProxyConfigService> proxy_config_service_;
391 scoped_refptr<ChromeURLRequestContextGetter> original_context_getter_; 393 scoped_refptr<ChromeURLRequestContextGetter> original_context_getter_;
392 }; 394 };
393 395
394 ChromeURLRequestContext* FactoryForOffTheRecord::Create() { 396 ChromeURLRequestContext* FactoryForOffTheRecord::Create() {
395 ChromeURLRequestContext* context = new ChromeURLRequestContext; 397 ChromeURLRequestContext* context = new ChromeURLRequestContext;
396 ApplyProfileParametersToContext(context); 398 ApplyProfileParametersToContext(context);
397 399
398 ChromeURLRequestContext* original_context = 400 ChromeURLRequestContext* original_context =
399 original_context_getter_->GetIOContext(); 401 original_context_getter_->GetIOContext();
400 402
401 IOThread::Globals* io_thread_globals = io_thread()->globals(); 403 IOThread::Globals* io_thread_globals = io_thread()->globals();
402 404
403 // Share the same proxy service, host resolver, cert verifier, 405 // Share the same proxy service, host resolver, cert verifier,
404 // and http_auth_handler_factory as the original profile. 406 // and http_auth_handler_factory as the original profile.
405 context->set_host_resolver(original_context->host_resolver()); 407 context->set_host_resolver(original_context->host_resolver());
406 context->set_cert_verifier(original_context->cert_verifier()); 408 context->set_cert_verifier(original_context->cert_verifier());
407 context->set_proxy_service(original_context->proxy_service()); 409 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
410 context->set_proxy_service(
411 CreateProxyService(io_thread()->net_log(),
412 io_thread_globals->proxy_script_fetcher_context.get(),
413 proxy_config_service_.release(),
414 command_line));
408 context->set_http_auth_handler_factory( 415 context->set_http_auth_handler_factory(
409 original_context->http_auth_handler_factory()); 416 original_context->http_auth_handler_factory());
410 417
411 net::HttpCache::BackendFactory* backend = 418 net::HttpCache::BackendFactory* backend =
412 net::HttpCache::DefaultBackend::InMemory(0); 419 net::HttpCache::DefaultBackend::InMemory(0);
413 420
414 net::HttpCache* cache = 421 net::HttpCache* cache =
415 new net::HttpCache(context->host_resolver(), 422 new net::HttpCache(context->host_resolver(),
416 context->cert_verifier(), 423 context->cert_verifier(),
417 context->dnsrr_resolver(), 424 context->dnsrr_resolver(),
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 context->set_transport_security_state( 911 context->set_transport_security_state(
905 transport_security_state_); 912 transport_security_state_);
906 context->set_ssl_config_service(ssl_config_service_); 913 context->set_ssl_config_service(ssl_config_service_);
907 context->set_appcache_service(appcache_service_); 914 context->set_appcache_service(appcache_service_);
908 context->set_database_tracker(database_tracker_); 915 context->set_database_tracker(database_tracker_);
909 context->set_blob_storage_context(blob_storage_context_); 916 context->set_blob_storage_context(blob_storage_context_);
910 context->set_file_system_context(file_system_context_); 917 context->set_file_system_context(file_system_context_);
911 context->set_extension_info_map(extension_info_map_); 918 context->set_extension_info_map(extension_info_map_);
912 context->set_prerender_manager(prerender_manager_); 919 context->set_prerender_manager(prerender_manager_);
913 } 920 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698