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

Unified Diff: chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc

Issue 137193004: Save display preference on boot (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
index 4353f1f31d2c83c59f85f97e6fd97a7457129d3f..9853ac8fda53d94559ef1b398f4b095098acd2de 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h"
+#include "chrome/browser/chromeos/display/display_configuration_observer.h"
#include "chrome/browser/chromeos/display/display_preferences.h"
#include "chrome/browser/chromeos/extensions/media_player_api.h"
#include "chrome/browser/chromeos/extensions/media_player_event_router.h"
@@ -207,6 +208,10 @@ bool ChromeShellDelegate::IsFirstRunAfterBoot() const {
void ChromeShellDelegate::PreInit() {
chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot());
+ // Set the observer now so that we can save the initial state
+ // in Shell::Init.
+ display_configuration_observer_.reset(
+ new chromeos::DisplayConfigurationObserver());
}
void ChromeShellDelegate::Shutdown() {
@@ -256,6 +261,11 @@ void ChromeShellDelegate::Observe(int type,
RestoreFocus();
ash::Shell::GetInstance()->ShowShelf();
break;
+ case chrome::NOTIFICATION_APP_TERMINATING:
+ // Let classes unregister themselves as observers of the
+ // ash::Shell singleton before the shell is destroyed.
+ display_configuration_observer_.reset();
+ break;
default:
NOTREACHED() << "Unexpected notification " << type;
}
@@ -268,4 +278,7 @@ void ChromeShellDelegate::PlatformInit() {
registrar_.Add(this,
chrome::NOTIFICATION_SESSION_STARTED,
content::NotificationService::AllSources());
+ registrar_.Add(this,
+ chrome::NOTIFICATION_APP_TERMINATING,
+ content::NotificationService::AllSources());
}
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698