Chromium Code Reviews| 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 "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/notifications/notification_ui_manager.h" | 10 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 11 | 11 |
| 12 #if defined(USE_ASH) | 12 #if defined(USE_ASH) |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ui/aura/client/capture_client.h" | 14 #include "ui/aura/client/capture_client.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 namespace browser { | 17 namespace browser { |
| 18 | 18 |
| 19 void HandleAppExitingForPlatform() { | 19 void HandleAppExitingForPlatform() { |
| 20 // Close all non browser windows now. Those includes notifications | 20 // Close all non browser windows now. Those includes notifications |
| 21 // and windows created by Ash (launcher, background, etc). | 21 // and windows created by Ash (launcher, background, etc). |
| 22 #if defined(USE_ASH) | |
| 23 // This may be called before ASH is initialized when XIOError is reported. | |
|
Daniel Erat
2012/09/19 20:47:33
nit: s/ASH/Ash/ or just "ash"
oshima
2012/09/19 21:21:28
changed to |ash::Shell|
| |
| 24 // crbug.com/150633. | |
| 25 if (ash::Shell::HasInstance()) { | |
| 26 g_browser_process->notification_ui_manager()->CancelAll(); | |
| 27 // Releasing the capture will close any menus that might be open: | |
| 28 // http://crbug.com/134472 | |
| 29 aura::client::GetCaptureClient(ash::Shell::GetPrimaryRootWindow())-> | |
| 30 SetCapture(NULL); | |
| 31 } | |
| 32 #else | |
| 22 g_browser_process->notification_ui_manager()->CancelAll(); | 33 g_browser_process->notification_ui_manager()->CancelAll(); |
| 23 | |
| 24 #if defined(USE_ASH) | |
| 25 // Releasing the capture will close any menus that might be open: | |
| 26 // http://crbug.com/134472 | |
| 27 aura::client::GetCaptureClient(ash::Shell::GetPrimaryRootWindow())-> | |
| 28 SetCapture(NULL); | |
| 29 #endif | 34 #endif |
| 30 | 35 |
| 31 // TODO(oshima): Close all non browser windows here while | 36 // TODO(oshima): Close all non browser windows here while |
| 32 // the message loop is still alive. | 37 // the message loop is still alive. |
| 33 | 38 |
| 34 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 35 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 40 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 36 switches::kDisableZeroBrowsersOpenForTests)) { | 41 switches::kDisableZeroBrowsersOpenForTests)) { |
| 37 // App is exiting, call EndKeepAlive() on behalf of Aura Shell. | 42 // App is exiting, call EndKeepAlive() on behalf of Aura Shell. |
| 38 EndKeepAlive(); | 43 EndKeepAlive(); |
| 39 // Make sure we have notified the session manager that we are exiting. | 44 // Make sure we have notified the session manager that we are exiting. |
| 40 // This might be called from FastShutdown() or CloseAllBrowsers(), but not | 45 // This might be called from FastShutdown() or CloseAllBrowsers(), but not |
| 41 // if something prevents a browser from closing before SetTryingToQuit() | 46 // if something prevents a browser from closing before SetTryingToQuit() |
| 42 // gets called (e.g. browser->TabsNeedBeforeUnloadFired() is true). | 47 // gets called (e.g. browser->TabsNeedBeforeUnloadFired() is true). |
| 43 // NotifyAndTerminate does nothing if called more than once. | 48 // NotifyAndTerminate does nothing if called more than once. |
| 44 NotifyAndTerminate(true); | 49 NotifyAndTerminate(true); |
| 45 } | 50 } |
| 46 #endif // OS_CHROMEOS | 51 #endif // OS_CHROMEOS |
| 47 } | 52 } |
| 48 | 53 |
| 49 } // namespace browser | 54 } // namespace browser |
| OLD | NEW |