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

Side by Side Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 14576015: In WinAura, also kill the Metro viewer process in AttemptExit(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase on top of https://codereview.chromium.org/14576015/ Created 7 years, 7 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/lifetime/application_lifetime.h" 5 #include "chrome/browser/lifetime/application_lifetime.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 30 matching lines...) Expand all
41 41
42 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
43 #include "base/chromeos/chromeos_version.h" 43 #include "base/chromeos/chromeos_version.h"
44 #include "chrome/browser/chromeos/boot_times_loader.h" 44 #include "chrome/browser/chromeos/boot_times_loader.h"
45 #include "chrome/browser/chromeos/login/user_manager.h" 45 #include "chrome/browser/chromeos/login/user_manager.h"
46 #include "chromeos/dbus/dbus_thread_manager.h" 46 #include "chromeos/dbus/dbus_thread_manager.h"
47 #include "chromeos/dbus/session_manager_client.h" 47 #include "chromeos/dbus/session_manager_client.h"
48 #include "chromeos/dbus/update_engine_client.h" 48 #include "chromeos/dbus/update_engine_client.h"
49 #endif 49 #endif
50 50
51 #if defined(OS_WIN) && defined(USE_AURA)
52 #include "base/win/windows_version.h"
53 #include "chrome/browser/browser_process_platform_part_winaura.h"
54 #endif
55
51 namespace chrome { 56 namespace chrome {
52 namespace { 57 namespace {
53 58
54 // Returns true if all browsers can be closed without user interaction. 59 // Returns true if all browsers can be closed without user interaction.
55 // This currently checks if there is pending download, or if it needs to 60 // This currently checks if there is pending download, or if it needs to
56 // handle unload handler. 61 // handle unload handler.
57 bool AreAllBrowsersCloseable() { 62 bool AreAllBrowsersCloseable() {
58 chrome::BrowserIterator browser_it; 63 chrome::BrowserIterator browser_it;
59 if (browser_it.done()) 64 if (browser_it.done())
60 return true; 65 return true;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Tell the Java code to finish() the Activity. 101 // Tell the Java code to finish() the Activity.
97 TerminateAndroid(); 102 TerminateAndroid();
98 #elif defined(OS_MACOSX) 103 #elif defined(OS_MACOSX)
99 // On the Mac, the application continues to run once all windows are closed. 104 // On the Mac, the application continues to run once all windows are closed.
100 // Terminate will result in a CloseAllBrowsers() call, and once (and if) 105 // Terminate will result in a CloseAllBrowsers() call, and once (and if)
101 // that is done, will cause the application to exit cleanly. 106 // that is done, will cause the application to exit cleanly.
102 chrome_browser_application_mac::Terminate(); 107 chrome_browser_application_mac::Terminate();
103 #else 108 #else
104 // On most platforms, closing all windows causes the application to exit. 109 // On most platforms, closing all windows causes the application to exit.
105 CloseAllBrowsers(); 110 CloseAllBrowsers();
111 #if defined(OS_WIN) && defined(USE_AURA)
112 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
113 // On Windows 8, Ash might be active in Metro and won't go away even if all
114 // browsers are closed. The viewer process, whose host holds a reference to
115 // g_browser_process, needs to be killed.
116 g_browser_process->platform_part()->TerminateMetroViewerProcess();
sky 2013/05/15 21:13:18 How about naming this AttemptExit so that you can
gab 2013/05/17 23:19:18 Done on top of https://codereview.chromium.org/149
117 }
118 #endif // defined(OS_WIN) && defined(USE_AURA)
106 #endif 119 #endif
107 } 120 }
108 121
109 void CloseAllBrowsers() { 122 void CloseAllBrowsers() {
110 bool session_ending = 123 bool session_ending =
111 browser_shutdown::GetShutdownType() == browser_shutdown::END_SESSION; 124 browser_shutdown::GetShutdownType() == browser_shutdown::END_SESSION;
112 // Tell everyone that we are shutting down. 125 // Tell everyone that we are shutting down.
113 browser_shutdown::SetTryingToQuit(true); 126 browser_shutdown::SetTryingToQuit(true);
114 127
115 #if defined(ENABLE_SESSION_SERVICE) 128 #if defined(ENABLE_SESSION_SERVICE)
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // environment is still active. 411 // environment is still active.
399 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) 412 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE)
400 return !ash::Shell::HasInstance(); 413 return !ash::Shell::HasInstance();
401 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) 414 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH)
402 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); 415 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty();
403 #endif 416 #endif
404 return true; 417 return true;
405 } 418 }
406 419
407 } // namespace chrome 420 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_platform_part_winaura.cc ('k') | chrome/browser/metro_viewer/metro_viewer_process_host_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698