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

Side by Side 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 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 "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" 5 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h"
6 6
7 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" 7 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
8 #include "chrome/browser/ui/views/chrome_views_delegate.h" 8 #include "chrome/browser/ui/views/chrome_views_delegate.h"
9 #include "components/constrained_window/constrained_window_views.h" 9 #include "components/constrained_window/constrained_window_views.h"
10 10
11 #if defined(USE_AURA) 11 #if defined(USE_AURA)
12 #include "base/run_loop.h"
12 #include "content/public/common/mojo_shell_connection.h" 13 #include "content/public/common/mojo_shell_connection.h"
13 #include "services/shell/public/cpp/connector.h" 14 #include "services/shell/public/cpp/connector.h"
14 #include "services/shell/runner/common/client_util.h" 15 #include "services/shell/runner/common/client_util.h"
15 #include "services/ui/public/cpp/input_devices/input_device_client.h" 16 #include "services/ui/public/cpp/input_devices/input_device_client.h"
16 #include "services/ui/public/interfaces/input_devices/input_device_server.mojom. h" 17 #include "services/ui/public/interfaces/input_devices/input_device_server.mojom. h"
17 #include "ui/display/screen.h" 18 #include "ui/display/screen.h"
18 #include "ui/views/mus/window_manager_connection.h" 19 #include "ui/views/mus/window_manager_connection.h"
19 #include "ui/views/widget/desktop_aura/desktop_screen.h" 20 #include "ui/views/widget/desktop_aura/desktop_screen.h"
20 #include "ui/wm/core/wm_state.h" 21 #include "ui/wm/core/wm_state.h"
21 #endif // defined(USE_AURA) 22 #endif // defined(USE_AURA)
(...skipping 17 matching lines...) Expand all
39 wm_state_.reset(new wm::WMState); 40 wm_state_.reset(new wm::WMState);
40 #endif 41 #endif
41 } 42 }
42 43
43 void ChromeBrowserMainExtraPartsViews::PreCreateThreads() { 44 void ChromeBrowserMainExtraPartsViews::PreCreateThreads() {
44 #if defined(USE_AURA) && !defined(OS_CHROMEOS) 45 #if defined(USE_AURA) && !defined(OS_CHROMEOS)
45 display::Screen::SetScreenInstance(views::CreateDesktopScreen()); 46 display::Screen::SetScreenInstance(views::CreateDesktopScreen());
46 #endif 47 #endif
47 } 48 }
48 49
49 void ChromeBrowserMainExtraPartsViews::PreProfileInit() { 50 void ChromeBrowserMainExtraPartsViews::MojoShellConnectionStarted(
51 content::MojoShellConnection* connection) {
52 DCHECK(connection);
50 #if defined(USE_AURA) 53 #if defined(USE_AURA)
51 content::MojoShellConnection* mojo_shell_connection = 54 if (shell::ShellIsRemote()) {
52 content::MojoShellConnection::GetForProcess(); 55 // TODO(rockot): Remove the blocking wait for init.
53 if (mojo_shell_connection && shell::ShellIsRemote()) { 56 // http://crbug.com/594852.
57 base::RunLoop wait_loop;
58 connection->SetInitializeHandler(wait_loop.QuitClosure());
59 wait_loop.Run();
60
54 input_device_client_.reset(new ui::InputDeviceClient()); 61 input_device_client_.reset(new ui::InputDeviceClient());
55 ui::mojom::InputDeviceServerPtr server; 62 ui::mojom::InputDeviceServerPtr server;
56 mojo_shell_connection->GetConnector()->ConnectToInterface("mojo:ui", 63 connection->GetConnector()->ConnectToInterface("mojo:ui", &server);
57 &server);
58 input_device_client_->Connect(std::move(server)); 64 input_device_client_->Connect(std::move(server));
59 65
60 window_manager_connection_ = views::WindowManagerConnection::Create( 66 window_manager_connection_ = views::WindowManagerConnection::Create(
61 mojo_shell_connection->GetConnector(), 67 connection->GetConnector(), connection->GetIdentity());
62 mojo_shell_connection->GetIdentity());
63 } 68 }
64 #endif // defined(USE_AURA) 69 #endif // defined(USE_AURA)
65 ChromeBrowserMainExtraParts::PreProfileInit();
66 } 70 }
OLDNEW
« 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