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

Unified Diff: chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc

Issue 2215353004: content: Let embedders know when MojoShellConnection is initialized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
index e8e44241e9ee75ff8004417503b7dba367b125b8..d897d5de24938f6b1903be7bd892aa4743ad336c 100644
--- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
+++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
@@ -9,6 +9,7 @@
#include "components/constrained_window/constrained_window_views.h"
#if defined(USE_AURA)
+#include "base/run_loop.h"
#include "content/public/common/mojo_shell_connection.h"
#include "services/shell/public/cpp/connector.h"
#include "services/shell/runner/common/client_util.h"
@@ -46,21 +47,24 @@ void ChromeBrowserMainExtraPartsViews::PreCreateThreads() {
#endif
}
-void ChromeBrowserMainExtraPartsViews::PreProfileInit() {
+void ChromeBrowserMainExtraPartsViews::MojoShellConnectionStarted(
+ content::MojoShellConnection* connection) {
+ DCHECK(connection);
#if defined(USE_AURA)
- content::MojoShellConnection* mojo_shell_connection =
- content::MojoShellConnection::GetForProcess();
- if (mojo_shell_connection && shell::ShellIsRemote()) {
+ if (shell::ShellIsRemote()) {
+ // TODO(rockot): Remove the blocking wait for init.
+ // http://crbug.com/594852.
+ base::RunLoop wait_loop;
+ connection->SetInitializeHandler(wait_loop.QuitClosure());
+ wait_loop.Run();
+
input_device_client_.reset(new ui::InputDeviceClient());
ui::mojom::InputDeviceServerPtr server;
- mojo_shell_connection->GetConnector()->ConnectToInterface("mojo:ui",
- &server);
+ connection->GetConnector()->ConnectToInterface("mojo:ui", &server);
input_device_client_->Connect(std::move(server));
window_manager_connection_ = views::WindowManagerConnection::Create(
- mojo_shell_connection->GetConnector(),
- mojo_shell_connection->GetIdentity());
+ connection->GetConnector(), connection->GetIdentity());
}
#endif // defined(USE_AURA)
- ChromeBrowserMainExtraParts::PreProfileInit();
}
« no previous file with comments | « chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h ('k') | content/browser/browser_main_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698