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

Side by Side Diff: content/browser/storage_partition_impl_map.cc

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: include nit 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 "content/browser/storage_partition_impl_map.h" 5 #include "content/browser/storage_partition_impl_map.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 base::FilePath partition_path = 440 base::FilePath partition_path =
441 browser_context_->GetPath().Append( 441 browser_context_->GetPath().Append(
442 GetStoragePartitionPath(partition_domain, partition_name)); 442 GetStoragePartitionPath(partition_domain, partition_name));
443 StoragePartitionImpl* partition = 443 StoragePartitionImpl* partition =
444 StoragePartitionImpl::Create(browser_context_, in_memory, 444 StoragePartitionImpl::Create(browser_context_, in_memory,
445 partition_path); 445 partition_path);
446 partitions_[partition_config] = partition; 446 partitions_[partition_config] = partition;
447 447
448 ChromeBlobStorageContext* blob_storage_context = 448 ChromeBlobStorageContext* blob_storage_context =
449 ChromeBlobStorageContext::GetFor(browser_context_); 449 ChromeBlobStorageContext::GetFor(browser_context_);
450 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler( 450 ProtocolHandlerMap protocol_handlers;
451 new BlobProtocolHandler(blob_storage_context, 451 protocol_handlers[chrome::kBlobScheme] =
452 partition->GetFileSystemContext())); 452 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
453 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 453 new BlobProtocolHandler(blob_storage_context,
454 file_system_protocol_handler( 454 partition->GetFileSystemContext()));
455 CreateFileSystemProtocolHandler(partition->GetFileSystemContext())); 455 protocol_handlers[chrome::kFileSystemScheme] =
456 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 456 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
457 developer_protocol_handler( 457 CreateFileSystemProtocolHandler(partition->GetFileSystemContext()));
458 new DeveloperProtocolHandler(partition->GetAppCacheService(), 458 protocol_handlers[chrome::kChromeUIScheme] =
459 blob_storage_context)); 459 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
460 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
461 chrome_protocol_handler(
462 URLDataManagerBackend::CreateProtocolHandler( 460 URLDataManagerBackend::CreateProtocolHandler(
463 browser_context_->GetResourceContext(), 461 browser_context_->GetResourceContext(),
464 browser_context_->IsOffTheRecord())); 462 browser_context_->IsOffTheRecord()));
465 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 463 std::vector<std::string> additional_webui_schemes =
466 chrome_devtools_protocol_handler( 464 GetContentClient()->browser()->GetAdditionalWebUISchemes();
465 for (std::vector<std::string>::const_iterator it =
466 additional_webui_schemes.begin();
467 it != additional_webui_schemes.end();
468 ++it) {
469 protocol_handlers[*it] =
470 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
471 URLDataManagerBackend::CreateProtocolHandler(
472 browser_context_->GetResourceContext(),
473 browser_context_->IsOffTheRecord()));
474 }
475 protocol_handlers[chrome::kChromeDevToolsScheme] =
476 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
467 CreateDevToolsProtocolHandler(browser_context_->GetResourceContext(), 477 CreateDevToolsProtocolHandler(browser_context_->GetResourceContext(),
468 browser_context_->IsOffTheRecord())); 478 browser_context_->IsOffTheRecord()));
469 479
470 // These calls must happen after StoragePartitionImpl::Create(). 480 // These calls must happen after StoragePartitionImpl::Create().
471 if (partition_domain.empty()) { 481 if (partition_domain.empty()) {
472 partition->SetURLRequestContext( 482 partition->SetURLRequestContext(
473 GetContentClient()->browser()->CreateRequestContext(browser_context_, 483 GetContentClient()->browser()->CreateRequestContext(
474 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), 484 browser_context_,
475 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), 485 &protocol_handlers));
476 chrome_devtools_protocol_handler.Pass()));
477 } else { 486 } else {
478 partition->SetURLRequestContext( 487 partition->SetURLRequestContext(
479 GetContentClient()->browser()->CreateRequestContextForStoragePartition( 488 GetContentClient()->browser()->CreateRequestContextForStoragePartition(
480 browser_context_, partition->GetPath(), in_memory, 489 browser_context_, partition->GetPath(), in_memory,
481 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), 490 &protocol_handlers));
482 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
483 chrome_devtools_protocol_handler.Pass()));
484 } 491 }
485 partition->SetMediaURLRequestContext( 492 partition->SetMediaURLRequestContext(
486 partition_domain.empty() ? 493 partition_domain.empty() ?
487 browser_context_->GetMediaRequestContext() : 494 browser_context_->GetMediaRequestContext() :
488 browser_context_->GetMediaRequestContextForStoragePartition( 495 browser_context_->GetMediaRequestContextForStoragePartition(
489 partition->GetPath(), in_memory)); 496 partition->GetPath(), in_memory));
490 497
491 PostCreateInitialization(partition, in_memory); 498 PostCreateInitialization(partition, in_memory);
492 499
493 return partition; 500 return partition;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 609
603 // We do not call InitializeURLRequestContext() for media contexts because, 610 // We do not call InitializeURLRequestContext() for media contexts because,
604 // other than the HTTP cache, the media contexts share the same backing 611 // other than the HTTP cache, the media contexts share the same backing
605 // objects as their associated "normal" request context. Thus, the previous 612 // objects as their associated "normal" request context. Thus, the previous
606 // call serves to initialize the media request context for this storage 613 // call serves to initialize the media request context for this storage
607 // partition as well. 614 // partition as well.
608 } 615 }
609 } 616 }
610 617
611 } // namespace content 618 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698