| 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/window_positioner.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/browser_process_platform_part_aurawin.h" | 12 #include "chrome/browser/browser_process_platform_part_aurawin.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/lifetime/application_lifetime.h" | 14 #include "chrome/browser/lifetime/application_lifetime.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/search_engines/util.h" | 16 #include "chrome/browser/search_engines/util.h" |
| 16 #include "chrome/browser/ui/ash/ash_init.h" | 17 #include "chrome/browser/ui/ash/ash_init.h" |
| 17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 106 |
| 106 void ChromeMetroViewerProcessHost::OnSetTargetSurface( | 107 void ChromeMetroViewerProcessHost::OnSetTargetSurface( |
| 107 gfx::NativeViewId target_surface) { | 108 gfx::NativeViewId target_surface) { |
| 108 HWND hwnd = reinterpret_cast<HWND>(target_surface); | 109 HWND hwnd = reinterpret_cast<HWND>(target_surface); |
| 109 // Tell our root window host that the viewer has connected. | 110 // Tell our root window host that the viewer has connected. |
| 110 aura::RemoteRootWindowHostWin::Instance()->Connected(this, hwnd); | 111 aura::RemoteRootWindowHostWin::Instance()->Connected(this, hwnd); |
| 111 // Now start the Ash shell environment. | 112 // Now start the Ash shell environment. |
| 112 chrome::OpenAsh(); | 113 chrome::OpenAsh(); |
| 113 ash::Shell::GetInstance()->CreateLauncher(); | 114 ash::Shell::GetInstance()->CreateLauncher(); |
| 114 ash::Shell::GetInstance()->ShowLauncher(); | 115 ash::Shell::GetInstance()->ShowLauncher(); |
| 116 // On Windows 8 ASH we default to SHOW_STATE_MAXIMIZED for the browser |
| 117 // window. This is to ensure that we honor metro app conventions by default. |
| 118 ash::WindowPositioner::SetMaximizeFirstWindow(true); |
| 115 // Tell the rest of Chrome that Ash is running. | 119 // Tell the rest of Chrome that Ash is running. |
| 116 content::NotificationService::current()->Notify( | 120 content::NotificationService::current()->Notify( |
| 117 chrome::NOTIFICATION_ASH_SESSION_STARTED, | 121 chrome::NOTIFICATION_ASH_SESSION_STARTED, |
| 118 content::NotificationService::AllSources(), | 122 content::NotificationService::AllSources(), |
| 119 content::NotificationService::NoDetails()); | 123 content::NotificationService::NoDetails()); |
| 120 } | 124 } |
| 121 | 125 |
| 122 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) { | 126 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) { |
| 123 OpenURL(GURL(url)); | 127 OpenURL(GURL(url)); |
| 124 } | 128 } |
| 125 | 129 |
| 126 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( | 130 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( |
| 127 const string16& search_string) { | 131 const string16& search_string) { |
| 128 GURL url(GetDefaultSearchURLForSearchTerms( | 132 GURL url(GetDefaultSearchURLForSearchTerms( |
| 129 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); | 133 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); |
| 130 if (url.is_valid()) | 134 if (url.is_valid()) |
| 131 OpenURL(url); | 135 OpenURL(url); |
| 132 } | 136 } |
| OLD | NEW |