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

Side by Side Diff: ui/views/mus/native_widget_mus.cc

Issue 1423133003: Routes calls to WM through WS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no braces Created 5 years, 1 month 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 | « ui/views/mus/native_widget_mus.h ('k') | ui/views/mus/window_manager_connection.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/views/mus/native_widget_mus.h" 5 #include "ui/views/mus/native_widget_mus.h"
6 6
7 #include "components/mus/public/cpp/window.h" 7 #include "components/mus/public/cpp/window.h"
8 #include "components/mus/public/interfaces/window_manager.mojom.h" 8 #include "components/mus/public/interfaces/window_manager.mojom.h"
9 #include "mojo/converters/geometry/geometry_type_converters.h" 9 #include "mojo/converters/geometry/geometry_type_converters.h"
10 #include "ui/aura/client/default_capture_client.h" 10 #include "ui/aura/client/default_capture_client.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const gfx::Rect& requested_bounds) override { 54 const gfx::Rect& requested_bounds) override {
55 SetChildBoundsDirect(child, requested_bounds); 55 SetChildBoundsDirect(child, requested_bounds);
56 } 56 }
57 57
58 aura::Window* outer_; 58 aura::Window* outer_;
59 aura::Window* inner_; 59 aura::Window* inner_;
60 60
61 DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager); 61 DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager);
62 }; 62 };
63 63
64 void WindowManagerCallback(mus::mojom::WindowManagerErrorCode error_code) {}
65
66 } // namespace 64 } // namespace
67 65
68 //////////////////////////////////////////////////////////////////////////////// 66 ////////////////////////////////////////////////////////////////////////////////
69 // NativeWidgetMus, public: 67 // NativeWidgetMus, public:
70 68
71 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate, 69 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate,
72 mojo::Shell* shell, 70 mojo::Shell* shell,
73 mus::Window* window) 71 mus::Window* window)
74 : window_(window), 72 : window_(window),
75 shell_(shell), 73 shell_(shell),
76 native_widget_delegate_(delegate), 74 native_widget_delegate_(delegate),
77 window_manager_(nullptr),
78 show_state_before_fullscreen_(mus::mojom::SHOW_STATE_RESTORED), 75 show_state_before_fullscreen_(mus::mojom::SHOW_STATE_RESTORED),
79 content_(new aura::Window(this)) {} 76 content_(new aura::Window(this)) {}
80 NativeWidgetMus::~NativeWidgetMus() {} 77 NativeWidgetMus::~NativeWidgetMus() {}
81 78
82 //////////////////////////////////////////////////////////////////////////////// 79 ////////////////////////////////////////////////////////////////////////////////
83 // NativeWidgetMus, private: 80 // NativeWidgetMus, private:
84 81
85 void NativeWidgetMus::UpdateClientAreaInWindowManager() { 82 void NativeWidgetMus::UpdateClientAreaInWindowManager() {
86 NonClientView* non_client_view = 83 NonClientView* non_client_view =
87 native_widget_delegate_->AsWidget()->non_client_view(); 84 native_widget_delegate_->AsWidget()->non_client_view();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 bool NativeWidgetMus::HasCapture() const { 197 bool NativeWidgetMus::HasCapture() const {
201 return window_tree_host_->window()->HasCapture(); 198 return window_tree_host_->window()->HasCapture();
202 } 199 }
203 200
204 ui::InputMethod* NativeWidgetMus::GetInputMethod() { 201 ui::InputMethod* NativeWidgetMus::GetInputMethod() {
205 return window_tree_host_->GetInputMethod(); 202 return window_tree_host_->GetInputMethod();
206 } 203 }
207 204
208 void NativeWidgetMus::CenterWindow(const gfx::Size& size) { 205 void NativeWidgetMus::CenterWindow(const gfx::Size& size) {
209 // TODO(beng): clear user-placed property and set preferred size property. 206 // TODO(beng): clear user-placed property and set preferred size property.
210 if (!window_manager_) 207 window_->SetPreferredSize(size);
211 return;
212 window_manager_->SetPreferredSize(window_tree_host_->mus_window()->id(),
213 mojo::Size::From(size),
214 base::Bind(&WindowManagerCallback));
215 } 208 }
216 209
217 void NativeWidgetMus::GetWindowPlacement( 210 void NativeWidgetMus::GetWindowPlacement(
218 gfx::Rect* bounds, 211 gfx::Rect* bounds,
219 ui::WindowShowState* maximized) const { 212 ui::WindowShowState* maximized) const {
220 NOTIMPLEMENTED(); 213 NOTIMPLEMENTED();
221 } 214 }
222 215
223 bool NativeWidgetMus::SetWindowTitle(const base::string16& title) { 216 bool NativeWidgetMus::SetWindowTitle(const base::string16& title) {
224 // TODO(beng): push title to window manager. 217 // TODO(beng): push title to window manager.
(...skipping 19 matching lines...) Expand all
244 NOTIMPLEMENTED(); 237 NOTIMPLEMENTED();
245 return gfx::Rect(); 238 return gfx::Rect();
246 } 239 }
247 240
248 gfx::Rect NativeWidgetMus::GetRestoredBounds() const { 241 gfx::Rect NativeWidgetMus::GetRestoredBounds() const {
249 NOTIMPLEMENTED(); 242 NOTIMPLEMENTED();
250 return gfx::Rect(); 243 return gfx::Rect();
251 } 244 }
252 245
253 void NativeWidgetMus::SetBounds(const gfx::Rect& bounds) { 246 void NativeWidgetMus::SetBounds(const gfx::Rect& bounds) {
254 if (!window_manager_) 247 window_->RequestBoundsChange(bounds);
255 return;
256 window_manager_->SetBounds(window_tree_host_->mus_window()->id(),
257 mojo::Rect::From(bounds),
258 base::Bind(&WindowManagerCallback));
259 } 248 }
260 249
261 void NativeWidgetMus::SetSize(const gfx::Size& size) { 250 void NativeWidgetMus::SetSize(const gfx::Size& size) {
262 if (!window_manager_) 251 gfx::Rect bounds = window_->bounds().To<gfx::Rect>();
263 return; 252 bounds.set_size(size);
264 mojo::RectPtr bounds(mojo::Rect::New()); 253 window_->RequestBoundsChange(bounds);
265 bounds->x = window_tree_host_->mus_window()->bounds().x;
266 bounds->y = window_tree_host_->mus_window()->bounds().y;
267 bounds->width = size.width();
268 bounds->height = size.height();
269 window_manager_->SetBounds(window_tree_host_->mus_window()->id(),
270 bounds.Pass(), base::Bind(&WindowManagerCallback));
271 } 254 }
272 255
273 void NativeWidgetMus::StackAbove(gfx::NativeView native_view) { 256 void NativeWidgetMus::StackAbove(gfx::NativeView native_view) {
274 NOTIMPLEMENTED(); 257 NOTIMPLEMENTED();
275 } 258 }
276 259
277 void NativeWidgetMus::StackAtTop() { 260 void NativeWidgetMus::StackAtTop() {
278 NOTIMPLEMENTED(); 261 NOTIMPLEMENTED();
279 } 262 }
280 263
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 } else { 571 } else {
589 native_widget_delegate_->OnScrollEvent(event); 572 native_widget_delegate_->OnScrollEvent(event);
590 } 573 }
591 } 574 }
592 575
593 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { 576 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) {
594 native_widget_delegate_->OnGestureEvent(event); 577 native_widget_delegate_->OnGestureEvent(event);
595 } 578 }
596 579
597 } // namespace views 580 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/native_widget_mus.h ('k') | ui/views/mus/window_manager_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698