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

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

Issue 2157143002: Move interface registration to OnConnect in RPH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
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/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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 // static 466 // static
467 BrowserContext* BrowserContext::GetBrowserContextForShellUserId( 467 BrowserContext* BrowserContext::GetBrowserContextForShellUserId(
468 const std::string& user_id) { 468 const std::string& user_id) {
469 auto it = g_user_id_to_context.Get().find(user_id); 469 auto it = g_user_id_to_context.Get().find(user_id);
470 return it != g_user_id_to_context.Get().end() ? it->second : nullptr; 470 return it != g_user_id_to_context.Get().end() ? it->second : nullptr;
471 } 471 }
472 472
473 // static 473 // static
474 shell::Connector* BrowserContext::GetShellConnectorFor( 474 shell::Connector* BrowserContext::GetShellConnectorFor(
475 BrowserContext* browser_context) { 475 BrowserContext* browser_context) {
476 MojoShellConnection* connection = GetMojoShellConnectionFor(browser_context);
477 return connection ? connection->GetConnector() : nullptr;
478 }
479
480 // static
481 MojoShellConnection* BrowserContext::GetMojoShellConnectionFor(
482 BrowserContext* browser_context) {
476 BrowserContextShellConnectionHolder* connection_holder = 483 BrowserContextShellConnectionHolder* connection_holder =
477 static_cast<BrowserContextShellConnectionHolder*>( 484 static_cast<BrowserContextShellConnectionHolder*>(
478 browser_context->GetUserData(kMojoShellConnection)); 485 browser_context->GetUserData(kMojoShellConnection));
479 if (!connection_holder) 486 if (!connection_holder)
480 return nullptr; 487 return nullptr;
481 return connection_holder->shell_connection()->GetConnector(); 488 return connection_holder->shell_connection();
482 } 489 }
483 490
484 BrowserContext::~BrowserContext() { 491 BrowserContext::~BrowserContext() {
485 CHECK(GetUserData(kMojoWasInitialized)) 492 CHECK(GetUserData(kMojoWasInitialized))
486 << "Attempting to destroy a BrowserContext that never called " 493 << "Attempting to destroy a BrowserContext that never called "
487 << "Initialize()"; 494 << "Initialize()";
488 495
489 RemoveBrowserContextFromUserIdMap(this); 496 RemoveBrowserContextFromUserIdMap(this);
490 497
491 if (GetUserData(kDownloadManagerKeyName)) 498 if (GetUserData(kDownloadManagerKeyName))
492 GetDownloadManager(this)->Shutdown(); 499 GetDownloadManager(this)->Shutdown();
493 } 500 }
494 501
495 } // namespace content 502 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698