| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/mus/public/cpp/window.h" | 5 #include "components/mus/public/cpp/window.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "components/mus/public/cpp/lib/window_private.h" | 11 #include "components/mus/public/cpp/lib/window_private.h" |
| 12 #include "components/mus/public/cpp/lib/window_tree_client_impl.h" | 12 #include "components/mus/public/cpp/lib/window_tree_client_impl.h" |
| 13 #include "components/mus/public/cpp/window_observer.h" | 13 #include "components/mus/public/cpp/window_observer.h" |
| 14 #include "components/mus/public/cpp/window_surface.h" | 14 #include "components/mus/public/cpp/window_surface.h" |
| 15 #include "components/mus/public/cpp/window_tracker.h" | 15 #include "components/mus/public/cpp/window_tracker.h" |
| 16 #include "mojo/application/public/cpp/service_provider_impl.h" | 16 #include "mojo/application/public/cpp/service_provider_impl.h" |
| 17 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/gfx/geometry/size.h" |
| 17 | 19 |
| 18 namespace mus { | 20 namespace mus { |
| 19 | 21 |
| 20 namespace { | 22 namespace { |
| 21 | 23 |
| 22 void NotifyWindowTreeChangeAtReceiver( | 24 void NotifyWindowTreeChangeAtReceiver( |
| 23 Window* receiver, | 25 Window* receiver, |
| 24 const WindowObserver::TreeChangeParams& params, | 26 const WindowObserver::TreeChangeParams& params, |
| 25 bool change_applied) { | 27 bool change_applied) { |
| 26 WindowObserver::TreeChangeParams local_params = params; | 28 WindowObserver::TreeChangeParams local_params = params; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 354 |
| 353 void Window::SetImeVisibility(bool visible, mojo::TextInputStatePtr state) { | 355 void Window::SetImeVisibility(bool visible, mojo::TextInputStatePtr state) { |
| 354 // SetImeVisibility() shouldn't be used if the window is not editable. | 356 // SetImeVisibility() shouldn't be used if the window is not editable. |
| 355 DCHECK(state.is_null() || state->type != mojo::TEXT_INPUT_TYPE_NONE); | 357 DCHECK(state.is_null() || state->type != mojo::TEXT_INPUT_TYPE_NONE); |
| 356 if (connection_) { | 358 if (connection_) { |
| 357 static_cast<WindowTreeClientImpl*>(connection_) | 359 static_cast<WindowTreeClientImpl*>(connection_) |
| 358 ->SetImeVisibility(id_, visible, state.Pass()); | 360 ->SetImeVisibility(id_, visible, state.Pass()); |
| 359 } | 361 } |
| 360 } | 362 } |
| 361 | 363 |
| 364 void Window::SetPreferredSize(const gfx::Size& size) { |
| 365 if (connection_) |
| 366 static_cast<WindowTreeClientImpl*>(connection_) |
| 367 ->SetPreferredSize(id_, size); |
| 368 } |
| 369 |
| 370 void Window::RequestBoundsChange(const gfx::Rect& bounds) { |
| 371 if (connection_) |
| 372 static_cast<WindowTreeClientImpl*>(connection_) |
| 373 ->RequestBoundsChange(id_, bounds); |
| 374 } |
| 375 |
| 376 void Window::SetShowState(mojom::ShowState show_state) { |
| 377 if (connection_) |
| 378 static_cast<WindowTreeClientImpl*>(connection_) |
| 379 ->SetShowState(id_, show_state); |
| 380 } |
| 381 |
| 362 void Window::SetFocus() { | 382 void Window::SetFocus() { |
| 363 if (connection_) | 383 if (connection_) |
| 364 static_cast<WindowTreeClientImpl*>(connection_)->SetFocus(id_); | 384 static_cast<WindowTreeClientImpl*>(connection_)->SetFocus(id_); |
| 365 } | 385 } |
| 366 | 386 |
| 367 bool Window::HasFocus() const { | 387 bool Window::HasFocus() const { |
| 368 return connection_ && connection_->GetFocusedWindow() == this; | 388 return connection_ && connection_->GetFocusedWindow() == this; |
| 369 } | 389 } |
| 370 | 390 |
| 371 void Window::Embed(mus::mojom::WindowTreeClientPtr client) { | 391 void Window::Embed(mus::mojom::WindowTreeClientPtr client) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 !static_cast<WindowTreeClientImpl*>(connection_)->is_embed_root()) { | 676 !static_cast<WindowTreeClientImpl*>(connection_)->is_embed_root()) { |
| 657 return false; | 677 return false; |
| 658 } | 678 } |
| 659 | 679 |
| 660 while (!children_.empty()) | 680 while (!children_.empty()) |
| 661 RemoveChild(children_[0]); | 681 RemoveChild(children_[0]); |
| 662 return true; | 682 return true; |
| 663 } | 683 } |
| 664 | 684 |
| 665 } // namespace mus | 685 } // namespace mus |
| OLD | NEW |