| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/ui/host_desktop.h" | 27 #include "chrome/browser/ui/host_desktop.h" |
| 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 29 #include "chrome/common/env_vars.h" | 29 #include "chrome/common/env_vars.h" |
| 30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/gpu_data_manager.h" | 31 #include "content/public/browser/gpu_data_manager.h" |
| 32 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/page_navigator.h" | 33 #include "content/public/browser/page_navigator.h" |
| 34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 35 #include "ui/aura/remote_window_tree_host_win.h" | 35 #include "ui/aura/remote_window_tree_host_win.h" |
| 36 #include "ui/gfx/win/dpi.h" | 36 #include "ui/gfx/win/dpi.h" |
| 37 #include "ui/metro_viewer/metro_viewer_messages.h" |
| 37 #include "url/gurl.h" | 38 #include "url/gurl.h" |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 void CloseOpenAshBrowsers() { | 42 void CloseOpenAshBrowsers() { |
| 42 BrowserList* browser_list = | 43 BrowserList* browser_list = |
| 43 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 44 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
| 44 if (browser_list) { | 45 if (browser_list) { |
| 45 for (BrowserList::const_iterator i = browser_list->begin(); | 46 for (BrowserList::const_iterator i = browser_list->begin(); |
| 46 i != browser_list->end(); ++i) { | 47 i != browser_list->end(); ++i) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 59 ProfileManager::GetActiveUserProfile(), | 60 ProfileManager::GetActiveUserProfile(), |
| 60 GURL(url), | 61 GURL(url), |
| 61 content::PAGE_TRANSITION_TYPED); | 62 content::PAGE_TRANSITION_TYPED); |
| 62 params.disposition = NEW_FOREGROUND_TAB; | 63 params.disposition = NEW_FOREGROUND_TAB; |
| 63 params.host_desktop_type = chrome::HOST_DESKTOP_TYPE_ASH; | 64 params.host_desktop_type = chrome::HOST_DESKTOP_TYPE_ASH; |
| 64 chrome::Navigate(¶ms); | 65 chrome::Navigate(¶ms); |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace | 68 } // namespace |
| 68 | 69 |
| 70 void HandleActivateDesktop(const base::FilePath& path, bool ash_exit) { |
| 71 if (ChromeMetroViewerProcessHost::instance()) { |
| 72 ChromeMetroViewerProcessHost::instance()->Send( |
| 73 new MetroViewerHostMsg_ActivateDesktop(path, ash_exit)); |
| 74 } |
| 75 } |
| 76 |
| 77 // static |
| 78 ChromeMetroViewerProcessHost* ChromeMetroViewerProcessHost::instance_ = NULL; |
| 79 |
| 69 ChromeMetroViewerProcessHost::ChromeMetroViewerProcessHost() | 80 ChromeMetroViewerProcessHost::ChromeMetroViewerProcessHost() |
| 70 : MetroViewerProcessHost( | 81 : MetroViewerProcessHost( |
| 71 content::BrowserThread::GetMessageLoopProxyForThread( | 82 content::BrowserThread::GetMessageLoopProxyForThread( |
| 72 content::BrowserThread::IO)) { | 83 content::BrowserThread::IO)) { |
| 73 chrome::IncrementKeepAliveCount(); | 84 chrome::IncrementKeepAliveCount(); |
| 85 DCHECK(instance_ == NULL); |
| 86 instance_ = this; |
| 87 } |
| 88 |
| 89 ChromeMetroViewerProcessHost::~ChromeMetroViewerProcessHost() { |
| 90 DCHECK(instance_ == this); |
| 91 instance_ = NULL; |
| 74 } | 92 } |
| 75 | 93 |
| 76 void ChromeMetroViewerProcessHost::OnChannelError() { | 94 void ChromeMetroViewerProcessHost::OnChannelError() { |
| 77 // TODO(cpu): At some point we only close the browser. Right now this | 95 // TODO(cpu): At some point we only close the browser. Right now this |
| 78 // is very convenient for developing. | 96 // is very convenient for developing. |
| 79 DVLOG(1) << "viewer channel error : Quitting browser"; | 97 DVLOG(1) << "viewer channel error : Quitting browser"; |
| 80 | 98 |
| 81 // Unset environment variable to let breakpad know that metro process wasn't | 99 // Unset environment variable to let breakpad know that metro process wasn't |
| 82 // connected. | 100 // connected. |
| 83 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); | 101 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, | 173 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, |
| 156 uint32 height) { | 174 uint32 height) { |
| 157 std::vector<ash::DisplayInfo> info_list; | 175 std::vector<ash::DisplayInfo> info_list; |
| 158 info_list.push_back(ash::DisplayInfo::CreateFromSpec( | 176 info_list.push_back(ash::DisplayInfo::CreateFromSpec( |
| 159 base::StringPrintf("%dx%d*%f", width, height, gfx::GetDPIScale()))); | 177 base::StringPrintf("%dx%d*%f", width, height, gfx::GetDPIScale()))); |
| 160 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( | 178 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( |
| 161 info_list); | 179 info_list); |
| 162 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, | 180 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, |
| 163 height); | 181 height); |
| 164 } | 182 } |
| OLD | NEW |