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 "ash/shell.h" |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
11 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/browser_shutdown.h" | 15 #include "chrome/browser/browser_shutdown.h" |
15 #include "chrome/browser/download/download_service.h" | 16 #include "chrome/browser/download/download_service.h" |
16 #include "chrome/browser/metrics/thread_watcher.h" | 17 #include "chrome/browser/metrics/thread_watcher.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 if (notified) | 382 if (notified) |
382 return; | 383 return; |
383 notified = true; | 384 notified = true; |
384 HandleAppExitingForPlatform(); | 385 HandleAppExitingForPlatform(); |
385 } | 386 } |
386 | 387 |
387 bool ShouldStartShutdown(Browser* browser) { | 388 bool ShouldStartShutdown(Browser* browser) { |
388 if (BrowserList::GetInstance(browser->host_desktop_type())->size() > 1) | 389 if (BrowserList::GetInstance(browser->host_desktop_type())->size() > 1) |
389 return false; | 390 return false; |
390 #if defined(OS_WIN) && defined(USE_AURA) | 391 #if defined(OS_WIN) && defined(USE_AURA) |
391 // On Windows 8 browser windows could be open in ASH and in the desktop. We | 392 // On Windows 8 the desktop and ASH environments could be active |
392 // should not start the shutdown process if browser windows are open in the | 393 // at the same time. |
393 // other environment. | 394 // We should not start the shutdown process in the following cases:- |
394 chrome::HostDesktopType other_desktop = | 395 // 1. If the desktop type of the browser going away is ASH and there |
395 (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE ? | 396 // are browser windows open in the desktop. |
396 chrome::HOST_DESKTOP_TYPE_ASH : chrome::HOST_DESKTOP_TYPE_NATIVE); | 397 // 2. If the desktop type of the browser going away is desktop and the ASH |
397 if (!BrowserList::GetInstance(other_desktop)->empty()) | 398 // environment is still active. |
398 return false; | 399 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
| 400 return !ash::Shell::HasInstance(); |
| 401 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 402 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
399 #endif | 403 #endif |
400 return true; | 404 return true; |
401 } | 405 } |
402 | 406 |
403 } // namespace chrome | 407 } // namespace chrome |
OLD | NEW |