Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc

Issue 54093007: Restart in Desktop if Metro tries to start up without GPU (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no atl Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chrome/browser/browser_process_platform_part_aurawin.h" 11 #include "chrome/browser/browser_process_platform_part_aurawin.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/lifetime/application_lifetime.h"
13 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/search_engines/util.h" 15 #include "chrome/browser/search_engines/util.h"
15 #include "chrome/browser/ui/ash/ash_init.h" 16 #include "chrome/browser/ui/ash/ash_init.h"
16 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 18 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/browser_navigator.h" 19 #include "chrome/browser/ui/browser_navigator.h"
19 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/host_desktop.h" 21 #include "chrome/browser/ui/host_desktop.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/env_vars.h" 23 #include "chrome/common/env_vars.h"
23 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/gpu_data_manager.h"
24 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/page_navigator.h" 27 #include "content/public/browser/page_navigator.h"
26 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
27 #include "ui/aura/remote_root_window_host_win.h" 29 #include "ui/aura/remote_root_window_host_win.h"
28 #include "ui/surface/accelerated_surface_win.h" 30 #include "ui/surface/accelerated_surface_win.h"
29 #include "url/gurl.h" 31 #include "url/gurl.h"
30 32
31 namespace { 33 namespace {
32 34
33 void CloseOpenAshBrowsers() { 35 void CloseOpenAshBrowsers() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // This will delete the MetroViewerProcessHost object. Don't access member 89 // This will delete the MetroViewerProcessHost object. Don't access member
88 // variables/functions after this call. 90 // variables/functions after this call.
89 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); 91 g_browser_process->platform_part()->OnMetroViewerProcessTerminated();
90 } 92 }
91 93
92 void ChromeMetroViewerProcessHost::OnChannelConnected(int32 /*peer_pid*/) { 94 void ChromeMetroViewerProcessHost::OnChannelConnected(int32 /*peer_pid*/) {
93 DLOG(INFO) << "ChromeMetroViewerProcessHost::OnChannelConnected: "; 95 DLOG(INFO) << "ChromeMetroViewerProcessHost::OnChannelConnected: ";
94 // Set environment variable to let breakpad know that metro process was 96 // Set environment variable to let breakpad know that metro process was
95 // connected. 97 // connected.
96 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1"); 98 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1");
99
100 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) {
101 DLOG(INFO) << "No GPU access, attempting to restart in Desktop\n";
102 chrome::AttemptRestartToDesktopMode();
103 }
97 } 104 }
98 105
99 void ChromeMetroViewerProcessHost::OnSetTargetSurface( 106 void ChromeMetroViewerProcessHost::OnSetTargetSurface(
100 gfx::NativeViewId target_surface) { 107 gfx::NativeViewId target_surface) {
101 HWND hwnd = reinterpret_cast<HWND>(target_surface); 108 HWND hwnd = reinterpret_cast<HWND>(target_surface);
102 // Tell our root window host that the viewer has connected. 109 // Tell our root window host that the viewer has connected.
103 aura::RemoteRootWindowHostWin::Instance()->Connected(this, hwnd); 110 aura::RemoteRootWindowHostWin::Instance()->Connected(this, hwnd);
104 // Now start the Ash shell environment. 111 // Now start the Ash shell environment.
105 chrome::OpenAsh(); 112 chrome::OpenAsh();
106 ash::Shell::GetInstance()->CreateLauncher(); 113 ash::Shell::GetInstance()->CreateLauncher();
107 ash::Shell::GetInstance()->ShowLauncher(); 114 ash::Shell::GetInstance()->ShowLauncher();
108 // Tell the rest of Chrome that Ash is running. 115 // Tell the rest of Chrome that Ash is running.
109 content::NotificationService::current()->Notify( 116 content::NotificationService::current()->Notify(
110 chrome::NOTIFICATION_ASH_SESSION_STARTED, 117 chrome::NOTIFICATION_ASH_SESSION_STARTED,
111 content::NotificationService::AllSources(), 118 content::NotificationService::AllSources(),
112 content::NotificationService::NoDetails()); 119 content::NotificationService::NoDetails());
113 } 120 }
114 121
115 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) { 122 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) {
116 OpenURL(GURL(url)); 123 OpenURL(GURL(url));
117 } 124 }
118 125
119 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( 126 void ChromeMetroViewerProcessHost::OnHandleSearchRequest(
120 const string16& search_string) { 127 const string16& search_string) {
121 GURL url(GetDefaultSearchURLForSearchTerms( 128 GURL url(GetDefaultSearchURLForSearchTerms(
122 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); 129 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string));
123 if (url.is_valid()) 130 if (url.is_valid())
124 OpenURL(url); 131 OpenURL(url);
125 } 132 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698