| OLD | NEW |
| 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/frame/custom_frame_view_ash.h" | 9 #include "ash/common/frame/custom_frame_view_ash.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/wm/window_resizer.h" | 11 #include "ash/common/wm/window_resizer.h" |
| 12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/common/wm/window_state_delegate.h" | 13 #include "ash/common/wm/window_state_delegate.h" |
| 14 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 15 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.h" |
| 16 #include "ash/public/cpp/shell_window_ids.h" | 16 #include "ash/public/cpp/shell_window_ids.h" |
| 17 #include "ash/wm/window_state_aura.h" | 17 #include "ash/wm/window_state_aura.h" |
| 18 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "base/memory/ptr_util.h" | 21 #include "base/memory/ptr_util.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 24 #include "base/trace_event/trace_event_argument.h" | 24 #include "base/trace_event/trace_event_argument.h" |
| 25 #include "components/exo/surface.h" | 25 #include "components/exo/surface.h" |
| 26 #include "ui/accessibility/ax_enums.h" |
| 27 #include "ui/accessibility/ax_node_data.h" |
| 26 #include "ui/aura/client/aura_constants.h" | 28 #include "ui/aura/client/aura_constants.h" |
| 27 #include "ui/aura/client/cursor_client.h" | 29 #include "ui/aura/client/cursor_client.h" |
| 28 #include "ui/aura/window.h" | 30 #include "ui/aura/window.h" |
| 29 #include "ui/aura/window_event_dispatcher.h" | 31 #include "ui/aura/window_event_dispatcher.h" |
| 30 #include "ui/aura/window_property.h" | 32 #include "ui/aura/window_property.h" |
| 31 #include "ui/aura/window_targeter.h" | 33 #include "ui/aura/window_targeter.h" |
| 32 #include "ui/aura/window_tree_host.h" | 34 #include "ui/aura/window_tree_host.h" |
| 33 #include "ui/base/accelerators/accelerator.h" | 35 #include "ui/base/accelerators/accelerator.h" |
| 34 #include "ui/gfx/path.h" | 36 #include "ui/gfx/path.h" |
| 35 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 widget_->Hide(); | 782 widget_->Hide(); |
| 781 } | 783 } |
| 782 | 784 |
| 783 // Note: In its use in the Wayland server implementation, the surface | 785 // Note: In its use in the Wayland server implementation, the surface |
| 784 // destroyed callback may destroy the ShellSurface instance. This call needs | 786 // destroyed callback may destroy the ShellSurface instance. This call needs |
| 785 // to be last so that the instance can be destroyed. | 787 // to be last so that the instance can be destroyed. |
| 786 if (!surface_destroyed_callback_.is_null()) | 788 if (!surface_destroyed_callback_.is_null()) |
| 787 surface_destroyed_callback_.Run(); | 789 surface_destroyed_callback_.Run(); |
| 788 } | 790 } |
| 789 | 791 |
| 792 void ShellSurface::OnSurfaceAXTreeChanged(int32_t id) { |
| 793 ax_tree_id_ = id; |
| 794 |
| 795 NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, false); |
| 796 } |
| 797 |
| 790 //////////////////////////////////////////////////////////////////////////////// | 798 //////////////////////////////////////////////////////////////////////////////// |
| 791 // views::WidgetDelegate overrides: | 799 // views::WidgetDelegate overrides: |
| 792 | 800 |
| 793 bool ShellSurface::CanResize() const { | 801 bool ShellSurface::CanResize() const { |
| 794 return initial_bounds_.IsEmpty(); | 802 return initial_bounds_.IsEmpty(); |
| 795 } | 803 } |
| 796 | 804 |
| 797 bool ShellSurface::CanMaximize() const { | 805 bool ShellSurface::CanMaximize() const { |
| 798 // Shell surfaces in system modal container cannot be maximized. | 806 // Shell surfaces in system modal container cannot be maximized. |
| 799 if (container_ == ash::kShellWindowId_SystemModalContainer) | 807 if (container_ == ash::kShellWindowId_SystemModalContainer) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 if (!geometry_.IsEmpty()) | 872 if (!geometry_.IsEmpty()) |
| 865 return geometry_.size(); | 873 return geometry_.size(); |
| 866 | 874 |
| 867 return surface_ ? surface_->window()->layer()->size() : gfx::Size(); | 875 return surface_ ? surface_->window()->layer()->size() : gfx::Size(); |
| 868 } | 876 } |
| 869 | 877 |
| 870 gfx::Size ShellSurface::GetMinimumSize() const { | 878 gfx::Size ShellSurface::GetMinimumSize() const { |
| 871 return gfx::Size(1, 1); | 879 return gfx::Size(1, 1); |
| 872 } | 880 } |
| 873 | 881 |
| 882 void ShellSurface::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 883 if (ax_tree_id_) |
| 884 node_data->AddIntAttribute(ui::AX_ATTR_CHILD_TREE_ID, ax_tree_id_); |
| 885 node_data->SetName("ExoShell"); |
| 886 } |
| 887 |
| 874 //////////////////////////////////////////////////////////////////////////////// | 888 //////////////////////////////////////////////////////////////////////////////// |
| 875 // ash::wm::WindowStateObserver overrides: | 889 // ash::wm::WindowStateObserver overrides: |
| 876 | 890 |
| 877 void ShellSurface::OnPreWindowStateTypeChange( | 891 void ShellSurface::OnPreWindowStateTypeChange( |
| 878 ash::wm::WindowState* window_state, | 892 ash::wm::WindowState* window_state, |
| 879 ash::wm::WindowStateType old_type) { | 893 ash::wm::WindowStateType old_type) { |
| 880 ash::wm::WindowStateType new_type = window_state->GetStateType(); | 894 ash::wm::WindowStateType new_type = window_state->GetStateType(); |
| 881 if (ash::wm::IsMaximizedOrFullscreenOrPinnedWindowStateType(old_type) || | 895 if (ash::wm::IsMaximizedOrFullscreenOrPinnedWindowStateType(old_type) || |
| 882 ash::wm::IsMaximizedOrFullscreenOrPinnedWindowStateType(new_type)) { | 896 ash::wm::IsMaximizedOrFullscreenOrPinnedWindowStateType(new_type)) { |
| 883 // When transitioning in/out of maximized or fullscreen mode we need to | 897 // When transitioning in/out of maximized or fullscreen mode we need to |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 shadow_overlay_->SetBounds(shadow_bounds); | 1517 shadow_overlay_->SetBounds(shadow_bounds); |
| 1504 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1518 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
| 1505 // Surfaces that can't be activated are usually menus and tooltips. Use a | 1519 // Surfaces that can't be activated are usually menus and tooltips. Use a |
| 1506 // small style shadow for them. | 1520 // small style shadow for them. |
| 1507 if (!activatable_) | 1521 if (!activatable_) |
| 1508 shadow->SetElevation(wm::ShadowElevation::SMALL); | 1522 shadow->SetElevation(wm::ShadowElevation::SMALL); |
| 1509 } | 1523 } |
| 1510 } | 1524 } |
| 1511 | 1525 |
| 1512 } // namespace exo | 1526 } // namespace exo |
| OLD | NEW |