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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 void ChromeMetroViewerProcessHost::OnChannelError() { | 81 void ChromeMetroViewerProcessHost::OnChannelError() { |
82 // TODO(cpu): At some point we only close the browser. Right now this | 82 // TODO(cpu): At some point we only close the browser. Right now this |
83 // is very convenient for developing. | 83 // is very convenient for developing. |
84 DVLOG(1) << "viewer channel error : Quitting browser"; | 84 DVLOG(1) << "viewer channel error : Quitting browser"; |
85 | 85 |
86 // Unset environment variable to let breakpad know that metro process wasn't | 86 // Unset environment variable to let breakpad know that metro process wasn't |
87 // connected. | 87 // connected. |
88 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); | 88 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); |
89 | 89 |
90 aura::RemoteWindowTreeHostWin::Instance()->Disconnected(); | 90 // It seems possible that channel is connected, but ASH desktop is not yet |
| 91 // created (instance is still NULL) and we receive channel error. |
| 92 if (aura::RemoteWindowTreeHostWin::Instance()) { |
| 93 aura::RemoteWindowTreeHostWin::Instance()->Disconnected(); |
| 94 |
| 95 chrome::DecrementKeepAliveCount(); |
| 96 |
| 97 // If browser is trying to quit, we shouldn't reenter the process. |
| 98 // TODO(shrikant): In general there seem to be issues with how AttemptExit |
| 99 // reentry works. In future release please clean up related code. |
| 100 if (!browser_shutdown::IsTryingToQuit()) { |
| 101 CloseOpenAshBrowsers(); |
| 102 chrome::CloseAsh(); |
| 103 } |
| 104 // Tell the rest of Chrome about it. |
| 105 content::NotificationService::current()->Notify( |
| 106 chrome::NOTIFICATION_ASH_SESSION_ENDED, |
| 107 content::NotificationService::AllSources(), |
| 108 content::NotificationService::NoDetails()); |
| 109 return; |
| 110 } |
| 111 |
91 chrome::DecrementKeepAliveCount(); | 112 chrome::DecrementKeepAliveCount(); |
92 | 113 |
93 // If browser is trying to quit, we shouldn't reenter the process. | |
94 // TODO(shrikant): In general there seem to be issues with how AttemptExit | |
95 // reentry works. In future release please clean up related code. | |
96 if (!browser_shutdown::IsTryingToQuit()) { | |
97 CloseOpenAshBrowsers(); | |
98 chrome::CloseAsh(); | |
99 } | |
100 // Tell the rest of Chrome about it. | |
101 content::NotificationService::current()->Notify( | |
102 chrome::NOTIFICATION_ASH_SESSION_ENDED, | |
103 content::NotificationService::AllSources(), | |
104 content::NotificationService::NoDetails()); | |
105 | |
106 // This will delete the MetroViewerProcessHost object. Don't access member | 114 // This will delete the MetroViewerProcessHost object. Don't access member |
107 // variables/functions after this call. | 115 // variables/functions after this call. |
108 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); | 116 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); |
109 } | 117 } |
110 | 118 |
111 void ChromeMetroViewerProcessHost::OnChannelConnected(int32 /*peer_pid*/) { | 119 void ChromeMetroViewerProcessHost::OnChannelConnected(int32 /*peer_pid*/) { |
112 DVLOG(1) << "ChromeMetroViewerProcessHost::OnChannelConnected: "; | 120 DVLOG(1) << "ChromeMetroViewerProcessHost::OnChannelConnected: "; |
113 // Set environment variable to let breakpad know that metro process was | 121 // Set environment variable to let breakpad know that metro process was |
114 // connected. | 122 // connected. |
115 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1"); | 123 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1"); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, | 169 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, |
162 uint32 height) { | 170 uint32 height) { |
163 std::vector<ash::DisplayInfo> info_list; | 171 std::vector<ash::DisplayInfo> info_list; |
164 info_list.push_back(ash::DisplayInfo::CreateFromSpec( | 172 info_list.push_back(ash::DisplayInfo::CreateFromSpec( |
165 base::StringPrintf("%dx%d*%f", width, height, gfx::GetDPIScale()))); | 173 base::StringPrintf("%dx%d*%f", width, height, gfx::GetDPIScale()))); |
166 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( | 174 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( |
167 info_list); | 175 info_list); |
168 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, | 176 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, |
169 height); | 177 height); |
170 } | 178 } |
OLD | NEW |