| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 shell->GetConnector()->Connect(¶ms), | 399 shell->GetConnector()->Connect(¶ms), |
| 400 std::move(shell_client_request)); | 400 std::move(shell_client_request)); |
| 401 browser_context->SetUserData(kMojoShellConnection, connection_holder); | 401 browser_context->SetUserData(kMojoShellConnection, connection_holder); |
| 402 | 402 |
| 403 BrowserShellConnection* connection = connection_holder->shell_connection(); | 403 BrowserShellConnection* connection = connection_holder->shell_connection(); |
| 404 | 404 |
| 405 // New embedded application factories should be added to |connection| here. | 405 // New embedded application factories should be added to |connection| here. |
| 406 | 406 |
| 407 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 407 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 408 switches::kMojoLocalStorage)) { | 408 switches::kMojoLocalStorage)) { |
| 409 connection->AddEmbeddedApplication( | 409 MojoApplicationInfo info; |
| 410 user_service::kUserServiceName, | 410 info.application_factory = base::Bind( |
| 411 base::Bind( | 411 &user_service::CreateUserShellClient, |
| 412 &user_service::CreateUserShellClient, | 412 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
| 413 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 413 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); |
| 414 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)), | 414 connection->AddEmbeddedApplication(user_service::kUserServiceName, info); |
| 415 nullptr); | |
| 416 } | 415 } |
| 417 } | 416 } |
| 418 } | 417 } |
| 419 | 418 |
| 420 // static | 419 // static |
| 421 const std::string& BrowserContext::GetMojoUserIdFor( | 420 const std::string& BrowserContext::GetMojoUserIdFor( |
| 422 BrowserContext* browser_context) { | 421 BrowserContext* browser_context) { |
| 423 CHECK(browser_context->GetUserData(kMojoWasInitialized)) | 422 CHECK(browser_context->GetUserData(kMojoWasInitialized)) |
| 424 << "Attempting to get the mojo user id for a BrowserContext that was " | 423 << "Attempting to get the mojo user id for a BrowserContext that was " |
| 425 << "never Initialize()ed."; | 424 << "never Initialize()ed."; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 447 BrowserContext::~BrowserContext() { | 446 BrowserContext::~BrowserContext() { |
| 448 CHECK(GetUserData(kMojoWasInitialized)) | 447 CHECK(GetUserData(kMojoWasInitialized)) |
| 449 << "Attempting to destroy a BrowserContext that never called " | 448 << "Attempting to destroy a BrowserContext that never called " |
| 450 << "Initialize()"; | 449 << "Initialize()"; |
| 451 | 450 |
| 452 if (GetUserData(kDownloadManagerKeyName)) | 451 if (GetUserData(kDownloadManagerKeyName)) |
| 453 GetDownloadManager(this)->Shutdown(); | 452 GetDownloadManager(this)->Shutdown(); |
| 454 } | 453 } |
| 455 | 454 |
| 456 } // namespace content | 455 } // namespace content |
| OLD | NEW |