summaryrefslogtreecommitdiffstats
path: root/ash/display/display_controller.cc
diff options
context:
space:
mode:
authormlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-20 21:52:35 +0000
committermlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-20 21:52:35 +0000
commit582507170e6f19ead4447a8e098fc58f79ddbfa9 (patch)
treedbdd8f80766f4d95bdc1fa43c32f4d56ebf93b5c /ash/display/display_controller.cc
parentdf3ecfdef1498c99b11ce31e2cd5e7437a341a21 (diff)
downloadchromium_src-582507170e6f19ead4447a8e098fc58f79ddbfa9.zip
chromium_src-582507170e6f19ead4447a8e098fc58f79ddbfa9.tar.gz
chromium_src-582507170e6f19ead4447a8e098fc58f79ddbfa9.tar.bz2
Add OnDisplayMetricsChanged in DisplayObserver.
This replaces OnDisplayBoundsChanged and add a MetricsType parameter so consumers can now which metrics has changed. The current set of MetricsType include bounds, workarea and rotation. BUG=162827 Review URL: https://codereview.chromium.org/259253002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display/display_controller.cc')
-rw-r--r--ash/display/display_controller.cc28
1 files changed, 17 insertions, 11 deletions
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index 99c997f..aebe47c 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -549,15 +549,6 @@ bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow(
return GetDisplayManager()->UpdateWorkAreaOfDisplay(id, insets);
}
-void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) {
- const DisplayInfo& display_info =
- GetDisplayManager()->GetDisplayInfo(display.id());
- DCHECK(!display_info.bounds_in_native().IsEmpty());
- AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()];
- ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native());
- SetDisplayPropertiesOnHost(ash_host, display);
-}
-
void DisplayController::OnDisplayAdded(const gfx::Display& display) {
if (primary_tree_host_for_replace_) {
DCHECK(window_tree_hosts_.empty());
@@ -612,8 +603,9 @@ void DisplayController::OnDisplayRemoved(const gfx::Display& display) {
GetRootWindowSettings(GetWindow(primary_host))->display_id =
primary_display_id;
- OnDisplayBoundsChanged(
- GetDisplayManager()->GetDisplayForId(primary_display_id));
+ OnDisplayMetricsChanged(
+ GetDisplayManager()->GetDisplayForId(primary_display_id),
+ DISPLAY_METRIC_BOUNDS);
}
RootWindowController* controller =
GetRootWindowController(GetWindow(host_to_delete));
@@ -625,6 +617,20 @@ void DisplayController::OnDisplayRemoved(const gfx::Display& display) {
base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller);
}
+void DisplayController::OnDisplayMetricsChanged(const gfx::Display& display,
+ uint32_t metrics) {
+ if (!(metrics & (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_ROTATION |
+ DISPLAY_METRIC_DEVICE_SCALE_FACTOR)))
+ return;
+
+ const DisplayInfo& display_info =
+ GetDisplayManager()->GetDisplayInfo(display.id());
+ DCHECK(!display_info.bounds_in_native().IsEmpty());
+ AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()];
+ ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native());
+ SetDisplayPropertiesOnHost(ash_host, display);
+}
+
void DisplayController::OnHostResized(const aura::WindowTreeHost* host) {
gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow(
const_cast<aura::Window*>(host->window()));