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

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

Issue 2182633011: Replaces ::ui:: with ui:: in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « ash/mus/root_window_controller.h ('k') | ash/mus/screenlock_layout.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 private: 72 private:
73 WmRootWindowControllerMus* root_window_controller_; 73 WmRootWindowControllerMus* root_window_controller_;
74 74
75 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerDelegateImpl); 75 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerDelegateImpl);
76 }; 76 };
77 77
78 } // namespace 78 } // namespace
79 79
80 RootWindowController::RootWindowController(WindowManager* window_manager, 80 RootWindowController::RootWindowController(WindowManager* window_manager,
81 ::ui::Window* root, 81 ui::Window* root,
82 const display::Display& display) 82 const display::Display& display)
83 : window_manager_(window_manager), 83 : window_manager_(window_manager),
84 root_(root), 84 root_(root),
85 window_count_(0), 85 window_count_(0),
86 display_(display) { 86 display_(display) {
87 wm_root_window_controller_.reset( 87 wm_root_window_controller_.reset(
88 new WmRootWindowControllerMus(window_manager_->shell(), this)); 88 new WmRootWindowControllerMus(window_manager_->shell(), this));
89 89
90 root_window_controller_common_.reset( 90 root_window_controller_common_.reset(
91 new RootWindowControllerCommon(WmWindowMus::Get(root_))); 91 new RootWindowControllerCommon(WmWindowMus::Get(root_)));
(...skipping 17 matching lines...) Expand all
109 always_on_top_controller_.reset( 109 always_on_top_controller_.reset(
110 new AlwaysOnTopController(always_on_top_container)); 110 new AlwaysOnTopController(always_on_top_container));
111 } 111 }
112 112
113 RootWindowController::~RootWindowController() {} 113 RootWindowController::~RootWindowController() {}
114 114
115 shell::Connector* RootWindowController::GetConnector() { 115 shell::Connector* RootWindowController::GetConnector() {
116 return window_manager_->connector(); 116 return window_manager_->connector();
117 } 117 }
118 118
119 ::ui::Window* RootWindowController::NewTopLevelWindow( 119 ui::Window* RootWindowController::NewTopLevelWindow(
120 std::map<std::string, std::vector<uint8_t>>* properties) { 120 std::map<std::string, std::vector<uint8_t>>* properties) {
121 // TODO(sky): panels need a different frame, http:://crbug.com/614362. 121 // TODO(sky): panels need a different frame, http:://crbug.com/614362.
122 const bool provide_non_client_frame = 122 const bool provide_non_client_frame =
123 GetWindowType(*properties) == ::ui::mojom::WindowType::WINDOW || 123 GetWindowType(*properties) == ui::mojom::WindowType::WINDOW ||
124 GetWindowType(*properties) == ::ui::mojom::WindowType::PANEL; 124 GetWindowType(*properties) == ui::mojom::WindowType::PANEL;
125 if (provide_non_client_frame) 125 if (provide_non_client_frame)
126 (*properties)[::ui::mojom::kWaitForUnderlay_Property].clear(); 126 (*properties)[ui::mojom::kWaitForUnderlay_Property].clear();
127 127
128 // TODO(sky): constrain and validate properties before passing to server. 128 // TODO(sky): constrain and validate properties before passing to server.
129 ::ui::Window* window = root_->window_tree()->NewWindow(properties); 129 ui::Window* window = root_->window_tree()->NewWindow(properties);
130 window->SetBounds(CalculateDefaultBounds(window)); 130 window->SetBounds(CalculateDefaultBounds(window));
131 131
132 ::ui::Window* container_window = nullptr; 132 ui::Window* container_window = nullptr;
133 mojom::Container container; 133 mojom::Container container;
134 if (GetRequestedContainer(window, &container)) { 134 if (GetRequestedContainer(window, &container)) {
135 container_window = GetWindowForContainer(container); 135 container_window = GetWindowForContainer(container);
136 } else { 136 } else {
137 // TODO(sky): window->bounds() isn't quite right. 137 // TODO(sky): window->bounds() isn't quite right.
138 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent( 138 container_window = WmWindowMus::GetMusWindow(wm::GetDefaultParent(
139 WmWindowMus::Get(root_), WmWindowMus::Get(window), window->bounds())); 139 WmWindowMus::Get(root_), WmWindowMus::Get(window), window->bounds()));
140 } 140 }
141 DCHECK(WmWindowMus::Get(container_window)->IsContainer()); 141 DCHECK(WmWindowMus::Get(container_window)->IsContainer());
142 142
143 if (provide_non_client_frame) { 143 if (provide_non_client_frame) {
144 NonClientFrameController::Create(GetConnector(), container_window, window, 144 NonClientFrameController::Create(GetConnector(), container_window, window,
145 window_manager_->window_manager_client()); 145 window_manager_->window_manager_client());
146 } else { 146 } else {
147 container_window->AddChild(window); 147 container_window->AddChild(window);
148 } 148 }
149 149
150 window_count_++; 150 window_count_++;
151 151
152 return window; 152 return window;
153 } 153 }
154 154
155 ::ui::Window* RootWindowController::GetWindowForContainer(Container container) { 155 ui::Window* RootWindowController::GetWindowForContainer(Container container) {
156 WmWindowMus* wm_window = 156 WmWindowMus* wm_window =
157 GetWindowByShellWindowId(MashContainerToAshShellWindowId(container)); 157 GetWindowByShellWindowId(MashContainerToAshShellWindowId(container));
158 DCHECK(wm_window); 158 DCHECK(wm_window);
159 return wm_window->mus_window(); 159 return wm_window->mus_window();
160 } 160 }
161 161
162 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) { 162 WmWindowMus* RootWindowController::GetWindowByShellWindowId(int id) {
163 return WmWindowMus::AsWmWindowMus( 163 return WmWindowMus::AsWmWindowMus(
164 WmWindowMus::Get(root_)->GetChildByShellWindowId(id)); 164 WmWindowMus::Get(root_)->GetChildByShellWindowId(id));
165 } 165 }
166 166
167 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { 167 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
168 return static_cast<ShelfLayoutManager*>( 168 return static_cast<ShelfLayoutManager*>(
169 layout_managers_[GetWindowForContainer(Container::USER_PRIVATE_SHELF)] 169 layout_managers_[GetWindowForContainer(Container::USER_PRIVATE_SHELF)]
170 .get()); 170 .get());
171 } 171 }
172 172
173 StatusLayoutManager* RootWindowController::GetStatusLayoutManager() { 173 StatusLayoutManager* RootWindowController::GetStatusLayoutManager() {
174 return static_cast<StatusLayoutManager*>( 174 return static_cast<StatusLayoutManager*>(
175 layout_managers_[GetWindowForContainer(Container::STATUS)].get()); 175 layout_managers_[GetWindowForContainer(Container::STATUS)].get());
176 } 176 }
177 177
178 gfx::Rect RootWindowController::CalculateDefaultBounds( 178 gfx::Rect RootWindowController::CalculateDefaultBounds(
179 ::ui::Window* window) const { 179 ui::Window* window) const {
180 if (window->HasSharedProperty( 180 if (window->HasSharedProperty(
181 ::ui::mojom::WindowManager::kInitialBounds_Property)) { 181 ui::mojom::WindowManager::kInitialBounds_Property)) {
182 return window->GetSharedProperty<gfx::Rect>( 182 return window->GetSharedProperty<gfx::Rect>(
183 ::ui::mojom::WindowManager::kInitialBounds_Property); 183 ui::mojom::WindowManager::kInitialBounds_Property);
184 } 184 }
185 185
186 if (GetWindowShowState(window) == ui::mojom::ShowState::FULLSCREEN) { 186 if (GetWindowShowState(window) == ui::mojom::ShowState::FULLSCREEN) {
187 return gfx::Rect(0, 0, root_->bounds().width(), root_->bounds().height()); 187 return gfx::Rect(0, 0, root_->bounds().width(), root_->bounds().height());
188 } 188 }
189 189
190 int width, height; 190 int width, height;
191 const gfx::Size pref = GetWindowPreferredSize(window); 191 const gfx::Size pref = GetWindowPreferredSize(window);
192 if (pref.IsEmpty()) { 192 if (pref.IsEmpty()) {
193 width = root_->bounds().width() - 240; 193 width = root_->bounds().width() - 240;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 base::WrapUnique(new DockedWindowLayoutManager(docked_container))); 261 base::WrapUnique(new DockedWindowLayoutManager(docked_container)));
262 262
263 WmWindowMus* panel_container = 263 WmWindowMus* panel_container =
264 GetWindowByShellWindowId(kShellWindowId_PanelContainer); 264 GetWindowByShellWindowId(kShellWindowId_PanelContainer);
265 panel_container->SetLayoutManager( 265 panel_container->SetLayoutManager(
266 base::WrapUnique(new PanelLayoutManager(panel_container))); 266 base::WrapUnique(new PanelLayoutManager(panel_container)));
267 } 267 }
268 268
269 } // namespace mus 269 } // namespace mus
270 } // namespace ash 270 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/root_window_controller.h ('k') | ash/mus/screenlock_layout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698