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

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

Issue 130223002: Have browser process shutdown metro viewer on Metro -> Metro restart. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser_close_manager.h" 5 #include "chrome/browser/lifetime/browser_close_manager.h"
6 6
7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/background/background_mode_manager.h" 7 #include "chrome/browser/background/background_mode_manager.h"
9 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/browser_shutdown.h" 9 #include "chrome/browser/browser_shutdown.h"
11 #include "chrome/browser/download/download_service.h" 10 #include "chrome/browser/download/download_service.h"
12 #include "chrome/browser/download/download_service_factory.h" 11 #include "chrome/browser/download/download_service_factory.h"
13 #include "chrome/browser/first_run/upgrade_util.h"
14 #include "chrome/browser/lifetime/application_lifetime.h"
15 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_iterator.h" 14 #include "chrome/browser/ui/browser_iterator.h"
18 #include "chrome/browser/ui/browser_list.h" 15 #include "chrome/browser/ui/browser_list.h"
19 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/chrome_pages.h" 17 #include "chrome/browser/ui/chrome_pages.h"
21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 18 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/common/pref_names.h"
24 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
25 21
26 #if defined(OS_WIN)
27 #include "base/win/windows_version.h"
28 #include "chrome/browser/first_run/upgrade_util_win.h"
29 #endif
30
31 BrowserCloseManager::BrowserCloseManager() : current_browser_(NULL) {} 22 BrowserCloseManager::BrowserCloseManager() : current_browser_(NULL) {}
32 23
33 BrowserCloseManager::~BrowserCloseManager() {} 24 BrowserCloseManager::~BrowserCloseManager() {}
34 25
35 void BrowserCloseManager::StartClosingBrowsers() { 26 void BrowserCloseManager::StartClosingBrowsers() {
36 // If the session is ending, skip straight to closing the browsers. There's no 27 // If the session is ending, skip straight to closing the browsers. There's no
37 // time to wait for beforeunload dialogs. 28 // time to wait for beforeunload dialogs.
38 if (browser_shutdown::GetShutdownType() == browser_shutdown::END_SESSION) { 29 if (browser_shutdown::GetShutdownType() == browser_shutdown::END_SESSION) {
39 // Tell everyone that we are shutting down. 30 // Tell everyone that we are shutting down.
40 browser_shutdown::SetTryingToQuit(true); 31 browser_shutdown::SetTryingToQuit(true);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 browser->window()->DestroyBrowser(); 153 browser->window()->DestroyBrowser();
163 it_ptr.reset(new chrome::BrowserIterator()); 154 it_ptr.reset(new chrome::BrowserIterator());
164 if (!it_ptr->done() && browser == **it_ptr) { 155 if (!it_ptr->done() && browser == **it_ptr) {
165 // Destroying the browser should have removed it from the browser list. 156 // Destroying the browser should have removed it from the browser list.
166 // We should never get here. 157 // We should never get here.
167 NOTREACHED(); 158 NOTREACHED();
168 return; 159 return;
169 } 160 }
170 } 161 }
171 } 162 }
172
173 #if defined(OS_WIN)
174 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
175 PrefService* pref_service = g_browser_process->local_state();
176 bool is_relaunch = pref_service->GetBoolean(prefs::kWasRestarted);
177 if (is_relaunch) {
178 upgrade_util::RelaunchMode mode = upgrade_util::RelaunchModeStringToEnum(
179 pref_service->GetString(prefs::kRelaunchMode));
180 if (mode == upgrade_util::RELAUNCH_MODE_DESKTOP)
181 chrome::ActivateDesktopHelper(chrome::ASH_TERMINATE);
182 }
183 }
184 #endif
185 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698