| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 ChromeMetroViewerProcessHost::ChromeMetroViewerProcessHost() | 60 ChromeMetroViewerProcessHost::ChromeMetroViewerProcessHost() |
| 61 : MetroViewerProcessHost( | 61 : MetroViewerProcessHost( |
| 62 content::BrowserThread::GetMessageLoopProxyForThread( | 62 content::BrowserThread::GetMessageLoopProxyForThread( |
| 63 content::BrowserThread::IO)) { | 63 content::BrowserThread::IO)) { |
| 64 g_browser_process->AddRefModule(); | 64 g_browser_process->AddRefModule(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void ChromeMetroViewerProcessHost::OnChannelError() { | 67 void ChromeMetroViewerProcessHost::OnChannelError() { |
| 68 // TODO(cpu): At some point we only close the browser. Right now this | 68 // TODO(cpu): At some point we only close the browser. Right now this |
| 69 // is very convenient for developing. | 69 // is very convenient for developing. |
| 70 DLOG(INFO) << "viewer channel error : Quitting browser"; | 70 DLOG(INFO) << "viewer channel error : Quitting browser"; |
| 71 | 71 |
| 72 // Unset environment variable to let breakpad know that metro process wasn't | 72 // Unset environment variable to let breakpad know that metro process wasn't |
| 73 // connected. | 73 // connected. |
| 74 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); | 74 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); |
| 75 | 75 |
| 76 aura::RemoteRootWindowHostWin::Instance()->Disconnected(); | 76 aura::RemoteRootWindowHostWin::Instance()->Disconnected(); |
| 77 g_browser_process->ReleaseModule(); | 77 g_browser_process->ReleaseModule(); |
| 78 CloseOpenAshBrowsers(); | 78 CloseOpenAshBrowsers(); |
| 79 chrome::CloseAsh(); | 79 chrome::CloseAsh(); |
| 80 // Tell the rest of Chrome about it. | 80 // Tell the rest of Chrome about it. |
| 81 content::NotificationService::current()->Notify( | 81 content::NotificationService::current()->Notify( |
| 82 chrome::NOTIFICATION_ASH_SESSION_ENDED, | 82 chrome::NOTIFICATION_ASH_SESSION_ENDED, |
| 83 content::NotificationService::AllSources(), | 83 content::NotificationService::AllSources(), |
| 84 content::NotificationService::NoDetails()); | 84 content::NotificationService::NoDetails()); |
| 85 | 85 |
| 86 // This will delete the MetroViewerProcessHost object. Don't access member | 86 // This will delete the MetroViewerProcessHost object. Don't access member |
| 87 // variables/functions after this call. | 87 // variables/functions after this call. |
| 88 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); | 88 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void ChromeMetroViewerProcessHost::OnChannelConnected(int32 /*peer_pid*/) { | 91 void ChromeMetroViewerProcessHost::OnChannelConnected(int32 /*peer_pid*/) { |
| 92 DLOG(INFO) << "ChromeMetroViewerProcessHost::OnChannelConnected: "; | 92 DLOG(INFO) << "ChromeMetroViewerProcessHost::OnChannelConnected: "; |
| 93 // Set environment variable to let breakpad know that metro process was | 93 // Set environment variable to let breakpad know that metro process was |
| 94 // connected. | 94 // connected. |
| 95 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1"); | 95 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1"); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void ChromeMetroViewerProcessHost::OnSetTargetSurface( | 98 void ChromeMetroViewerProcessHost::OnSetTargetSurface( |
| 99 gfx::NativeViewId target_surface) { | 99 gfx::NativeViewId target_surface) { |
| 100 HWND hwnd = reinterpret_cast<HWND>(target_surface); | 100 HWND hwnd = reinterpret_cast<HWND>(target_surface); |
| 101 // Tell our root window host that the viewer has connected. | 101 // Tell our root window host that the viewer has connected. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 115 OpenURL(GURL(url)); | 115 OpenURL(GURL(url)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( | 118 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( |
| 119 const string16& search_string) { | 119 const string16& search_string) { |
| 120 GURL url(GetDefaultSearchURLForSearchTerms( | 120 GURL url(GetDefaultSearchURLForSearchTerms( |
| 121 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); | 121 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); |
| 122 if (url.is_valid()) | 122 if (url.is_valid()) |
| 123 OpenURL(url); | 123 OpenURL(url); |
| 124 } | 124 } |
| OLD | NEW |