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/ws/window_tree_impl.h" | 5 #include "components/mus/ws/window_tree_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "components/mus/ws/connection_manager.h" | 9 #include "components/mus/ws/connection_manager.h" |
10 #include "components/mus/ws/default_access_policy.h" | 10 #include "components/mus/ws/default_access_policy.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 // Window is being hidden, won't be drawn. | 357 // Window is being hidden, won't be drawn. |
358 window_target_drawn_state = false; | 358 window_target_drawn_state = false; |
359 } else { | 359 } else { |
360 // Window is being shown. Window will be drawn if its parent is drawn. | 360 // Window is being shown. Window will be drawn if its parent is drawn. |
361 window_target_drawn_state = window->parent() && window->parent()->IsDrawn(); | 361 window_target_drawn_state = window->parent() && window->parent()->IsDrawn(); |
362 } | 362 } |
363 | 363 |
364 NotifyDrawnStateChanged(window, window_target_drawn_state); | 364 NotifyDrawnStateChanged(window, window_target_drawn_state); |
365 } | 365 } |
366 | 366 |
367 void WindowTreeImpl::ProcessCursorChanged(const ServerWindow* window, | |
368 int32_t cursor_id, | |
369 bool originated_change) { | |
370 if (originated_change) | |
371 return; | |
372 client()->OnWindowCursorChanged(WindowIdToTransportId(window->id()), | |
373 mojom::Cursor(cursor_id)); | |
374 } | |
375 | |
367 void WindowTreeImpl::ProcessFocusChanged( | 376 void WindowTreeImpl::ProcessFocusChanged( |
368 const ServerWindow* old_focused_window, | 377 const ServerWindow* old_focused_window, |
369 const ServerWindow* new_focused_window) { | 378 const ServerWindow* new_focused_window) { |
370 const ServerWindow* window = | 379 const ServerWindow* window = |
371 new_focused_window | 380 new_focused_window |
372 ? access_policy_->GetWindowForFocusChange(new_focused_window) | 381 ? access_policy_->GetWindowForFocusChange(new_focused_window) |
373 : nullptr; | 382 : nullptr; |
374 client()->OnWindowFocused(window ? WindowIdToTransportId(window->id()) | 383 client()->OnWindowFocused(window ? WindowIdToTransportId(window->id()) |
375 : WindowIdToTransportId(WindowId())); | 384 : WindowIdToTransportId(WindowId())); |
376 } | 385 } |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
850 host->SetFocusedWindow(window); | 859 host->SetFocusedWindow(window); |
851 } | 860 } |
852 } | 861 } |
853 | 862 |
854 void WindowTreeImpl::SetCanFocus(uint32_t window_id, bool can_focus) { | 863 void WindowTreeImpl::SetCanFocus(uint32_t window_id, bool can_focus) { |
855 ServerWindow* window = GetWindow(WindowIdFromTransportId(window_id)); | 864 ServerWindow* window = GetWindow(WindowIdFromTransportId(window_id)); |
856 if (window && ShouldRouteToWindowManager(window)) | 865 if (window && ShouldRouteToWindowManager(window)) |
857 window->set_can_focus(can_focus); | 866 window->set_can_focus(can_focus); |
858 } | 867 } |
859 | 868 |
869 void WindowTreeImpl::SetStandardCursor(uint32_t window_id, | |
870 mus::mojom::Cursor cursor_id) { | |
871 ServerWindow* window = GetWindow(WindowIdFromTransportId(window_id)); | |
872 | |
873 // Only the owner of the window can change the bounds. | |
874 bool success = window && access_policy_->CanSetCursorProperties(window); | |
875 if (success) | |
sky
2015/12/01 21:48:01
You need to create an Operation here. See 856 for
| |
876 window->SetCursor(cursor_id); | |
877 } | |
878 | |
860 void WindowTreeImpl::WmResponse(uint32 change_id, bool response) { | 879 void WindowTreeImpl::WmResponse(uint32 change_id, bool response) { |
861 if (GetHost() && GetHost()->GetWindowTree() == this) | 880 if (GetHost() && GetHost()->GetWindowTree() == this) |
862 connection_manager_->WindowManagerChangeCompleted(change_id, response); | 881 connection_manager_->WindowManagerChangeCompleted(change_id, response); |
863 } | 882 } |
864 | 883 |
865 bool WindowTreeImpl::IsRootForAccessPolicy(const WindowId& id) const { | 884 bool WindowTreeImpl::IsRootForAccessPolicy(const WindowId& id) const { |
866 return IsRoot(id); | 885 return IsRoot(id); |
867 } | 886 } |
868 | 887 |
869 bool WindowTreeImpl::IsWindowKnownForAccessPolicy( | 888 bool WindowTreeImpl::IsWindowKnownForAccessPolicy( |
870 const ServerWindow* window) const { | 889 const ServerWindow* window) const { |
871 return IsWindowKnown(window); | 890 return IsWindowKnown(window); |
872 } | 891 } |
873 | 892 |
874 bool WindowTreeImpl::IsWindowRootOfAnotherConnectionForAccessPolicy( | 893 bool WindowTreeImpl::IsWindowRootOfAnotherConnectionForAccessPolicy( |
875 const ServerWindow* window) const { | 894 const ServerWindow* window) const { |
876 WindowTreeImpl* connection = | 895 WindowTreeImpl* connection = |
877 connection_manager_->GetConnectionWithRoot(window->id()); | 896 connection_manager_->GetConnectionWithRoot(window->id()); |
878 return connection && connection != this; | 897 return connection && connection != this; |
879 } | 898 } |
880 | 899 |
881 bool WindowTreeImpl::IsDescendantOfEmbedRoot(const ServerWindow* window) { | 900 bool WindowTreeImpl::IsDescendantOfEmbedRoot(const ServerWindow* window) { |
882 return is_embed_root_ && root_ && GetWindow(*root_)->Contains(window); | 901 return is_embed_root_ && root_ && GetWindow(*root_)->Contains(window); |
883 } | 902 } |
884 | 903 |
885 } // namespace ws | 904 } // namespace ws |
886 | 905 |
887 } // namespace mus | 906 } // namespace mus |
OLD | NEW |