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 "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 content::NotificationService::AllSources(), | 77 content::NotificationService::AllSources(), |
78 content::NotificationService::NoDetails()); | 78 content::NotificationService::NoDetails()); |
79 | 79 |
80 // This will delete the MetroViewerProcessHost object. Don't access member | 80 // This will delete the MetroViewerProcessHost object. Don't access member |
81 // variables/functions after this call. | 81 // variables/functions after this call. |
82 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); | 82 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); |
83 } | 83 } |
84 | 84 |
85 void ChromeMetroViewerProcessHost::OnSetTargetSurface( | 85 void ChromeMetroViewerProcessHost::OnSetTargetSurface( |
86 gfx::NativeViewId target_surface) { | 86 gfx::NativeViewId target_surface) { |
87 DLOG(INFO) << __FUNCTION__ << ", target_surface = " << target_surface; | |
88 HWND hwnd = reinterpret_cast<HWND>(target_surface); | 87 HWND hwnd = reinterpret_cast<HWND>(target_surface); |
| 88 // Tell our root window host that the viewer has connected. |
| 89 aura::RemoteRootWindowHostWin::Instance()->Connected(this, hwnd); |
| 90 // Now start the Ash shell environment. |
89 chrome::OpenAsh(); | 91 chrome::OpenAsh(); |
90 scoped_refptr<AcceleratedPresenter> any_window = | |
91 AcceleratedPresenter::GetForWindow(NULL); | |
92 any_window->SetNewTargetWindow(hwnd); | |
93 aura::RemoteRootWindowHostWin::Instance()->Connected(this); | |
94 ash::Shell::GetInstance()->CreateLauncher(); | 92 ash::Shell::GetInstance()->CreateLauncher(); |
95 ash::Shell::GetInstance()->ShowLauncher(); | 93 ash::Shell::GetInstance()->ShowLauncher(); |
96 // Tell the rest of Chrome that Ash is running. | 94 // Tell the rest of Chrome that Ash is running. |
97 content::NotificationService::current()->Notify( | 95 content::NotificationService::current()->Notify( |
98 chrome::NOTIFICATION_ASH_SESSION_STARTED, | 96 chrome::NOTIFICATION_ASH_SESSION_STARTED, |
99 content::NotificationService::AllSources(), | 97 content::NotificationService::AllSources(), |
100 content::NotificationService::NoDetails()); | 98 content::NotificationService::NoDetails()); |
101 } | 99 } |
102 | 100 |
103 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) { | 101 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) { |
104 OpenURL(GURL(url)); | 102 OpenURL(GURL(url)); |
105 } | 103 } |
106 | 104 |
107 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( | 105 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( |
108 const string16& search_string) { | 106 const string16& search_string) { |
109 GURL url(GetDefaultSearchURLForSearchTerms( | 107 GURL url(GetDefaultSearchURLForSearchTerms( |
110 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); | 108 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); |
111 if (url.is_valid()) | 109 if (url.is_valid()) |
112 OpenURL(url); | 110 OpenURL(url); |
113 } | 111 } |
OLD | NEW |