| 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 #import "chrome/browser/chrome_browser_application_mac.h" | 5 #import "chrome/browser/chrome_browser_application_mac.h" |
| 6 | 6 |
| 7 #import "base/auto_reset.h" | 7 #import "base/auto_reset.h" |
| 8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
| 9 #import "base/logging.h" | 9 #import "base/logging.h" |
| 10 #import "base/mac/scoped_nsexception_enabler.h" | 10 #import "base/mac/scoped_nsexception_enabler.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 // |-applicationShouldTerminate:| in that no special event loop is run in the | 323 // |-applicationShouldTerminate:| in that no special event loop is run in the |
| 324 // case that immediate termination is not possible (e.g., if dialog boxes | 324 // case that immediate termination is not possible (e.g., if dialog boxes |
| 325 // allowing the user to cancel have to be shown). Instead, this method sets a | 325 // allowing the user to cancel have to be shown). Instead, this method sets a |
| 326 // flag and tries to close all browsers. This flag causes the closure of the | 326 // flag and tries to close all browsers. This flag causes the closure of the |
| 327 // final browser window to begin actual tear-down of the application. | 327 // final browser window to begin actual tear-down of the application. |
| 328 // Termination is cancelled by resetting this flag. The standard | 328 // Termination is cancelled by resetting this flag. The standard |
| 329 // |-applicationShouldTerminate:| is not supported, and code paths leading to it | 329 // |-applicationShouldTerminate:| is not supported, and code paths leading to it |
| 330 // must be redirected. | 330 // must be redirected. |
| 331 // | 331 // |
| 332 // When the last browser has been destroyed, the BrowserList calls | 332 // When the last browser has been destroyed, the BrowserList calls |
| 333 // browser::OnAppExiting(), which is the point of no return. That will cause | 333 // chrome::OnAppExiting(), which is the point of no return. That will cause |
| 334 // the NSApplicationWillTerminateNotification to be posted, which ends the | 334 // the NSApplicationWillTerminateNotification to be posted, which ends the |
| 335 // NSApplication event loop, so final post- MessageLoop::Run() work is done | 335 // NSApplication event loop, so final post- MessageLoop::Run() work is done |
| 336 // before exiting. | 336 // before exiting. |
| 337 - (void)terminate:(id)sender { | 337 - (void)terminate:(id)sender { |
| 338 AppController* appController = static_cast<AppController*>([NSApp delegate]); | 338 AppController* appController = static_cast<AppController*>([NSApp delegate]); |
| 339 [appController tryToTerminateApplication:self]; | 339 [appController tryToTerminateApplication:self]; |
| 340 // Return, don't exit. The application is responsible for exiting on its own. | 340 // Return, don't exit. The application is responsible for exiting on its own. |
| 341 } | 341 } |
| 342 | 342 |
| 343 - (void)cancelTerminate:(id)sender { | 343 - (void)cancelTerminate:(id)sender { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 std::vector<NSWindow*>::iterator window_iterator = | 568 std::vector<NSWindow*>::iterator window_iterator = |
| 569 std::find(previousKeyWindows_.begin(), | 569 std::find(previousKeyWindows_.begin(), |
| 570 previousKeyWindows_.end(), | 570 previousKeyWindows_.end(), |
| 571 window); | 571 window); |
| 572 if (window_iterator != previousKeyWindows_.end()) { | 572 if (window_iterator != previousKeyWindows_.end()) { |
| 573 previousKeyWindows_.erase(window_iterator); | 573 previousKeyWindows_.erase(window_iterator); |
| 574 } | 574 } |
| 575 } | 575 } |
| 576 | 576 |
| 577 @end | 577 @end |
| OLD | NEW |