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

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Charlie's comments. Created 7 years, 9 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) 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 extensions::kExtensionScheme, 421 extensions::kExtensionScheme,
422 chrome::kChromeUIScheme, 422 chrome::kChromeUIScheme,
423 chrome::kChromeDevToolsScheme, 423 chrome::kChromeDevToolsScheme,
424 #if defined(OS_CHROMEOS) 424 #if defined(OS_CHROMEOS)
425 chrome::kMetadataScheme, 425 chrome::kMetadataScheme,
426 chrome::kDriveScheme, 426 chrome::kDriveScheme,
427 #endif // defined(OS_CHROMEOS) 427 #endif // defined(OS_CHROMEOS)
428 chrome::kBlobScheme, 428 chrome::kBlobScheme,
429 chrome::kFileSystemScheme, 429 chrome::kFileSystemScheme,
430 chrome::kExtensionResourceScheme, 430 chrome::kExtensionResourceScheme,
431 chrome::kChromeSearchScheme,
431 }; 432 };
432 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { 433 for (size_t i = 0; i < arraysize(kProtocolList); ++i) {
433 if (scheme == kProtocolList[i]) 434 if (scheme == kProtocolList[i])
434 return true; 435 return true;
435 } 436 }
436 return net::URLRequest::IsHandledProtocol(scheme); 437 return net::URLRequest::IsHandledProtocol(scheme);
437 } 438 }
438 439
439 bool ProfileIOData::IsHandledURL(const GURL& url) { 440 bool ProfileIOData::IsHandledURL(const GURL& url) {
440 if (!url.is_valid()) { 441 if (!url.is_valid()) {
(...skipping 24 matching lines...) Expand all
465 DCHECK(initialized_); 466 DCHECK(initialized_);
466 return extensions_request_context_.get(); 467 return extensions_request_context_.get();
467 } 468 }
468 469
469 ChromeURLRequestContext* ProfileIOData::GetIsolatedAppRequestContext( 470 ChromeURLRequestContext* ProfileIOData::GetIsolatedAppRequestContext(
470 ChromeURLRequestContext* main_context, 471 ChromeURLRequestContext* main_context,
471 const StoragePartitionDescriptor& partition_descriptor, 472 const StoragePartitionDescriptor& partition_descriptor,
472 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> 473 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
473 protocol_handler_interceptor, 474 protocol_handler_interceptor,
474 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 475 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
475 blob_protocol_handler,
476 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
477 file_system_protocol_handler,
478 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
479 developer_protocol_handler, 476 developer_protocol_handler,
480 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 477 content::ProtocolHandlerMap* protocol_handlers) const {
481 chrome_protocol_handler,
482 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
483 chrome_devtools_protocol_handler) const {
484 DCHECK(initialized_); 478 DCHECK(initialized_);
485 ChromeURLRequestContext* context = NULL; 479 ChromeURLRequestContext* context = NULL;
486 if (ContainsKey(app_request_context_map_, partition_descriptor)) { 480 if (ContainsKey(app_request_context_map_, partition_descriptor)) {
487 context = app_request_context_map_[partition_descriptor]; 481 context = app_request_context_map_[partition_descriptor];
488 } else { 482 } else {
489 context = AcquireIsolatedAppRequestContext( 483 context = AcquireIsolatedAppRequestContext(
490 main_context, partition_descriptor, protocol_handler_interceptor.Pass(), 484 main_context, partition_descriptor, protocol_handler_interceptor.Pass(),
491 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), 485 developer_protocol_handler.Pass(), protocol_handlers);
492 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
493 chrome_devtools_protocol_handler.Pass());
494 app_request_context_map_[partition_descriptor] = context; 486 app_request_context_map_[partition_descriptor] = context;
495 } 487 }
496 DCHECK(context); 488 DCHECK(context);
497 return context; 489 return context;
498 } 490 }
499 491
500 ChromeURLRequestContext* ProfileIOData::GetIsolatedMediaRequestContext( 492 ChromeURLRequestContext* ProfileIOData::GetIsolatedMediaRequestContext(
501 ChromeURLRequestContext* app_context, 493 ChromeURLRequestContext* app_context,
502 const StoragePartitionDescriptor& partition_descriptor) const { 494 const StoragePartitionDescriptor& partition_descriptor) const {
503 DCHECK(initialized_); 495 DCHECK(initialized_);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 // The SSL session cache is partitioned by setting a string. This returns a 587 // The SSL session cache is partitioned by setting a string. This returns a
596 // unique string to partition the SSL session cache. Each time we create a 588 // unique string to partition the SSL session cache. Each time we create a
597 // new profile, we'll get a fresh SSL session cache which is separate from 589 // new profile, we'll get a fresh SSL session cache which is separate from
598 // the other profiles. 590 // the other profiles.
599 static unsigned ssl_session_cache_instance = 0; 591 static unsigned ssl_session_cache_instance = 0;
600 return StringPrintf("profile/%u", ssl_session_cache_instance++); 592 return StringPrintf("profile/%u", ssl_session_cache_instance++);
601 } 593 }
602 594
603 void ProfileIOData::Init( 595 void ProfileIOData::Init(
604 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 596 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
605 blob_protocol_handler,
606 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
607 file_system_protocol_handler,
608 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
609 developer_protocol_handler, 597 developer_protocol_handler,
610 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 598 content::ProtocolHandlerMap* protocol_handlers) const {
611 chrome_protocol_handler,
612 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
613 chrome_devtools_protocol_handler) const {
614 // The basic logic is implemented here. The specific initialization 599 // The basic logic is implemented here. The specific initialization
615 // is done in InitializeInternal(), implemented by subtypes. Static helper 600 // is done in InitializeInternal(), implemented by subtypes. Static helper
616 // functions have been provided to assist in common operations. 601 // functions have been provided to assist in common operations.
617 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 602 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
618 DCHECK(!initialized_); 603 DCHECK(!initialized_);
619 604
620 startup_metric_utils::ScopedSlowStartupUMA 605 startup_metric_utils::ScopedSlowStartupUMA
621 scoped_timer("Startup.SlowStartupProfileIODataInit"); 606 scoped_timer("Startup.SlowStartupProfileIODataInit");
622 607
623 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. 608 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 if (profile_params_->resource_prefetch_predictor_observer_.get()) { 671 if (profile_params_->resource_prefetch_predictor_observer_.get()) {
687 resource_prefetch_predictor_observer_.reset( 672 resource_prefetch_predictor_observer_.reset(
688 profile_params_->resource_prefetch_predictor_observer_.release()); 673 profile_params_->resource_prefetch_predictor_observer_.release());
689 } 674 }
690 675
691 #if defined(ENABLE_MANAGED_USERS) 676 #if defined(ENABLE_MANAGED_USERS)
692 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; 677 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter;
693 #endif 678 #endif
694 679
695 InitializeInternal(profile_params_.get(), 680 InitializeInternal(profile_params_.get(),
696 blob_protocol_handler.Pass(),
697 file_system_protocol_handler.Pass(),
698 developer_protocol_handler.Pass(), 681 developer_protocol_handler.Pass(),
699 chrome_protocol_handler.Pass(), 682 protocol_handlers);
700 chrome_devtools_protocol_handler.Pass());
701 683
702 profile_params_.reset(); 684 profile_params_.reset();
703 initialized_ = true; 685 initialized_ = true;
704 } 686 }
705 687
706 void ProfileIOData::ApplyProfileParamsToContext( 688 void ProfileIOData::ApplyProfileParamsToContext(
707 ChromeURLRequestContext* context) const { 689 ChromeURLRequestContext* context) const {
708 context->set_http_user_agent_settings( 690 context->set_http_user_agent_settings(
709 chrome_http_user_agent_settings_.get()); 691 chrome_http_user_agent_settings_.get());
710 context->set_ssl_config_service(profile_params_->ssl_config_service); 692 context->set_ssl_config_service(profile_params_->ssl_config_service);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 void ProfileIOData::SetCookieSettingsForTesting( 820 void ProfileIOData::SetCookieSettingsForTesting(
839 CookieSettings* cookie_settings) { 821 CookieSettings* cookie_settings) {
840 DCHECK(!cookie_settings_.get()); 822 DCHECK(!cookie_settings_.get());
841 cookie_settings_ = cookie_settings; 823 cookie_settings_ = cookie_settings;
842 } 824 }
843 825
844 void ProfileIOData::set_signin_names_for_testing( 826 void ProfileIOData::set_signin_names_for_testing(
845 SigninNamesOnIOThread* signin_names) { 827 SigninNamesOnIOThread* signin_names) {
846 signin_names_.reset(signin_names); 828 signin_names_.reset(signin_names);
847 } 829 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698