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 #ifndef COMPONENTS_EXO_SHELL_SURFACE_H_ | 5 #ifndef COMPONENTS_EXO_SHELL_SURFACE_H_ |
6 #define COMPONENTS_EXO_SHELL_SURFACE_H_ | 6 #define COMPONENTS_EXO_SHELL_SURFACE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
| 12 #include "ash/common/system/accessibility_observer.h" |
12 #include "ash/common/wm/window_state_observer.h" | 13 #include "ash/common/wm/window_state_observer.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
15 #include "components/exo/surface_delegate.h" | 16 #include "components/exo/surface_delegate.h" |
16 #include "components/exo/surface_observer.h" | 17 #include "components/exo/surface_observer.h" |
17 #include "components/exo/wm_helper.h" | 18 #include "components/exo/wm_helper.h" |
18 #include "ui/aura/window_observer.h" | 19 #include "ui/aura/window_observer.h" |
19 #include "ui/base/hit_test.h" | 20 #include "ui/base/hit_test.h" |
20 #include "ui/gfx/geometry/point.h" | 21 #include "ui/gfx/geometry/point.h" |
21 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
(...skipping 13 matching lines...) Expand all Loading... |
35 namespace exo { | 36 namespace exo { |
36 class Surface; | 37 class Surface; |
37 | 38 |
38 // This class provides functions for treating a surfaces like toplevel, | 39 // This class provides functions for treating a surfaces like toplevel, |
39 // fullscreen or popup widgets, move, resize or maximize them, associate | 40 // fullscreen or popup widgets, move, resize or maximize them, associate |
40 // metadata like title and class, etc. | 41 // metadata like title and class, etc. |
41 class ShellSurface : public SurfaceDelegate, | 42 class ShellSurface : public SurfaceDelegate, |
42 public SurfaceObserver, | 43 public SurfaceObserver, |
43 public views::WidgetDelegate, | 44 public views::WidgetDelegate, |
44 public views::View, | 45 public views::View, |
| 46 public ash::AccessibilityObserver, |
45 public ash::wm::WindowStateObserver, | 47 public ash::wm::WindowStateObserver, |
46 public aura::WindowObserver, | 48 public aura::WindowObserver, |
47 public WMHelper::ActivationObserver { | 49 public WMHelper::ActivationObserver { |
48 public: | 50 public: |
49 ShellSurface(Surface* surface, | 51 ShellSurface(Surface* surface, |
50 ShellSurface* parent, | 52 ShellSurface* parent, |
51 const gfx::Rect& initial_bounds, | 53 const gfx::Rect& initial_bounds, |
52 bool activatable, | 54 bool activatable, |
53 int container); | 55 int container); |
54 explicit ShellSurface(Surface* surface); | 56 explicit ShellSurface(Surface* surface); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 const views::Widget* GetWidget() const override; | 189 const views::Widget* GetWidget() const override; |
188 views::View* GetContentsView() override; | 190 views::View* GetContentsView() override; |
189 views::NonClientFrameView* CreateNonClientFrameView( | 191 views::NonClientFrameView* CreateNonClientFrameView( |
190 views::Widget* widget) override; | 192 views::Widget* widget) override; |
191 bool WidgetHasHitTestMask() const override; | 193 bool WidgetHasHitTestMask() const override; |
192 void GetWidgetHitTestMask(gfx::Path* mask) const override; | 194 void GetWidgetHitTestMask(gfx::Path* mask) const override; |
193 | 195 |
194 // Overridden from views::View: | 196 // Overridden from views::View: |
195 gfx::Size GetPreferredSize() const override; | 197 gfx::Size GetPreferredSize() const override; |
196 | 198 |
| 199 // Overridden from ash::AccessibilityObserver: |
| 200 void OnAccessibilityModeChanged( |
| 201 ash::AccessibilityNotificationVisibility notify) override; |
| 202 |
197 // Overridden from ash::wm::WindowStateObserver: | 203 // Overridden from ash::wm::WindowStateObserver: |
198 void OnPreWindowStateTypeChange(ash::wm::WindowState* window_state, | 204 void OnPreWindowStateTypeChange(ash::wm::WindowState* window_state, |
199 ash::wm::WindowStateType old_type) override; | 205 ash::wm::WindowStateType old_type) override; |
200 void OnPostWindowStateTypeChange(ash::wm::WindowState* window_state, | 206 void OnPostWindowStateTypeChange(ash::wm::WindowState* window_state, |
201 ash::wm::WindowStateType old_type) override; | 207 ash::wm::WindowStateType old_type) override; |
202 | 208 |
203 // Overridden from aura::WindowObserver: | 209 // Overridden from aura::WindowObserver: |
204 void OnWindowBoundsChanged(aura::Window* window, | 210 void OnWindowBoundsChanged(aura::Window* window, |
205 const gfx::Rect& old_bounds, | 211 const gfx::Rect& old_bounds, |
206 const gfx::Rect& new_bounds) override; | 212 const gfx::Rect& new_bounds) override; |
207 void OnWindowDestroying(aura::Window* window) override; | 213 void OnWindowDestroying(aura::Window* window) override; |
208 | 214 |
209 // Overridden from WMHelper::ActivationObserver: | 215 // Overridden from WMHelper::ActivationObserver: |
210 void OnWindowActivated( | 216 void OnWindowActivated( |
211 aura::Window* gained_active, | 217 aura::Window* gained_active, |
212 aura::Window* lost_active) override; | 218 aura::Window* lost_active) override; |
213 | 219 |
214 // Overridden from ui::EventHandler: | 220 // Overridden from ui::EventHandler: |
215 void OnKeyEvent(ui::KeyEvent* event) override; | 221 void OnKeyEvent(ui::KeyEvent* event) override; |
216 void OnMouseEvent(ui::MouseEvent* event) override; | 222 void OnMouseEvent(ui::MouseEvent* event) override; |
217 | 223 |
218 // Overridden from ui::AcceleratorTarget: | 224 // Overridden from ui::AcceleratorTarget: |
219 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 225 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
220 | 226 |
221 const aura::Window* shadow_underlay_for_test() const { | 227 aura::Window* shadow_underlay() { return shadow_underlay_; } |
222 return shadow_underlay_; | |
223 } | |
224 | 228 |
225 private: | 229 private: |
226 class ScopedConfigure; | 230 class ScopedConfigure; |
227 class ScopedAnimationsDisabled; | 231 class ScopedAnimationsDisabled; |
228 | 232 |
229 // Surface state associated with each configure request. | 233 // Surface state associated with each configure request. |
230 struct Config { | 234 struct Config { |
231 uint32_t serial; | 235 uint32_t serial; |
232 gfx::Vector2d origin_offset; | 236 gfx::Vector2d origin_offset; |
233 int resize_component; | 237 int resize_component; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ConfigureCallback configure_callback_; | 288 ConfigureCallback configure_callback_; |
285 ScopedConfigure* scoped_configure_ = nullptr; | 289 ScopedConfigure* scoped_configure_ = nullptr; |
286 bool ignore_window_bounds_changes_ = false; | 290 bool ignore_window_bounds_changes_ = false; |
287 gfx::Point origin_; | 291 gfx::Point origin_; |
288 gfx::Vector2d pending_origin_offset_; | 292 gfx::Vector2d pending_origin_offset_; |
289 gfx::Vector2d pending_origin_config_offset_; | 293 gfx::Vector2d pending_origin_config_offset_; |
290 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h) | 294 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h) |
291 int pending_resize_component_ = HTCAPTION; | 295 int pending_resize_component_ = HTCAPTION; |
292 aura::Window* shadow_overlay_ = nullptr; | 296 aura::Window* shadow_overlay_ = nullptr; |
293 aura::Window* shadow_underlay_ = nullptr; | 297 aura::Window* shadow_underlay_ = nullptr; |
| 298 std::unique_ptr<ui::EventHandler> shadow_underlay_event_handler_; |
294 gfx::Rect shadow_content_bounds_; | 299 gfx::Rect shadow_content_bounds_; |
295 std::deque<Config> pending_configs_; | 300 std::deque<Config> pending_configs_; |
296 std::unique_ptr<ash::WindowResizer> resizer_; | 301 std::unique_ptr<ash::WindowResizer> resizer_; |
297 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_; | 302 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_; |
298 int top_inset_height_ = 0; | 303 int top_inset_height_ = 0; |
299 int pending_top_inset_height_ = 0; | 304 int pending_top_inset_height_ = 0; |
300 float rectangular_shadow_background_opacity_ = 1.0; | 305 float rectangular_shadow_background_opacity_ = 1.0; |
301 | 306 |
302 DISALLOW_COPY_AND_ASSIGN(ShellSurface); | 307 DISALLOW_COPY_AND_ASSIGN(ShellSurface); |
303 }; | 308 }; |
304 | 309 |
305 } // namespace exo | 310 } // namespace exo |
306 | 311 |
307 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ | 312 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ |
OLD | NEW |