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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 ServiceManagerConnection* service_manager_connection = | 434 ServiceManagerConnection* service_manager_connection = |
435 ServiceManagerConnection::GetForProcess(); | 435 ServiceManagerConnection::GetForProcess(); |
436 if (service_manager_connection && base::ThreadTaskRunnerHandle::IsSet()) { | 436 if (service_manager_connection && base::ThreadTaskRunnerHandle::IsSet()) { |
437 // NOTE: Many unit tests create a TestBrowserContext without initializing | 437 // NOTE: Many unit tests create a TestBrowserContext without initializing |
438 // Mojo or the global service manager connection. | 438 // Mojo or the global service manager connection. |
439 | 439 |
440 service_manager::mojom::ServicePtr service; | 440 service_manager::mojom::ServicePtr service; |
441 service_manager::mojom::ServiceRequest service_request(&service); | 441 service_manager::mojom::ServiceRequest service_request(&service); |
442 | 442 |
443 service_manager::mojom::PIDReceiverPtr pid_receiver; | 443 service_manager::mojom::PIDReceiverPtr pid_receiver; |
444 service_manager::Connector::ConnectParams params( | 444 service_manager::Identity identity(mojom::kBrowserServiceName, new_id); |
445 service_manager::Identity(mojom::kBrowserServiceName, new_id)); | 445 service_manager_connection->GetConnector()->RegisterService( |
446 params.set_client_process_connection(std::move(service), | 446 identity, std::move(service), mojo::MakeRequest(&pid_receiver)); |
447 mojo::MakeRequest(&pid_receiver)); | |
448 pid_receiver->SetPID(base::GetCurrentProcId()); | 447 pid_receiver->SetPID(base::GetCurrentProcId()); |
449 | 448 |
450 BrowserContextServiceManagerConnectionHolder* connection_holder = | 449 BrowserContextServiceManagerConnectionHolder* connection_holder = |
451 new BrowserContextServiceManagerConnectionHolder( | 450 new BrowserContextServiceManagerConnectionHolder( |
452 service_manager_connection->GetConnector()->Connect(¶ms), | 451 service_manager_connection->GetConnector()->Connect(identity), |
453 std::move(service_request)); | 452 std::move(service_request)); |
454 browser_context->SetUserData(kServiceManagerConnection, connection_holder); | 453 browser_context->SetUserData(kServiceManagerConnection, connection_holder); |
455 | 454 |
456 ServiceManagerConnection* connection = | 455 ServiceManagerConnection* connection = |
457 connection_holder->service_manager_connection(); | 456 connection_holder->service_manager_connection(); |
458 connection->Start(); | 457 connection->Start(); |
459 | 458 |
460 // New embedded service factories should be added to |connection| here. | 459 // New embedded service factories should be added to |connection| here. |
461 // TODO(blundell): Does this belong as a global service rather than per | 460 // TODO(blundell): Does this belong as a global service rather than per |
462 // BrowserContext? | 461 // BrowserContext? |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 if (GetUserData(kDownloadManagerKeyName)) | 527 if (GetUserData(kDownloadManagerKeyName)) |
529 GetDownloadManager(this)->Shutdown(); | 528 GetDownloadManager(this)->Shutdown(); |
530 } | 529 } |
531 | 530 |
532 void BrowserContext::ShutdownStoragePartitions() { | 531 void BrowserContext::ShutdownStoragePartitions() { |
533 if (GetUserData(kStoragePartitionMapKeyName)) | 532 if (GetUserData(kStoragePartitionMapKeyName)) |
534 RemoveUserData(kStoragePartitionMapKeyName); | 533 RemoveUserData(kStoragePartitionMapKeyName); |
535 } | 534 } |
536 | 535 |
537 } // namespace content | 536 } // namespace content |
OLD | NEW |