| 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/profiles/profile_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 ChromeURLRequestContext* ProfileIOData::GetIsolatedAppRequestContext( | 469 ChromeURLRequestContext* ProfileIOData::GetIsolatedAppRequestContext( |
| 470 ChromeURLRequestContext* main_context, | 470 ChromeURLRequestContext* main_context, |
| 471 const StoragePartitionDescriptor& partition_descriptor, | 471 const StoragePartitionDescriptor& partition_descriptor, |
| 472 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 472 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 473 protocol_handler_interceptor, | 473 protocol_handler_interceptor, |
| 474 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 474 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 475 blob_protocol_handler, | 475 blob_protocol_handler, |
| 476 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 476 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 477 file_system_protocol_handler, | 477 file_system_protocol_handler, |
| 478 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 478 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 479 developer_protocol_handler, | |
| 480 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 481 chrome_protocol_handler, | 479 chrome_protocol_handler, |
| 482 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 480 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 483 chrome_devtools_protocol_handler) const { | 481 chrome_devtools_protocol_handler) const { |
| 484 DCHECK(initialized_); | 482 DCHECK(initialized_); |
| 485 ChromeURLRequestContext* context = NULL; | 483 ChromeURLRequestContext* context = NULL; |
| 486 if (ContainsKey(app_request_context_map_, partition_descriptor)) { | 484 if (ContainsKey(app_request_context_map_, partition_descriptor)) { |
| 487 context = app_request_context_map_[partition_descriptor]; | 485 context = app_request_context_map_[partition_descriptor]; |
| 488 } else { | 486 } else { |
| 489 context = AcquireIsolatedAppRequestContext( | 487 context = AcquireIsolatedAppRequestContext( |
| 490 main_context, partition_descriptor, protocol_handler_interceptor.Pass(), | 488 main_context, partition_descriptor, protocol_handler_interceptor.Pass(), |
| 491 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), | 489 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), |
| 492 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), | 490 chrome_protocol_handler.Pass(), |
| 493 chrome_devtools_protocol_handler.Pass()); | 491 chrome_devtools_protocol_handler.Pass()); |
| 494 app_request_context_map_[partition_descriptor] = context; | 492 app_request_context_map_[partition_descriptor] = context; |
| 495 } | 493 } |
| 496 DCHECK(context); | 494 DCHECK(context); |
| 497 return context; | 495 return context; |
| 498 } | 496 } |
| 499 | 497 |
| 500 ChromeURLRequestContext* ProfileIOData::GetIsolatedMediaRequestContext( | 498 ChromeURLRequestContext* ProfileIOData::GetIsolatedMediaRequestContext( |
| 501 ChromeURLRequestContext* app_context, | 499 ChromeURLRequestContext* app_context, |
| 502 const StoragePartitionDescriptor& partition_descriptor) const { | 500 const StoragePartitionDescriptor& partition_descriptor) const { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 static unsigned ssl_session_cache_instance = 0; | 597 static unsigned ssl_session_cache_instance = 0; |
| 600 return StringPrintf("profile/%u", ssl_session_cache_instance++); | 598 return StringPrintf("profile/%u", ssl_session_cache_instance++); |
| 601 } | 599 } |
| 602 | 600 |
| 603 void ProfileIOData::Init( | 601 void ProfileIOData::Init( |
| 604 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 602 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 605 blob_protocol_handler, | 603 blob_protocol_handler, |
| 606 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 604 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 607 file_system_protocol_handler, | 605 file_system_protocol_handler, |
| 608 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 606 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 609 developer_protocol_handler, | |
| 610 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
| 611 chrome_protocol_handler, | 607 chrome_protocol_handler, |
| 612 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | 608 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 613 chrome_devtools_protocol_handler) const { | 609 chrome_devtools_protocol_handler) const { |
| 614 // The basic logic is implemented here. The specific initialization | 610 // The basic logic is implemented here. The specific initialization |
| 615 // is done in InitializeInternal(), implemented by subtypes. Static helper | 611 // is done in InitializeInternal(), implemented by subtypes. Static helper |
| 616 // functions have been provided to assist in common operations. | 612 // functions have been provided to assist in common operations. |
| 617 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 613 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 618 DCHECK(!initialized_); | 614 DCHECK(!initialized_); |
| 619 | 615 |
| 620 startup_metric_utils::ScopedSlowStartupUMA | 616 startup_metric_utils::ScopedSlowStartupUMA |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 profile_params_->resource_prefetch_predictor_observer_.release()); | 684 profile_params_->resource_prefetch_predictor_observer_.release()); |
| 689 } | 685 } |
| 690 | 686 |
| 691 #if defined(ENABLE_MANAGED_USERS) | 687 #if defined(ENABLE_MANAGED_USERS) |
| 692 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; | 688 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; |
| 693 #endif | 689 #endif |
| 694 | 690 |
| 695 InitializeInternal(profile_params_.get(), | 691 InitializeInternal(profile_params_.get(), |
| 696 blob_protocol_handler.Pass(), | 692 blob_protocol_handler.Pass(), |
| 697 file_system_protocol_handler.Pass(), | 693 file_system_protocol_handler.Pass(), |
| 698 developer_protocol_handler.Pass(), | |
| 699 chrome_protocol_handler.Pass(), | 694 chrome_protocol_handler.Pass(), |
| 700 chrome_devtools_protocol_handler.Pass()); | 695 chrome_devtools_protocol_handler.Pass()); |
| 701 | 696 |
| 702 profile_params_.reset(); | 697 profile_params_.reset(); |
| 703 initialized_ = true; | 698 initialized_ = true; |
| 704 } | 699 } |
| 705 | 700 |
| 706 void ProfileIOData::ApplyProfileParamsToContext( | 701 void ProfileIOData::ApplyProfileParamsToContext( |
| 707 ChromeURLRequestContext* context) const { | 702 ChromeURLRequestContext* context) const { |
| 708 context->set_http_user_agent_settings( | 703 context->set_http_user_agent_settings( |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 void ProfileIOData::SetCookieSettingsForTesting( | 833 void ProfileIOData::SetCookieSettingsForTesting( |
| 839 CookieSettings* cookie_settings) { | 834 CookieSettings* cookie_settings) { |
| 840 DCHECK(!cookie_settings_.get()); | 835 DCHECK(!cookie_settings_.get()); |
| 841 cookie_settings_ = cookie_settings; | 836 cookie_settings_ = cookie_settings; |
| 842 } | 837 } |
| 843 | 838 |
| 844 void ProfileIOData::set_signin_names_for_testing( | 839 void ProfileIOData::set_signin_names_for_testing( |
| 845 SigninNamesOnIOThread* signin_names) { | 840 SigninNamesOnIOThread* signin_names) { |
| 846 signin_names_.reset(signin_names); | 841 signin_names_.reset(signin_names); |
| 847 } | 842 } |
| OLD | NEW |