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" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 void Window::SetVisible(bool value) { | 204 void Window::SetVisible(bool value) { |
205 if (visible_ == value) | 205 if (visible_ == value) |
206 return; | 206 return; |
207 | 207 |
208 if (connection_) | 208 if (connection_) |
209 tree_client()->SetVisible(this, value); | 209 tree_client()->SetVisible(this, value); |
210 LocalSetVisible(value); | 210 LocalSetVisible(value); |
211 } | 211 } |
212 | 212 |
| 213 void Window::SetPredefinedCursor(mus::mojom::Cursor cursor_id) { |
| 214 if (cursor_id_ == cursor_id) |
| 215 return; |
| 216 |
| 217 if (connection_) |
| 218 tree_client()->SetPredefinedCursor(id_, cursor_id); |
| 219 LocalSetPredefinedCursor(cursor_id); |
| 220 } |
| 221 |
213 bool Window::IsDrawn() const { | 222 bool Window::IsDrawn() const { |
214 if (!visible_) | 223 if (!visible_) |
215 return false; | 224 return false; |
216 return parent_ ? parent_->IsDrawn() : drawn_; | 225 return parent_ ? parent_->IsDrawn() : drawn_; |
217 } | 226 } |
218 | 227 |
219 scoped_ptr<WindowSurface> Window::RequestSurface(mojom::SurfaceType type) { | 228 scoped_ptr<WindowSurface> Window::RequestSurface(mojom::SurfaceType type) { |
220 scoped_ptr<WindowSurfaceBinding> surface_binding; | 229 scoped_ptr<WindowSurfaceBinding> surface_binding; |
221 scoped_ptr<WindowSurface> surface = WindowSurface::Create(&surface_binding); | 230 scoped_ptr<WindowSurface> surface = WindowSurface::Create(&surface_binding); |
222 AttachSurface(type, surface_binding.Pass()); | 231 AttachSurface(type, surface_binding.Pass()); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 void Window::LocalSetVisible(bool visible) { | 606 void Window::LocalSetVisible(bool visible) { |
598 if (visible_ == visible) | 607 if (visible_ == visible) |
599 return; | 608 return; |
600 | 609 |
601 FOR_EACH_OBSERVER(WindowObserver, observers_, | 610 FOR_EACH_OBSERVER(WindowObserver, observers_, |
602 OnWindowVisibilityChanging(this)); | 611 OnWindowVisibilityChanging(this)); |
603 visible_ = visible; | 612 visible_ = visible; |
604 NotifyWindowVisibilityChanged(this); | 613 NotifyWindowVisibilityChanged(this); |
605 } | 614 } |
606 | 615 |
| 616 void Window::LocalSetPredefinedCursor(mojom::Cursor cursor_id) { |
| 617 if (cursor_id_ == cursor_id) |
| 618 return; |
| 619 |
| 620 cursor_id_ = cursor_id; |
| 621 FOR_EACH_OBSERVER(WindowObserver, observers_, |
| 622 OnWindowPredefinedCursorChanged(this, cursor_id)); |
| 623 } |
| 624 |
607 void Window::LocalSetSharedProperty(const std::string& name, | 625 void Window::LocalSetSharedProperty(const std::string& name, |
608 const std::vector<uint8_t>* value) { | 626 const std::vector<uint8_t>* value) { |
609 std::vector<uint8_t> old_value; | 627 std::vector<uint8_t> old_value; |
610 std::vector<uint8_t>* old_value_ptr = nullptr; | 628 std::vector<uint8_t>* old_value_ptr = nullptr; |
611 auto it = properties_.find(name); | 629 auto it = properties_.find(name); |
612 if (it != properties_.end()) { | 630 if (it != properties_.end()) { |
613 old_value = it->second; | 631 old_value = it->second; |
614 old_value_ptr = &old_value; | 632 old_value_ptr = &old_value; |
615 | 633 |
616 if (value && old_value == *value) | 634 if (value && old_value == *value) |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 notifier->NotifyWindowReordered(); | 788 notifier->NotifyWindowReordered(); |
771 | 789 |
772 return true; | 790 return true; |
773 } | 791 } |
774 | 792 |
775 // static | 793 // static |
776 Window** Window::GetStackingTarget(Window* window) { | 794 Window** Window::GetStackingTarget(Window* window) { |
777 return &window->stacking_target_; | 795 return &window->stacking_target_; |
778 } | 796 } |
779 } // namespace mus | 797 } // namespace mus |
OLD | NEW |