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

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

Issue 11434013: In Chrome ASH on Windows 8 make sure that the browser object is closed before destroying it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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 (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/ui/browser_list.h" 5 #include "chrome/browser/ui/browser_list.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/message_loop.h" 9 #include "base/message_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/browser_shutdown.h" 12 #include "chrome/browser/browser_shutdown.h"
13 #include "chrome/browser/download/download_service.h" 13 #include "chrome/browser/download/download_service.h"
14 #include "chrome/browser/metrics/thread_watcher.h" 14 #include "chrome/browser/metrics/thread_watcher.h"
15 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_list_impl.h"
19 #include "chrome/browser/ui/browser_tabstrip.h" 20 #include "chrome/browser/ui/browser_tabstrip.h"
20 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/tab_contents/tab_contents.h" 22 #include "chrome/browser/ui/tab_contents/tab_contents.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" 23 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
26 #include "content/public/browser/browser_shutdown.h" 27 #include "content/public/browser/browser_shutdown.h"
27 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/navigation_details.h" 29 #include "content/public/browser/navigation_details.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 if (i != BrowserList::end() && browser == *i) { 200 if (i != BrowserList::end() && browser == *i) {
200 // Destroying the browser should have removed it from the browser list. 201 // Destroying the browser should have removed it from the browser list.
201 // We should never get here. 202 // We should never get here.
202 NOTREACHED(); 203 NOTREACHED();
203 return; 204 return;
204 } 205 }
205 } 206 }
206 } 207 }
207 } 208 }
208 209
210 void CloseAllBrowsersOfType(chrome::HostDesktopType type) {
211 chrome::BrowserListImpl* ash_browser_list =
212 chrome::BrowserListImpl::GetInstance(type);
213 if (ash_browser_list) {
214 for (chrome::BrowserListImpl::const_iterator i = ash_browser_list->begin();
215 i != ash_browser_list->end(); ++i) {
216 Browser* browser = *i;
217 browser->window()->Close();
sky 2012/11/29 01:53:27 What if the close is vetoed for some reason?
ananta 2012/11/29 02:39:41 I added a comment explaining this. The CloseAllBro
218 }
219 }
220 }
221
209 void AttemptUserExit() { 222 void AttemptUserExit() {
210 #if defined(OS_CHROMEOS) 223 #if defined(OS_CHROMEOS)
211 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false); 224 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutStarted", false);
212 // Write /tmp/uptime-logout-started as well. 225 // Write /tmp/uptime-logout-started as well.
213 const char kLogoutStarted[] = "logout-started"; 226 const char kLogoutStarted[] = "logout-started";
214 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted); 227 chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted);
215 228
216 // Login screen should show up in owner's locale. 229 // Login screen should show up in owner's locale.
217 PrefService* state = g_browser_process->local_state(); 230 PrefService* state = g_browser_process->local_state();
218 if (state) { 231 if (state) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 MessageLoop::current()) 376 MessageLoop::current())
364 CloseAllBrowsers(); 377 CloseAllBrowsers();
365 } 378 }
366 } 379 }
367 380
368 bool WillKeepAlive() { 381 bool WillKeepAlive() {
369 return g_keep_alive_count > 0; 382 return g_keep_alive_count > 0;
370 } 383 }
371 384
372 } // namespace browser 385 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/lifetime/application_lifetime.h ('k') | chrome/browser/metro_viewer/metro_viewer_process_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698