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

Side by Side Diff: ash/mus/root_window_controller.cc

Issue 2434923002: Handle modified displays in mustash. (Closed)
Patch Set: Fixes after initial review. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/mus/root_window_controller.h" 5 #include "ash/mus/root_window_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 20 matching lines...) Expand all
31 #include "base/command_line.h" 31 #include "base/command_line.h"
32 #include "base/memory/ptr_util.h" 32 #include "base/memory/ptr_util.h"
33 #include "mojo/public/cpp/bindings/type_converter.h" 33 #include "mojo/public/cpp/bindings/type_converter.h"
34 #include "services/service_manager/public/cpp/connector.h" 34 #include "services/service_manager/public/cpp/connector.h"
35 #include "services/ui/common/switches.h" 35 #include "services/ui/common/switches.h"
36 #include "services/ui/common/util.h" 36 #include "services/ui/common/util.h"
37 #include "services/ui/public/cpp/property_type_converters.h" 37 #include "services/ui/public/cpp/property_type_converters.h"
38 #include "services/ui/public/cpp/window.h" 38 #include "services/ui/public/cpp/window.h"
39 #include "services/ui/public/cpp/window_property.h" 39 #include "services/ui/public/cpp/window_property.h"
40 #include "services/ui/public/cpp/window_tree_client.h" 40 #include "services/ui/public/cpp/window_tree_client.h"
41 #include "services/ui/public/interfaces/display/display_controller.mojom.h"
41 #include "ui/display/display_list.h" 42 #include "ui/display/display_list.h"
42 #include "ui/display/screen_base.h" 43 #include "ui/display/screen_base.h"
43 44
44 namespace ash { 45 namespace ash {
45 namespace mus { 46 namespace mus {
46 47
47 RootWindowController::RootWindowController(WindowManager* window_manager, 48 RootWindowController::RootWindowController(WindowManager* window_manager,
48 ui::Window* root, 49 ui::Window* root,
49 const display::Display& display) 50 const display::Display& display)
50 : window_manager_(window_manager), 51 : window_manager_(window_manager),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 120
120 return window; 121 return window;
121 } 122 }
122 123
123 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) { 124 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) {
124 return WmWindowMus::AsWmWindowMus( 125 return WmWindowMus::AsWmWindowMus(
125 WmWindowMus::Get(root_)->GetChildByShellWindowId(id)); 126 WmWindowMus::Get(root_)->GetChildByShellWindowId(id));
126 } 127 }
127 128
128 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) { 129 void RootWindowController::SetWorkAreaInests(const gfx::Insets& insets) {
130 gfx::Rect old_work_area = display_.work_area();
129 display_.UpdateWorkAreaFromInsets(insets); 131 display_.UpdateWorkAreaFromInsets(insets);
132
133 if (old_work_area == display_.work_area())
134 return;
135
130 display::DisplayList* display_list = 136 display::DisplayList* display_list =
131 window_manager_->screen()->display_list(); 137 window_manager_->screen()->display_list();
132 auto iter = display_list->FindDisplayById(display_.id()); 138 display_list->UpdateDisplay(display_);
133 DCHECK(iter != display_list->displays().end()); 139
134 const display::DisplayList::Type display_type = 140 // Push new display insets to service:ui.
135 iter == display_list->GetPrimaryDisplayIterator() 141 display::mojom::DisplayControllerPtr display_controller;
sky 2016/10/19 23:37:59 Can you make WindowManager maintain a single conne
kylechar 2016/10/20 15:04:19 Done.
136 ? display::DisplayList::Type::PRIMARY 142 GetConnector()->ConnectToInterface("service:ui", &display_controller);
137 : display::DisplayList::Type::NOT_PRIMARY; 143 display_controller->SetDisplayWorkArea(display_.id(),
138 display_list->UpdateDisplay(display_, display_type); 144 display_.bounds().size(), insets);
139 // TODO(kylechar): needs to push to DisplayController.
140 NOTIMPLEMENTED();
141 } 145 }
142 146
143 gfx::Rect RootWindowController::CalculateDefaultBounds( 147 gfx::Rect RootWindowController::CalculateDefaultBounds(
144 ui::Window* window) const { 148 ui::Window* window) const {
145 if (window->HasSharedProperty( 149 if (window->HasSharedProperty(
146 ui::mojom::WindowManager::kInitialBounds_Property)) { 150 ui::mojom::WindowManager::kInitialBounds_Property)) {
147 return window->GetSharedProperty<gfx::Rect>( 151 return window->GetSharedProperty<gfx::Rect>(
148 ui::mojom::WindowManager::kInitialBounds_Property); 152 ui::mojom::WindowManager::kInitialBounds_Property);
149 } 153 }
150 154
(...skipping 19 matching lines...) Expand all
170 void RootWindowController::CreateLayoutManagers() { 174 void RootWindowController::CreateLayoutManagers() {
171 // Override the default layout managers for certain containers. 175 // Override the default layout managers for certain containers.
172 WmWindowMus* lock_screen_container = 176 WmWindowMus* lock_screen_container =
173 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer); 177 GetWindowByShellWindowId(kShellWindowId_LockScreenContainer);
174 layout_managers_[lock_screen_container->mus_window()].reset( 178 layout_managers_[lock_screen_container->mus_window()].reset(
175 new ScreenlockLayout(lock_screen_container->mus_window())); 179 new ScreenlockLayout(lock_screen_container->mus_window()));
176 } 180 }
177 181
178 } // namespace mus 182 } // namespace mus
179 } // namespace ash 183 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698