diff options
author | phweiss <phweiss@chromium.org> | 2015-11-17 04:56:18 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-17 12:56:59 +0000 |
commit | 0bf64c504eb4e7c22daad3518427c3dfc6cd00d4 (patch) | |
tree | 31df3d62b549234ed96c73a65d7a581afa3c0842 /ash | |
parent | 449769316764e3922e50920bb62b186221301e47 (diff) | |
download | chromium_src-0bf64c504eb4e7c22daad3518427c3dfc6cd00d4.zip chromium_src-0bf64c504eb4e7c22daad3518427c3dfc6cd00d4.tar.gz chromium_src-0bf64c504eb4e7c22daad3518427c3dfc6cd00d4.tar.bz2 |
Implement device policy DisplayRotationDefault
The policy affects all displays on every reboot and when it changes its value.
The user is able to rotate the display to a different orientation any time, but
will have to do so on every reboot while the policy is in effect.
It is enforced by the new class DisplayRotationDefaultHandler, which is created
in the PreInit()-method of ChromeShellDelegate. It registers itself as observer
with the WindowTreeHostManager for display changes, and with CrosSettings for
policy changes. It is destroyed via the new OnShutdown()-function of
WindowTreeHostManager::Observer.
BUG=499842
TEST=browsertest
Review URL: https://codereview.chromium.org/1388353002
Cr-Commit-Position: refs/heads/master@{#360069}
Diffstat (limited to 'ash')
-rw-r--r-- | ash/display/window_tree_host_manager.cc | 2 | ||||
-rw-r--r-- | ash/display/window_tree_host_manager.h | 7 | ||||
-rw-r--r-- | ash/shell.cc | 2 | ||||
-rw-r--r-- | ash/shell_observer.h | 3 |
4 files changed, 12 insertions, 2 deletions
diff --git a/ash/display/window_tree_host_manager.cc b/ash/display/window_tree_host_manager.cc index af7d17c..aabf1b2 100644 --- a/ash/display/window_tree_host_manager.cc +++ b/ash/display/window_tree_host_manager.cc @@ -286,6 +286,8 @@ void WindowTreeHostManager::Start() { } void WindowTreeHostManager::Shutdown() { + FOR_EACH_OBSERVER(Observer, observers_, OnWindowTreeHostManagerShutdown()); + // Unset the display manager's delegate here because // DisplayManager outlives WindowTreeHostManager. Shell::GetInstance()->display_manager()->set_delegate(nullptr); diff --git a/ash/display/window_tree_host_manager.h b/ash/display/window_tree_host_manager.h index 5d27699..67ae28d 100644 --- a/ash/display/window_tree_host_manager.h +++ b/ash/display/window_tree_host_manager.h @@ -72,7 +72,10 @@ class ASH_EXPORT WindowTreeHostManager // Invoked when the all display configuration changes // have been applied. - virtual void OnDisplayConfigurationChanged(){}; + virtual void OnDisplayConfigurationChanged() {} + + // Invoked in WindowTreeHostManager::Shutdown(). + virtual void OnWindowTreeHostManagerShutdown() {} protected: virtual ~Observer() {} @@ -225,7 +228,7 @@ class ASH_EXPORT WindowTreeHostManager // The mapping from display ID to its window tree host. WindowTreeHostMap window_tree_hosts_; - base::ObserverList<Observer> observers_; + base::ObserverList<Observer, true> observers_; // Store the primary window tree host temporarily while replacing // display. diff --git a/ash/shell.cc b/ash/shell.cc index 27697f6..b021e7b 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -1077,6 +1077,8 @@ void Shell::Init(const ShellInitParams& init_params) { // is started. display_manager_->CreateMirrorWindowAsyncIfAny(); + FOR_EACH_OBSERVER(ShellObserver, observers_, OnShellInitialized()); + user_metrics_recorder_->OnShellInitialized(); } diff --git a/ash/shell_observer.h b/ash/shell_observer.h index 3ea105b..da53428 100644 --- a/ash/shell_observer.h +++ b/ash/shell_observer.h @@ -63,6 +63,9 @@ class ASH_EXPORT ShellObserver { // animating but have been restored. virtual void OnMaximizeModeEnded() {} + // Called at the end of Shell::Init. + virtual void OnShellInitialized() {} + protected: virtual ~ShellObserver() {} }; |