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 "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 |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); | 39 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); |
40 | 40 |
41 #if defined(USE_AURA) | 41 #if defined(USE_AURA) |
42 wm_state_.reset(new wm::WMState); | 42 wm_state_.reset(new wm::WMState); |
43 #endif | 43 #endif |
44 } | 44 } |
45 | 45 |
46 void ChromeBrowserMainExtraPartsViews::PreCreateThreads() { | 46 void ChromeBrowserMainExtraPartsViews::PreCreateThreads() { |
47 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 47 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
48 display::Screen::SetScreenInstance(views::CreateDesktopScreen()); | 48 // The screen may have already been set in test initialization. |
| 49 if (!display::Screen::GetScreen()) |
| 50 display::Screen::SetScreenInstance(views::CreateDesktopScreen()); |
49 #endif | 51 #endif |
50 } | 52 } |
51 | 53 |
52 void ChromeBrowserMainExtraPartsViews::MojoShellConnectionStarted( | 54 void ChromeBrowserMainExtraPartsViews::MojoShellConnectionStarted( |
53 content::MojoShellConnection* connection) { | 55 content::MojoShellConnection* connection) { |
54 DCHECK(connection); | 56 DCHECK(connection); |
55 #if defined(USE_AURA) | 57 #if defined(USE_AURA) |
56 if (shell::ShellIsRemote()) { | 58 if (shell::ShellIsRemote()) { |
57 // TODO(rockot): Remove the blocking wait for init. | 59 // TODO(rockot): Remove the blocking wait for init. |
58 // http://crbug.com/594852. | 60 // http://crbug.com/594852. |
59 base::RunLoop wait_loop; | 61 base::RunLoop wait_loop; |
60 connection->SetInitializeHandler(wait_loop.QuitClosure()); | 62 connection->SetInitializeHandler(wait_loop.QuitClosure()); |
61 wait_loop.Run(); | 63 wait_loop.Run(); |
62 | 64 |
63 input_device_client_.reset(new ui::InputDeviceClient()); | 65 input_device_client_.reset(new ui::InputDeviceClient()); |
64 ui::mojom::InputDeviceServerPtr server; | 66 ui::mojom::InputDeviceServerPtr server; |
65 connection->GetConnector()->ConnectToInterface("mojo:ui", &server); | 67 connection->GetConnector()->ConnectToInterface("mojo:ui", &server); |
66 input_device_client_->Connect(std::move(server)); | 68 input_device_client_->Connect(std::move(server)); |
67 | 69 |
68 window_manager_connection_ = views::WindowManagerConnection::Create( | 70 window_manager_connection_ = views::WindowManagerConnection::Create( |
69 connection->GetConnector(), connection->GetIdentity(), | 71 connection->GetConnector(), connection->GetIdentity(), |
70 content::BrowserThread::GetTaskRunnerForThread( | 72 content::BrowserThread::GetTaskRunnerForThread( |
71 content::BrowserThread::IO)); | 73 content::BrowserThread::IO)); |
72 } | 74 } |
73 #endif // defined(USE_AURA) | 75 #endif // defined(USE_AURA) |
74 } | 76 } |
OLD | NEW |