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/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/window_positioner.h" | 10 #include "ash/wm/window_positioner.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 void ChromeMetroViewerProcessHost::OnChannelError() { | 75 void ChromeMetroViewerProcessHost::OnChannelError() { |
76 // TODO(cpu): At some point we only close the browser. Right now this | 76 // TODO(cpu): At some point we only close the browser. Right now this |
77 // is very convenient for developing. | 77 // is very convenient for developing. |
78 DVLOG(1) << "viewer channel error : Quitting browser"; | 78 DVLOG(1) << "viewer channel error : Quitting browser"; |
79 | 79 |
80 // Unset environment variable to let breakpad know that metro process wasn't | 80 // Unset environment variable to let breakpad know that metro process wasn't |
81 // connected. | 81 // connected. |
82 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); | 82 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); |
83 | 83 |
84 aura::RemoteRootWindowHostWin::Instance()->Disconnected(); | 84 aura::RemoteWindowTreeHostWin::Instance()->Disconnected(); |
85 g_browser_process->ReleaseModule(); | 85 g_browser_process->ReleaseModule(); |
86 | 86 |
87 // If browser is trying to quit, we shouldn't reenter the process. | 87 // If browser is trying to quit, we shouldn't reenter the process. |
88 // TODO(shrikant): In general there seem to be issues with how AttemptExit | 88 // TODO(shrikant): In general there seem to be issues with how AttemptExit |
89 // reentry works. In future release please clean up related code. | 89 // reentry works. In future release please clean up related code. |
90 if (!browser_shutdown::IsTryingToQuit()) { | 90 if (!browser_shutdown::IsTryingToQuit()) { |
91 CloseOpenAshBrowsers(); | 91 CloseOpenAshBrowsers(); |
92 chrome::CloseAsh(); | 92 chrome::CloseAsh(); |
93 } | 93 } |
94 // Tell the rest of Chrome about it. | 94 // Tell the rest of Chrome about it. |
(...skipping 16 matching lines...) Expand all Loading... |
111 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) { | 111 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) { |
112 DVLOG(1) << "No GPU access, attempting to restart in Desktop\n"; | 112 DVLOG(1) << "No GPU access, attempting to restart in Desktop\n"; |
113 chrome::AttemptRestartToDesktopMode(); | 113 chrome::AttemptRestartToDesktopMode(); |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 void ChromeMetroViewerProcessHost::OnSetTargetSurface( | 117 void ChromeMetroViewerProcessHost::OnSetTargetSurface( |
118 gfx::NativeViewId target_surface) { | 118 gfx::NativeViewId target_surface) { |
119 HWND hwnd = reinterpret_cast<HWND>(target_surface); | 119 HWND hwnd = reinterpret_cast<HWND>(target_surface); |
120 // Tell our root window host that the viewer has connected. | 120 // Tell our root window host that the viewer has connected. |
121 aura::RemoteRootWindowHostWin::Instance()->Connected(this, hwnd); | 121 aura::RemoteWindowTreeHostWin::Instance()->Connected(this, hwnd); |
122 // Now start the Ash shell environment. | 122 // Now start the Ash shell environment. |
123 chrome::OpenAsh(); | 123 chrome::OpenAsh(); |
124 ash::Shell::GetInstance()->CreateShelf(); | 124 ash::Shell::GetInstance()->CreateShelf(); |
125 ash::Shell::GetInstance()->ShowShelf(); | 125 ash::Shell::GetInstance()->ShowShelf(); |
126 // On Windows 8 ASH we default to SHOW_STATE_MAXIMIZED for the browser | 126 // On Windows 8 ASH we default to SHOW_STATE_MAXIMIZED for the browser |
127 // window. This is to ensure that we honor metro app conventions by default. | 127 // window. This is to ensure that we honor metro app conventions by default. |
128 ash::WindowPositioner::SetMaximizeFirstWindow(true); | 128 ash::WindowPositioner::SetMaximizeFirstWindow(true); |
129 // Tell the rest of Chrome that Ash is running. | 129 // Tell the rest of Chrome that Ash is running. |
130 content::NotificationService::current()->Notify( | 130 content::NotificationService::current()->Notify( |
131 chrome::NOTIFICATION_ASH_SESSION_STARTED, | 131 chrome::NOTIFICATION_ASH_SESSION_STARTED, |
(...skipping 13 matching lines...) Expand all Loading... |
145 OpenURL(url); | 145 OpenURL(url); |
146 } | 146 } |
147 | 147 |
148 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, | 148 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, |
149 uint32 height) { | 149 uint32 height) { |
150 std::vector<ash::internal::DisplayInfo> info_list; | 150 std::vector<ash::internal::DisplayInfo> info_list; |
151 info_list.push_back(ash::internal::DisplayInfo::CreateFromSpec( | 151 info_list.push_back(ash::internal::DisplayInfo::CreateFromSpec( |
152 base::StringPrintf("%dx%d", width, height))); | 152 base::StringPrintf("%dx%d", width, height))); |
153 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( | 153 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( |
154 info_list); | 154 info_list); |
155 aura::RemoteRootWindowHostWin::Instance()->HandleWindowSizeChanged(width, | 155 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, |
156 height); | 156 height); |
157 } | 157 } |
OLD | NEW |