| Index: ash/display/display_controller.cc
|
| diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
|
| index 16ee88ca900717390d58ab4d824ed5df8faf5193..c5b5e66c4060d434e4a78bb5a257dbd3b0f4370f 100644
|
| --- a/ash/display/display_controller.cc
|
| +++ b/ash/display/display_controller.cc
|
| @@ -180,6 +180,14 @@ void DisplayController::InitSecondaryDisplays() {
|
| UpdateDisplayBoundsForLayout();
|
| }
|
|
|
| +void DisplayController::AddObserver(Observer* observer) {
|
| + observers_.AddObserver(observer);
|
| +}
|
| +
|
| +void DisplayController::RemoveObserver(Observer* observer) {
|
| + observers_.RemoveObserver(observer);
|
| +}
|
| +
|
| aura::RootWindow* DisplayController::GetPrimaryRootWindow() {
|
| DCHECK(!root_windows_.empty());
|
| aura::DisplayManager* display_manager =
|
| @@ -233,14 +241,23 @@ DisplayController::GetAllRootWindowControllers() {
|
| }
|
|
|
| void DisplayController::SetDefaultDisplayLayout(const DisplayLayout& layout) {
|
| - default_display_layout_ = layout;
|
| - UpdateDisplayBoundsForLayout();
|
| + if (default_display_layout_.position != layout.position ||
|
| + default_display_layout_.offset != layout.offset) {
|
| + default_display_layout_ = layout;
|
| + NotifyDisplayConfigurationChanging();
|
| + UpdateDisplayBoundsForLayout();
|
| + }
|
| }
|
|
|
| void DisplayController::SetLayoutForDisplayName(const std::string& name,
|
| const DisplayLayout& layout) {
|
| - secondary_layouts_[name] = layout;
|
| - UpdateDisplayBoundsForLayout();
|
| + DisplayLayout& display_for_name = secondary_layouts_[name];
|
| + if (display_for_name.position != layout.position ||
|
| + display_for_name.offset != layout.offset) {
|
| + secondary_layouts_[name] = layout;
|
| + NotifyDisplayConfigurationChanging();
|
| + UpdateDisplayBoundsForLayout();
|
| + }
|
| }
|
|
|
| const DisplayLayout& DisplayController::GetLayoutForDisplayName(
|
| @@ -254,12 +271,14 @@ const DisplayLayout& DisplayController::GetLayoutForDisplayName(
|
| }
|
|
|
| void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) {
|
| + NotifyDisplayConfigurationChanging();
|
| root_windows_[display.id()]->SetHostBounds(display.bounds_in_pixel());
|
| UpdateDisplayBoundsForLayout();
|
| }
|
|
|
| void DisplayController::OnDisplayAdded(const gfx::Display& display) {
|
| DCHECK(!root_windows_.empty());
|
| + NotifyDisplayConfigurationChanging();
|
| aura::RootWindow* root = AddRootWindowForDisplay(display);
|
| Shell::GetInstance()->InitRootWindowForSecondaryDisplay(root);
|
| UpdateDisplayBoundsForLayout();
|
| @@ -270,6 +289,7 @@ void DisplayController::OnDisplayRemoved(const gfx::Display& display) {
|
| DCHECK(root);
|
| // Primary display should never be removed by DisplayManager.
|
| DCHECK(root != GetPrimaryRootWindow());
|
| + NotifyDisplayConfigurationChanging();
|
| // Display for root window will be deleted when the Primary RootWindow
|
| // is deleted by the Shell.
|
| if (root != GetPrimaryRootWindow()) {
|
| @@ -357,4 +377,8 @@ void DisplayController::UpdateDisplayBoundsForLayout() {
|
| secondary_display->UpdateWorkAreaFromInsets(insets);
|
| }
|
|
|
| +void DisplayController::NotifyDisplayConfigurationChanging() {
|
| + FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging());
|
| +}
|
| +
|
| } // namespace ash
|
|
|