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

Unified Diff: chrome/browser/browser_process_platform_part_aurawin.cc

Issue 130223002: Have browser process shutdown metro viewer on Metro -> Metro restart. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use scoped_ptr.get() instead of relying on conversion. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
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..d1a00bcbe7474c65d31cdbdc856a0feaca64788e 100644
--- a/chrome/browser/browser_process_platform_part_aurawin.cc
+++ b/chrome/browser/browser_process_platform_part_aurawin.cc
@@ -6,13 +6,27 @@
#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"
+
+#include "ui/aura/remote_root_window_host_win.h"
BrowserProcessPlatformPart::BrowserProcessPlatformPart() {
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
+ // Tell metro viewer to close when we are shutting down.
+ registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
+ content::NotificationService::AllSources());
+ }
}
BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {
@@ -43,3 +57,27 @@ void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing(
}
}
}
+
+void BrowserProcessPlatformPart::Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+
+ DCHECK(type == chrome::NOTIFICATION_APP_TERMINATING);
+ 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_.get()) {
+ if (mode == upgrade_util::RELAUNCH_MODE_DESKTOP) {
+ // Metro -> Desktop
+ chrome::ActivateDesktopHelper(chrome::ASH_TERMINATE);
+ } else {
+ // Metro -> Metro
+ aura::HandleMetroExit();
+ }
+ }
+ }
+}
« no previous file with comments | « chrome/browser/browser_process_platform_part_aurawin.h ('k') | chrome/browser/lifetime/browser_close_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698