Index: chrome/browser/ui/views/athena/chrome_browser_main_extra_parts_athena.cc |
diff --git a/chrome/browser/ui/views/athena/chrome_browser_main_extra_parts_athena.cc b/chrome/browser/ui/views/athena/chrome_browser_main_extra_parts_athena.cc |
index bbc00c32b55eaf0f9ef6d2d79b7aae55597352de..ad2b24328e8249f409e09609d6667122776d3c79 100644 |
--- a/chrome/browser/ui/views/athena/chrome_browser_main_extra_parts_athena.cc |
+++ b/chrome/browser/ui/views/athena/chrome_browser_main_extra_parts_athena.cc |
@@ -4,23 +4,32 @@ |
#include "chrome/browser/ui/views/athena/chrome_browser_main_extra_parts_athena.h" |
+#include "athena/env/public/athena_env.h" |
#include "athena/extensions/public/extensions_delegate.h" |
#include "athena/main/public/athena_launcher.h" |
#include "base/command_line.h" |
#include "base/macros.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chrome_browser_main_extra_parts.h" |
+#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/lifetime/application_lifetime.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/common/chrome_switches.h" |
#include "content/public/browser/browser_thread.h" |
+#include "content/public/browser/notification_observer.h" |
+#include "content/public/browser/notification_registrar.h" |
+#include "content/public/browser/notification_service.h" |
namespace { |
-class ChromeBrowserMainExtraPartsAthena : public ChromeBrowserMainExtraParts { |
+class ChromeBrowserMainExtraPartsAthena : public ChromeBrowserMainExtraParts, |
+ public content::NotificationObserver { |
public: |
ChromeBrowserMainExtraPartsAthena() { |
+ registrar_.Add(this, |
+ chrome::NOTIFICATION_APP_TERMINATING, |
+ content::NotificationService::AllSources()); |
} |
virtual ~ChromeBrowserMainExtraPartsAthena() {} |
@@ -44,6 +53,19 @@ class ChromeBrowserMainExtraPartsAthena : public ChromeBrowserMainExtraParts { |
} |
virtual void PostMainMessageLoopRun() OVERRIDE { athena::ShutdownAthena(); } |
+ // content::NotificationObserver: |
+ virtual void Observe(int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) OVERRIDE { |
+ switch (type) { |
+ case chrome::NOTIFICATION_APP_TERMINATING: |
+ athena::AthenaEnv::Get()->OnTerminating(); |
+ break; |
+ } |
+ } |
+ |
+ content::NotificationRegistrar registrar_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAthena); |
}; |