| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/metro_viewer/chrome_metro_viewer_process_host_aurawin.h
" | 5 #include "chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h
" |
| 6 | 6 |
| 7 #include "ash/display/display_info.h" | 7 #include "ash/display/display_info.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/host/ash_remote_window_tree_host_win.h" | 9 #include "ash/host/ash_remote_window_tree_host_win.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 DVLOG(1) << "No GPU access, attempting to restart in Desktop\n"; | 113 DVLOG(1) << "No GPU access, attempting to restart in Desktop\n"; |
| 114 chrome::AttemptRestartToDesktopMode(); | 114 chrome::AttemptRestartToDesktopMode(); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ChromeMetroViewerProcessHost::OnSetTargetSurface( | 118 void ChromeMetroViewerProcessHost::OnSetTargetSurface( |
| 119 gfx::NativeViewId target_surface, | 119 gfx::NativeViewId target_surface, |
| 120 float device_scale) { | 120 float device_scale) { |
| 121 HWND hwnd = reinterpret_cast<HWND>(target_surface); | 121 HWND hwnd = reinterpret_cast<HWND>(target_surface); |
| 122 | 122 |
| 123 // Make hwnd available as early as possible for proper InputMethod | 123 gfx::InitDeviceScaleFactor(device_scale); |
| 124 // initialization. | 124 chrome::OpenAsh(hwnd); |
| 125 ash::AshRemoteWindowTreeHostWin::Init(); | 125 DCHECK(aura::RemoteWindowTreeHostWin::Instance()); |
| 126 aura::RemoteWindowTreeHostWin::Instance()-> | 126 DCHECK_EQ(hwnd, aura::RemoteWindowTreeHostWin::Instance()->remote_window()); |
| 127 InitializeRemoteWindowAndScaleFactor(hwnd, device_scale); | |
| 128 | |
| 129 // Now start the Ash shell environment. | |
| 130 chrome::OpenAsh(); | |
| 131 ash::Shell::GetInstance()->CreateShelf(); | 127 ash::Shell::GetInstance()->CreateShelf(); |
| 132 ash::Shell::GetInstance()->ShowShelf(); | 128 ash::Shell::GetInstance()->ShowShelf(); |
| 133 | 129 |
| 134 // Tell our root window host that the viewer has connected. | 130 // Tell our root window host that the viewer has connected. |
| 135 aura::RemoteWindowTreeHostWin::Instance()->Connected(this); | 131 aura::RemoteWindowTreeHostWin::Instance()->Connected(this); |
| 136 | 132 |
| 137 // On Windows 8 ASH we default to SHOW_STATE_MAXIMIZED for the browser | 133 // On Windows 8 ASH we default to SHOW_STATE_MAXIMIZED for the browser |
| 138 // window. This is to ensure that we honor metro app conventions by default. | 134 // window. This is to ensure that we honor metro app conventions by default. |
| 139 ash::WindowPositioner::SetMaximizeFirstWindow(true); | 135 ash::WindowPositioner::SetMaximizeFirstWindow(true); |
| 140 // Tell the rest of Chrome that Ash is running. | 136 // Tell the rest of Chrome that Ash is running. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 159 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, | 155 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, |
| 160 uint32 height) { | 156 uint32 height) { |
| 161 std::vector<ash::DisplayInfo> info_list; | 157 std::vector<ash::DisplayInfo> info_list; |
| 162 info_list.push_back(ash::DisplayInfo::CreateFromSpec( | 158 info_list.push_back(ash::DisplayInfo::CreateFromSpec( |
| 163 base::StringPrintf("%dx%d*%f", width, height, gfx::GetDPIScale()))); | 159 base::StringPrintf("%dx%d*%f", width, height, gfx::GetDPIScale()))); |
| 164 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( | 160 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( |
| 165 info_list); | 161 info_list); |
| 166 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, | 162 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, |
| 167 height); | 163 height); |
| 168 } | 164 } |
| OLD | NEW |