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

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: use public/ 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 <atlbase.h>
cpu_(ooo_6.6-7.5) 2013/11/04 19:17:02 please no ATL. Does our LOG() not work in this cas
scottmg 2013/11/04 23:05:44 Done.
8
7 #include "ash/shell.h" 9 #include "ash/shell.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/browser_process_platform_part_aurawin.h" 13 #include "chrome/browser/browser_process_platform_part_aurawin.h"
12 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/lifetime/application_lifetime.h"
13 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/search_engines/util.h" 17 #include "chrome/browser/search_engines/util.h"
15 #include "chrome/browser/ui/ash/ash_init.h" 18 #include "chrome/browser/ui/ash/ash_init.h"
16 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 20 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/browser_navigator.h" 21 #include "chrome/browser/ui/browser_navigator.h"
19 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/host_desktop.h" 23 #include "chrome/browser/ui/host_desktop.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 24 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/env_vars.h" 25 #include "chrome/common/env_vars.h"
23 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/gpu_data_manager.h"
24 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/page_navigator.h" 29 #include "content/public/browser/page_navigator.h"
26 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
27 #include "ui/aura/remote_root_window_host_win.h" 31 #include "ui/aura/remote_root_window_host_win.h"
28 #include "ui/surface/accelerated_surface_win.h" 32 #include "ui/surface/accelerated_surface_win.h"
29 #include "url/gurl.h" 33 #include "url/gurl.h"
30 34
31 namespace { 35 namespace {
32 36
33 void CloseOpenAshBrowsers() { 37 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 91 // This will delete the MetroViewerProcessHost object. Don't access member
88 // variables/functions after this call. 92 // variables/functions after this call.
89 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); 93 g_browser_process->platform_part()->OnMetroViewerProcessTerminated();
90 } 94 }
91 95
92 void ChromeMetroViewerProcessHost::OnChannelConnected(int32 /*peer_pid*/) { 96 void ChromeMetroViewerProcessHost::OnChannelConnected(int32 /*peer_pid*/) {
93 DLOG(INFO) << "ChromeMetroViewerProcessHost::OnChannelConnected: "; 97 DLOG(INFO) << "ChromeMetroViewerProcessHost::OnChannelConnected: ";
94 // Set environment variable to let breakpad know that metro process was 98 // Set environment variable to let breakpad know that metro process was
95 // connected. 99 // connected.
96 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1"); 100 ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1");
101
102 if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) {
103 AtlTrace("%hs: No GPU access, attempting to restart in Desktop\n",
104 __FUNCTION__);
105 chrome::AttemptRestartToDesktopMode();
106 }
97 } 107 }
98 108
99 void ChromeMetroViewerProcessHost::OnSetTargetSurface( 109 void ChromeMetroViewerProcessHost::OnSetTargetSurface(
100 gfx::NativeViewId target_surface) { 110 gfx::NativeViewId target_surface) {
101 HWND hwnd = reinterpret_cast<HWND>(target_surface); 111 HWND hwnd = reinterpret_cast<HWND>(target_surface);
102 // Tell our root window host that the viewer has connected. 112 // Tell our root window host that the viewer has connected.
103 aura::RemoteRootWindowHostWin::Instance()->Connected(this, hwnd); 113 aura::RemoteRootWindowHostWin::Instance()->Connected(this, hwnd);
104 // Now start the Ash shell environment. 114 // Now start the Ash shell environment.
105 chrome::OpenAsh(); 115 chrome::OpenAsh();
106 ash::Shell::GetInstance()->CreateLauncher(); 116 ash::Shell::GetInstance()->CreateLauncher();
107 ash::Shell::GetInstance()->ShowLauncher(); 117 ash::Shell::GetInstance()->ShowLauncher();
108 // Tell the rest of Chrome that Ash is running. 118 // Tell the rest of Chrome that Ash is running.
109 content::NotificationService::current()->Notify( 119 content::NotificationService::current()->Notify(
110 chrome::NOTIFICATION_ASH_SESSION_STARTED, 120 chrome::NOTIFICATION_ASH_SESSION_STARTED,
111 content::NotificationService::AllSources(), 121 content::NotificationService::AllSources(),
112 content::NotificationService::NoDetails()); 122 content::NotificationService::NoDetails());
113 } 123 }
114 124
115 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) { 125 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) {
116 OpenURL(GURL(url)); 126 OpenURL(GURL(url));
117 } 127 }
118 128
119 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( 129 void ChromeMetroViewerProcessHost::OnHandleSearchRequest(
120 const string16& search_string) { 130 const string16& search_string) {
121 GURL url(GetDefaultSearchURLForSearchTerms( 131 GURL url(GetDefaultSearchURLForSearchTerms(
122 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); 132 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string));
123 if (url.is_valid()) 133 if (url.is_valid())
124 OpenURL(url); 134 OpenURL(url);
125 } 135 }
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