Home | History | Annotate | Download | only in lifetime
      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
      3 // found in the LICENSE file.
      4 
      5 // This file contains the penultimate pieces of the Mac shutdown puzzle. For
      6 // an in-depth overview of the Mac shutdown path, see the comment above
      7 // -[BrowserCrApplication terminate:].
      8 
      9 #include "chrome/browser/lifetime/application_lifetime.h"
     10 
     11 #include "base/logging.h"
     12 #include "chrome/browser/browser_shutdown.h"
     13 #import "chrome/browser/chrome_browser_application_mac.h"
     14 
     15 namespace chrome {
     16 
     17 // At this point, the user is trying to quit (or the system is forcing the
     18 // application to quit) and all browsers have been successfully closed. The
     19 // final step in shutdown is to post the NSApplicationWillTerminateNotification
     20 // to end the -[NSApplication run] event loop.
     21 void HandleAppExitingForPlatform() {
     22   static bool kill_me_now = false;
     23   CHECK(!kill_me_now);
     24   kill_me_now = true;
     25 
     26   [[NSNotificationCenter defaultCenter]
     27       postNotificationName:NSApplicationWillTerminateNotification
     28                     object:NSApp];
     29 }
     30 
     31 }  // namespace chrome
     32