| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // connected. | 109 // connected. |
| 110 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1"); | 110 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1"); |
| 111 | 111 |
| 112 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) { | 112 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) { |
| 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 HWND hwnd = reinterpret_cast<HWND>(target_surface); | 121 HWND hwnd = reinterpret_cast<HWND>(target_surface); |
| 121 | 122 |
| 122 // Make hwnd available as early as possible for proper InputMethod | 123 // Make hwnd available as early as possible for proper InputMethod |
| 123 // initialization. | 124 // initialization. |
| 124 ash::AshRemoteWindowTreeHostWin::Init(); | 125 ash::AshRemoteWindowTreeHostWin::Init(); |
| 125 aura::RemoteWindowTreeHostWin::Instance()->SetRemoteWindowHandle(hwnd); | 126 aura::RemoteWindowTreeHostWin::Instance()-> |
| 127 InitializeRemoteWindowAndScaleFactor(hwnd, device_scale); |
| 126 | 128 |
| 127 // Now start the Ash shell environment. | 129 // Now start the Ash shell environment. |
| 128 chrome::OpenAsh(); | 130 chrome::OpenAsh(); |
| 129 ash::Shell::GetInstance()->CreateShelf(); | 131 ash::Shell::GetInstance()->CreateShelf(); |
| 130 ash::Shell::GetInstance()->ShowShelf(); | 132 ash::Shell::GetInstance()->ShowShelf(); |
| 131 | 133 |
| 132 // Tell our root window host that the viewer has connected. | 134 // Tell our root window host that the viewer has connected. |
| 133 aura::RemoteWindowTreeHostWin::Instance()->Connected(this); | 135 aura::RemoteWindowTreeHostWin::Instance()->Connected(this); |
| 134 | 136 |
| 135 // On Windows 8 ASH we default to SHOW_STATE_MAXIMIZED for the browser | 137 // On Windows 8 ASH we default to SHOW_STATE_MAXIMIZED for the browser |
| (...skipping 21 matching lines...) Expand all Loading... |
| 157 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, | 159 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, |
| 158 uint32 height) { | 160 uint32 height) { |
| 159 std::vector<ash::DisplayInfo> info_list; | 161 std::vector<ash::DisplayInfo> info_list; |
| 160 info_list.push_back(ash::DisplayInfo::CreateFromSpec( | 162 info_list.push_back(ash::DisplayInfo::CreateFromSpec( |
| 161 base::StringPrintf("%dx%d*%f", width, height, gfx::GetModernUIScale()))); | 163 base::StringPrintf("%dx%d*%f", width, height, gfx::GetModernUIScale()))); |
| 162 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( | 164 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( |
| 163 info_list); | 165 info_list); |
| 164 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, | 166 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, |
| 165 height); | 167 height); |
| 166 } | 168 } |
| OLD | NEW |