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

Side by Side Diff: chrome/browser/browser_list.cc

Issue 269048: SIGTERM should cause the application to exit on the Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 2 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
« no previous file with comments | « chrome/browser/browser_list.h ('k') | chrome/browser/browser_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_list.h" 5 #include "chrome/browser/browser_list.h"
6 6
7 #include "base/histogram.h" 7 #include "base/histogram.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/browser_window.h" 13 #include "chrome/browser/browser_window.h"
14 #include "chrome/browser/profile_manager.h" 14 #include "chrome/browser/profile_manager.h"
15 #include "chrome/browser/tab_contents/navigation_controller.h" 15 #include "chrome/browser/tab_contents/navigation_controller.h"
16 #include "chrome/common/notification_registrar.h" 16 #include "chrome/common/notification_registrar.h"
17 #include "chrome/common/notification_service.h" 17 #include "chrome/common/notification_service.h"
18 #include "chrome/common/result_codes.h" 18 #include "chrome/common/result_codes.h"
19 19
20 #if defined(OS_MACOSX)
21 #include "chrome/browser/chrome_application_mac.h"
22 #endif
23
20 namespace { 24 namespace {
21 25
22 // This object is instantiated when the first Browser object is added to the 26 // This object is instantiated when the first Browser object is added to the
23 // list and delete when the last one is removed. It watches for loads and 27 // list and delete when the last one is removed. It watches for loads and
24 // creates histograms of some global object counts. 28 // creates histograms of some global object counts.
25 class BrowserActivityObserver : public NotificationObserver { 29 class BrowserActivityObserver : public NotificationObserver {
26 public: 30 public:
27 BrowserActivityObserver() { 31 BrowserActivityObserver() {
28 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, 32 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
29 NotificationService::AllSources()); 33 NotificationService::AllSources());
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // Destroying the browser should have removed it from the browser list. 183 // Destroying the browser should have removed it from the browser list.
180 // We should never get here. 184 // We should never get here.
181 NOTREACHED(); 185 NOTREACHED();
182 return; 186 return;
183 } 187 }
184 } 188 }
185 } 189 }
186 } 190 }
187 191
188 // static 192 // static
193 void BrowserList::CloseAllBrowsersAndExit() {
194 #if !defined(OS_MACOSX)
195 // On most platforms, closing all windows causes the application to exit.
196 CloseAllBrowsers(true);
197 #else
198 // On the Mac, the application continues to run once all windows are closed.
199 // Terminate will result in a CloseAllBrowsers(true) call, and additionally,
200 // will cause the application to exit cleanly.
201 CrApplicationCC::Terminate();
202 #endif
203 }
204
205 // static
189 void BrowserList::WindowsSessionEnding() { 206 void BrowserList::WindowsSessionEnding() {
190 // EndSession is invoked once per frame. Only do something the first time. 207 // EndSession is invoked once per frame. Only do something the first time.
191 static bool already_ended = false; 208 static bool already_ended = false;
192 if (already_ended) 209 if (already_ended)
193 return; 210 return;
194 already_ended = true; 211 already_ended = true;
195 212
196 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); 213 browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION);
197 214
198 // Write important data first. 215 // Write important data first.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 391 }
375 392
376 TabContents* next_tab = 393 TabContents* next_tab =
377 (*browser_iterator_)->GetTabContentsAt(web_view_index_); 394 (*browser_iterator_)->GetTabContentsAt(web_view_index_);
378 if (next_tab) { 395 if (next_tab) {
379 cur_ = next_tab; 396 cur_ = next_tab;
380 return; 397 return;
381 } 398 }
382 } 399 }
383 } 400 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_list.h ('k') | chrome/browser/browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698