OLD | NEW |
---|---|
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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 | 40 |
41 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
42 #include "base/chromeos/chromeos_version.h" | 42 #include "base/chromeos/chromeos_version.h" |
43 #include "chrome/browser/chromeos/boot_times_loader.h" | 43 #include "chrome/browser/chromeos/boot_times_loader.h" |
44 #include "chrome/browser/chromeos/login/user_manager.h" | 44 #include "chrome/browser/chromeos/login/user_manager.h" |
45 #include "chromeos/dbus/dbus_thread_manager.h" | 45 #include "chromeos/dbus/dbus_thread_manager.h" |
46 #include "chromeos/dbus/session_manager_client.h" | 46 #include "chromeos/dbus/session_manager_client.h" |
47 #include "chromeos/dbus/update_engine_client.h" | 47 #include "chromeos/dbus/update_engine_client.h" |
48 #endif | 48 #endif |
49 | 49 |
50 #if defined(OS_WIN) && defined(USE_AURA) | |
51 #include "base/win/windows_version.h" | |
52 #endif | |
53 | |
50 namespace chrome { | 54 namespace chrome { |
51 namespace { | 55 namespace { |
52 | 56 |
53 // Returns true if all browsers can be closed without user interaction. | 57 // Returns true if all browsers can be closed without user interaction. |
54 // This currently checks if there is pending download, or if it needs to | 58 // This currently checks if there is pending download, or if it needs to |
55 // handle unload handler. | 59 // handle unload handler. |
56 bool AreAllBrowsersCloseable() { | 60 bool AreAllBrowsersCloseable() { |
57 chrome::BrowserIterator browser_it; | 61 chrome::BrowserIterator browser_it; |
58 if (browser_it.done()) | 62 if (browser_it.done()) |
59 return true; | 63 return true; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 // Tell the Java code to finish() the Activity. | 99 // Tell the Java code to finish() the Activity. |
96 TerminateAndroid(); | 100 TerminateAndroid(); |
97 #elif defined(OS_MACOSX) | 101 #elif defined(OS_MACOSX) |
98 // On the Mac, the application continues to run once all windows are closed. | 102 // On the Mac, the application continues to run once all windows are closed. |
99 // Terminate will result in a CloseAllBrowsers() call, and once (and if) | 103 // Terminate will result in a CloseAllBrowsers() call, and once (and if) |
100 // that is done, will cause the application to exit cleanly. | 104 // that is done, will cause the application to exit cleanly. |
101 chrome_browser_application_mac::Terminate(); | 105 chrome_browser_application_mac::Terminate(); |
102 #else | 106 #else |
103 // On most platforms, closing all windows causes the application to exit. | 107 // On most platforms, closing all windows causes the application to exit. |
104 CloseAllBrowsers(); | 108 CloseAllBrowsers(); |
109 #if defined(OS_WIN) && defined(USE_AURA) | |
110 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | |
111 // On Windows 8, Ash might be active in Metro and won't go away even if all | |
112 // browsers are closed. The viewer process, which holds a reference to | |
robertshield
2013/05/10 16:51:48
technically it's not the viewer process that holds
gab
2013/05/13 17:46:16
Good point, clarified.
| |
113 // g_browser_process, needs to be killed. | |
114 g_browser_process->TerminateMetroViewerProcess(); | |
115 } | |
116 #endif // defined(OS_WIN) && defined(USE_AURA) | |
105 #endif | 117 #endif |
106 } | 118 } |
107 | 119 |
108 void CloseAllBrowsers() { | 120 void CloseAllBrowsers() { |
109 bool session_ending = | 121 bool session_ending = |
110 browser_shutdown::GetShutdownType() == browser_shutdown::END_SESSION; | 122 browser_shutdown::GetShutdownType() == browser_shutdown::END_SESSION; |
111 // Tell everyone that we are shutting down. | 123 // Tell everyone that we are shutting down. |
112 browser_shutdown::SetTryingToQuit(true); | 124 browser_shutdown::SetTryingToQuit(true); |
113 | 125 |
114 #if defined(ENABLE_SESSION_SERVICE) | 126 #if defined(ENABLE_SESSION_SERVICE) |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
394 chrome::HostDesktopType other_desktop = | 406 chrome::HostDesktopType other_desktop = |
395 (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE ? | 407 (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE ? |
396 chrome::HOST_DESKTOP_TYPE_ASH : chrome::HOST_DESKTOP_TYPE_NATIVE); | 408 chrome::HOST_DESKTOP_TYPE_ASH : chrome::HOST_DESKTOP_TYPE_NATIVE); |
397 if (!BrowserList::GetInstance(other_desktop)->empty()) | 409 if (!BrowserList::GetInstance(other_desktop)->empty()) |
398 return false; | 410 return false; |
399 #endif | 411 #endif |
400 return true; | 412 return true; |
401 } | 413 } |
402 | 414 |
403 } // namespace chrome | 415 } // namespace chrome |
OLD | NEW |