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

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: 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 "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(
451 new BlobProtocolHandler(blob_storage_context,
452 partition->GetFileSystemContext()));
453 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
454 file_system_protocol_handler(
455 CreateFileSystemProtocolHandler(partition->GetFileSystemContext()));
456 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 450 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
457 developer_protocol_handler( 451 developer_protocol_handler(
458 new DeveloperProtocolHandler(partition->GetAppCacheService(), 452 new DeveloperProtocolHandler(partition->GetAppCacheService(),
459 blob_storage_context)); 453 blob_storage_context));
460 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 454
461 chrome_protocol_handler( 455 ProtocolHandlerMap protocol_handlers;
456 protocol_handlers[chrome::kBlobScheme] =
457 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
458 new BlobProtocolHandler(blob_storage_context,
459 partition->GetFileSystemContext()));
460 protocol_handlers[chrome::kFileSystemScheme] =
461 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
462 CreateFileSystemProtocolHandler(partition->GetFileSystemContext()));
463 protocol_handlers[chrome::kChromeUIScheme] =
464 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
462 URLDataManagerBackend::CreateProtocolHandler( 465 URLDataManagerBackend::CreateProtocolHandler(
463 browser_context_->GetResourceContext(), 466 browser_context_->GetResourceContext(),
464 browser_context_->IsOffTheRecord())); 467 browser_context_->IsOffTheRecord()));
465 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 468 std::vector<std::string> additional_webui_schemes =
466 chrome_devtools_protocol_handler( 469 GetContentClient()->browser()->GetAdditionalWebUISchemes();
470 for (std::vector<std::string>::const_iterator it =
471 additional_webui_schemes.begin();
472 it != additional_webui_schemes.end();
473 ++it) {
474 protocol_handlers[*it] =
475 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
476 URLDataManagerBackend::CreateProtocolHandler(
477 browser_context_->GetResourceContext(),
478 browser_context_->IsOffTheRecord()));
479 }
480 protocol_handlers[chrome::kChromeDevToolsScheme] =
481 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
467 CreateDevToolsProtocolHandler(browser_context_->GetResourceContext(), 482 CreateDevToolsProtocolHandler(browser_context_->GetResourceContext(),
468 browser_context_->IsOffTheRecord())); 483 browser_context_->IsOffTheRecord()));
469 484
470 // These calls must happen after StoragePartitionImpl::Create(). 485 // These calls must happen after StoragePartitionImpl::Create().
471 if (partition_domain.empty()) { 486 if (partition_domain.empty()) {
472 partition->SetURLRequestContext( 487 partition->SetURLRequestContext(
473 GetContentClient()->browser()->CreateRequestContext(browser_context_, 488 GetContentClient()->browser()->CreateRequestContext(browser_context_,
474 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), 489 developer_protocol_handler.Pass(), &protocol_handlers));
475 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
476 chrome_devtools_protocol_handler.Pass()));
477 } else { 490 } else {
478 partition->SetURLRequestContext( 491 partition->SetURLRequestContext(
479 GetContentClient()->browser()->CreateRequestContextForStoragePartition( 492 GetContentClient()->browser()->CreateRequestContextForStoragePartition(
480 browser_context_, partition->GetPath(), in_memory, 493 browser_context_, partition->GetPath(), in_memory,
481 blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), 494 developer_protocol_handler.Pass(), &protocol_handlers));
482 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
483 chrome_devtools_protocol_handler.Pass()));
484 } 495 }
485 partition->SetMediaURLRequestContext( 496 partition->SetMediaURLRequestContext(
486 partition_domain.empty() ? 497 partition_domain.empty() ?
487 browser_context_->GetMediaRequestContext() : 498 browser_context_->GetMediaRequestContext() :
488 browser_context_->GetMediaRequestContextForStoragePartition( 499 browser_context_->GetMediaRequestContextForStoragePartition(
489 partition->GetPath(), in_memory)); 500 partition->GetPath(), in_memory));
490 501
491 PostCreateInitialization(partition, in_memory); 502 PostCreateInitialization(partition, in_memory);
492 503
493 return partition; 504 return partition;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 613
603 // We do not call InitializeURLRequestContext() for media contexts because, 614 // We do not call InitializeURLRequestContext() for media contexts because,
604 // other than the HTTP cache, the media contexts share the same backing 615 // other than the HTTP cache, the media contexts share the same backing
605 // objects as their associated "normal" request context. Thus, the previous 616 // objects as their associated "normal" request context. Thus, the previous
606 // call serves to initialize the media request context for this storage 617 // call serves to initialize the media request context for this storage
607 // partition as well. 618 // partition as well.
608 } 619 }
609 } 620 }
610 621
611 } // namespace content 622 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698