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

Unified Diff: ash/display/display_controller.cc

Issue 259253002: Add OnDisplayMetricsChanged in DisplayObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_orientation
Patch Set: Created 6 years, 7 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 | « ash/display/display_controller.h ('k') | ash/display/display_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_controller.cc
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index 99c997f246001f49af953691379c99b688772e87..aebe47c29b974cb45d983d4f98cdacea6d312bc3 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()));
« no previous file with comments | « ash/display/display_controller.h ('k') | ash/display/display_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698