Chromium Code Reviews| Index: chrome/browser/browser_process_platform_part_aurawin.cc |
| diff --git a/chrome/browser/browser_process_platform_part_aurawin.cc b/chrome/browser/browser_process_platform_part_aurawin.cc |
| index 99ec0ea2e66def7a476a39c24f28471be8df1f00..ed8b1ce42da17ee619ec41d651e756db6167f898 100644 |
| --- a/chrome/browser/browser_process_platform_part_aurawin.cc |
| +++ b/chrome/browser/browser_process_platform_part_aurawin.cc |
| @@ -6,13 +6,23 @@ |
| #include "base/command_line.h" |
| #include "base/logging.h" |
| +#include "base/prefs/pref_service.h" |
| #include "base/process/kill.h" |
| #include "base/win/windows_version.h" |
| #include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/chrome_notification_types.h" |
| +#include "chrome/browser/first_run/upgrade_util.h" |
| +#include "chrome/browser/first_run/upgrade_util_win.h" |
| +#include "chrome/browser/lifetime/application_lifetime.h" |
| #include "chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h" |
| #include "chrome/common/chrome_switches.h" |
| +#include "chrome/common/pref_names.h" |
| +#include "content/public/browser/notification_service.h" |
| BrowserProcessPlatformPart::BrowserProcessPlatformPart() { |
| + // Close ourselves when the application is shutting down. |
| + registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
| + content::NotificationService::AllSources()); |
| } |
| BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { |
| @@ -43,3 +53,37 @@ void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing( |
| } |
| } |
| } |
| + |
| +void BrowserProcessPlatformPart::Observe( |
| + int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) { |
| + // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent |
| + // background pages are closed when the last referencing frame is closed. |
| + switch (type) { |
|
sky
2014/01/09 16:40:05
nit: no point in a switch statement here with only
zturner
2014/01/10 19:00:26
Done.
|
| + case chrome::NOTIFICATION_APP_TERMINATING: { |
| + if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
|
sky
2014/01/09 16:40:05
If we only care about this for win8, why don't we
zturner
2014/01/10 19:00:26
Done.
|
| + PrefService* pref_service = g_browser_process->local_state(); |
| + bool is_relaunch = pref_service->GetBoolean(prefs::kWasRestarted); |
| + if (is_relaunch) { |
| + upgrade_util::RelaunchMode mode = |
| + upgrade_util::RelaunchModeStringToEnum( |
| + pref_service->GetString(prefs::kRelaunchMode)); |
| + if (metro_viewer_process_host_) { |
| + if (mode == upgrade_util::RELAUNCH_MODE_DESKTOP) { |
| + // Metro -> Desktop |
| + chrome::ActivateDesktopHelper(chrome::ASH_TERMINATE); |
| + } else { |
| + // Metro -> Metro |
| + chrome::MetroExitHelper(); |
| + } |
| + } |
| + } |
| + } |
| + break; |
| + } |
| + default: |
| + NOTREACHED() << "Unexpected notification sent."; |
| + break; |
| + } |
| +} |