| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "app/clipboard/clipboard.h" | 9 #include "app/clipboard/clipboard.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 540 |
| 541 have_inspector_files_ = result; | 541 have_inspector_files_ = result; |
| 542 } | 542 } |
| 543 | 543 |
| 544 // Mac is currently not supported. | 544 // Mac is currently not supported. |
| 545 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 545 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| 546 | 546 |
| 547 bool BrowserProcessImpl::CanAutorestartForUpdate() const { | 547 bool BrowserProcessImpl::CanAutorestartForUpdate() const { |
| 548 // Check if browser is in the background and if it needs to be restarted to | 548 // Check if browser is in the background and if it needs to be restarted to |
| 549 // apply a pending update. | 549 // apply a pending update. |
| 550 return BrowserList::IsInPersistentMode() && Upgrade::IsUpdatePendingRestart(); | 550 return BrowserList::size() == 0 && !BrowserList::WillKeepAlive() && |
| 551 Upgrade::IsUpdatePendingRestart(); |
| 551 } | 552 } |
| 552 | 553 |
| 553 // Switches enumerated here will be removed when a background instance of | 554 // Switches enumerated here will be removed when a background instance of |
| 554 // Chrome restarts itself. If your key is designed to only be used once, | 555 // Chrome restarts itself. If your key is designed to only be used once, |
| 555 // or if it does not make sense when restarting a background instance to | 556 // or if it does not make sense when restarting a background instance to |
| 556 // pick up an automatic update, be sure to add it to this list. | 557 // pick up an automatic update, be sure to add it to this list. |
| 557 const char* const kSwitchesToRemoveOnAutorestart[] = { | 558 const char* const kSwitchesToRemoveOnAutorestart[] = { |
| 558 switches::kApp, | 559 switches::kApp, |
| 559 switches::kFirstRun, | 560 switches::kFirstRun, |
| 560 switches::kImport, | 561 switches::kImport, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 } | 598 } |
| 598 | 599 |
| 599 void BrowserProcessImpl::OnAutoupdateTimer() { | 600 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 600 if (CanAutorestartForUpdate()) { | 601 if (CanAutorestartForUpdate()) { |
| 601 DLOG(WARNING) << "Detected update. Restarting browser."; | 602 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 602 RestartPersistentInstance(); | 603 RestartPersistentInstance(); |
| 603 } | 604 } |
| 604 } | 605 } |
| 605 | 606 |
| 606 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 607 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |