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 24 matching lines...) Expand all Loading... |
35 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
36 #include "ui/aura/remote_window_tree_host_win.h" | 36 #include "ui/aura/remote_window_tree_host_win.h" |
37 #include "ui/gfx/win/dpi.h" | 37 #include "ui/gfx/win/dpi.h" |
38 #include "ui/metro_viewer/metro_viewer_messages.h" | 38 #include "ui/metro_viewer/metro_viewer_messages.h" |
39 #include "url/gurl.h" | 39 #include "url/gurl.h" |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
43 void CloseOpenAshBrowsers() { | 43 void CloseOpenAshBrowsers() { |
44 BrowserList* browser_list = | 44 BrowserList* browser_list = |
45 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 45 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_ASH); |
46 if (browser_list) { | 46 if (browser_list) { |
47 for (BrowserList::const_iterator i = browser_list->begin(); | 47 for (BrowserList::const_iterator i = browser_list->begin(); |
48 i != browser_list->end(); ++i) { | 48 i != browser_list->end(); ++i) { |
49 Browser* browser = *i; | 49 Browser* browser = *i; |
50 browser->window()->Close(); | 50 browser->window()->Close(); |
51 // If the attempt to Close the browser fails due to unload handlers on | 51 // If the attempt to Close the browser fails due to unload handlers on |
52 // the page or in progress downloads, etc, destroy all tabs on the page. | 52 // the page or in progress downloads, etc, destroy all tabs on the page. |
53 while (browser->tab_strip_model()->count()) | 53 while (browser->tab_strip_model()->count()) |
54 delete browser->tab_strip_model()->GetWebContentsAt(0); | 54 delete browser->tab_strip_model()->GetWebContentsAt(0); |
55 } | 55 } |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 void OpenURL(const GURL& url) { | 59 void OpenURL(const GURL& url) { |
60 chrome::NavigateParams params( | 60 chrome::NavigateParams params( |
61 ProfileManager::GetActiveUserProfile(), | 61 ProfileManager::GetActiveUserProfile(), |
62 GURL(url), | 62 GURL(url), |
63 ui::PAGE_TRANSITION_TYPED); | 63 ui::PAGE_TRANSITION_TYPED); |
64 params.disposition = NEW_FOREGROUND_TAB; | 64 params.disposition = NEW_FOREGROUND_TAB; |
65 params.host_desktop_type = chrome::HOST_DESKTOP_TYPE_ASH; | 65 params.host_desktop_type = ui::HOST_DESKTOP_TYPE_ASH; |
66 chrome::Navigate(¶ms); | 66 chrome::Navigate(¶ms); |
67 } | 67 } |
68 | 68 |
69 } // namespace | 69 } // namespace |
70 | 70 |
71 ChromeMetroViewerProcessHost::ChromeMetroViewerProcessHost() | 71 ChromeMetroViewerProcessHost::ChromeMetroViewerProcessHost() |
72 : MetroViewerProcessHost( | 72 : MetroViewerProcessHost( |
73 content::BrowserThread::GetMessageLoopProxyForThread( | 73 content::BrowserThread::GetMessageLoopProxyForThread( |
74 content::BrowserThread::IO)) { | 74 content::BrowserThread::IO)) { |
75 chrome::IncrementKeepAliveCount(); | 75 chrome::IncrementKeepAliveCount(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, | 169 void ChromeMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, |
170 uint32 height) { | 170 uint32 height) { |
171 std::vector<ash::DisplayInfo> info_list; | 171 std::vector<ash::DisplayInfo> info_list; |
172 info_list.push_back(ash::DisplayInfo::CreateFromSpec( | 172 info_list.push_back(ash::DisplayInfo::CreateFromSpec( |
173 base::StringPrintf("%dx%d*%f", width, height, gfx::GetDPIScale()))); | 173 base::StringPrintf("%dx%d*%f", width, height, gfx::GetDPIScale()))); |
174 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( | 174 ash::Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged( |
175 info_list); | 175 info_list); |
176 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, | 176 aura::RemoteWindowTreeHostWin::Instance()->HandleWindowSizeChanged(width, |
177 height); | 177 height); |
178 } | 178 } |
OLD | NEW |