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 "content/public/browser/browser_context.h" | 5 #include "content/public/browser/browser_context.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 pid_receiver->SetPID(base::GetCurrentProcId()); | 443 pid_receiver->SetPID(base::GetCurrentProcId()); |
444 | 444 |
445 BrowserContextServiceManagerConnectionHolder* connection_holder = | 445 BrowserContextServiceManagerConnectionHolder* connection_holder = |
446 new BrowserContextServiceManagerConnectionHolder( | 446 new BrowserContextServiceManagerConnectionHolder( |
447 service_manager_connection->GetConnector()->Connect(identity), | 447 service_manager_connection->GetConnector()->Connect(identity), |
448 std::move(service_request)); | 448 std::move(service_request)); |
449 browser_context->SetUserData(kServiceManagerConnection, connection_holder); | 449 browser_context->SetUserData(kServiceManagerConnection, connection_holder); |
450 | 450 |
451 ServiceManagerConnection* connection = | 451 ServiceManagerConnection* connection = |
452 connection_holder->service_manager_connection(); | 452 connection_holder->service_manager_connection(); |
| 453 connection->Start(); |
453 | 454 |
454 // New embedded service factories should be added to |connection| here. | 455 // New embedded service factories should be added to |connection| here. |
455 | 456 |
456 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 457 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
457 switches::kMojoLocalStorage)) { | 458 switches::kMojoLocalStorage)) { |
458 ServiceInfo info; | 459 ServiceInfo info; |
459 info.factory = | 460 info.factory = |
460 base::Bind(&file::CreateFileService, | 461 base::Bind(&file::CreateFileService, |
461 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | 462 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
462 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); | 463 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); |
463 connection->AddEmbeddedService(file::mojom::kServiceName, info); | 464 connection->AddEmbeddedService(file::mojom::kServiceName, info); |
464 } | 465 } |
465 | 466 |
466 ContentBrowserClient::StaticServiceMap services; | 467 ContentBrowserClient::StaticServiceMap services; |
467 browser_context->RegisterInProcessServices(&services); | 468 browser_context->RegisterInProcessServices(&services); |
468 for (const auto& entry : services) { | 469 for (const auto& entry : services) { |
469 connection->AddEmbeddedService(entry.first, entry.second); | 470 connection->AddEmbeddedService(entry.first, entry.second); |
470 } | 471 } |
471 connection->Start(); | |
472 } | 472 } |
473 } | 473 } |
474 | 474 |
475 // static | 475 // static |
476 const std::string& BrowserContext::GetServiceUserIdFor( | 476 const std::string& BrowserContext::GetServiceUserIdFor( |
477 BrowserContext* browser_context) { | 477 BrowserContext* browser_context) { |
478 CHECK(browser_context->GetUserData(kMojoWasInitialized)) | 478 CHECK(browser_context->GetUserData(kMojoWasInitialized)) |
479 << "Attempting to get the mojo user id for a BrowserContext that was " | 479 << "Attempting to get the mojo user id for a BrowserContext that was " |
480 << "never Initialize()ed."; | 480 << "never Initialize()ed."; |
481 | 481 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 if (GetUserData(kDownloadManagerKeyName)) | 522 if (GetUserData(kDownloadManagerKeyName)) |
523 GetDownloadManager(this)->Shutdown(); | 523 GetDownloadManager(this)->Shutdown(); |
524 } | 524 } |
525 | 525 |
526 void BrowserContext::ShutdownStoragePartitions() { | 526 void BrowserContext::ShutdownStoragePartitions() { |
527 if (GetUserData(kStoragePartitionMapKeyName)) | 527 if (GetUserData(kStoragePartitionMapKeyName)) |
528 RemoveUserData(kStoragePartitionMapKeyName); | 528 RemoveUserData(kStoragePartitionMapKeyName); |
529 } | 529 } |
530 | 530 |
531 } // namespace content | 531 } // namespace content |
OLD | NEW |