| 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/wm/window_state_observer.h" | 12 #include "ash/common/wm/window_state_observer.h" |
| 13 #include "base/gtest_prod_util.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 "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 18 #include "ui/base/hit_test.h" | 19 #include "ui/base/hit_test.h" |
| 19 #include "ui/gfx/geometry/point.h" | 20 #include "ui/gfx/geometry/point.h" |
| 20 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
| 21 #include "ui/gfx/geometry/vector2d.h" | 22 #include "ui/gfx/geometry/vector2d.h" |
| 22 #include "ui/views/widget/widget_delegate.h" | 23 #include "ui/views/widget/widget_delegate.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 void Close(); | 141 void Close(); |
| 141 | 142 |
| 142 // Set geometry for surface. The geometry represents the "visible bounds" | 143 // Set geometry for surface. The geometry represents the "visible bounds" |
| 143 // for the surface from the user's perspective. | 144 // for the surface from the user's perspective. |
| 144 void SetGeometry(const gfx::Rect& geometry); | 145 void SetGeometry(const gfx::Rect& geometry); |
| 145 | 146 |
| 146 // Set the content bounds for the shadow. Empty bounds will delete | 147 // Set the content bounds for the shadow. Empty bounds will delete |
| 147 // the shadow. | 148 // the shadow. |
| 148 void SetRectangularShadow(const gfx::Rect& content_bounds); | 149 void SetRectangularShadow(const gfx::Rect& content_bounds); |
| 149 | 150 |
| 151 // Set the pacity of the background for the window that has a shadow. |
| 152 void SetBackgroundOpacity(float opacity); |
| 153 |
| 150 // Set scale factor for surface. The scale factor will be applied to surface | 154 // Set scale factor for surface. The scale factor will be applied to surface |
| 151 // and all descendants. | 155 // and all descendants. |
| 152 void SetScale(double scale); | 156 void SetScale(double scale); |
| 153 | 157 |
| 154 // Set top inset for surface. | 158 // Set top inset for surface. |
| 155 void SetTopInset(int height); | 159 void SetTopInset(int height); |
| 156 | 160 |
| 157 // Sets the main surface for the window. | 161 // Sets the main surface for the window. |
| 158 static void SetMainSurface(aura::Window* window, Surface* surface); | 162 static void SetMainSurface(aura::Window* window, Surface* surface); |
| 159 | 163 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // Overridden from ui::EventHandler: | 213 // Overridden from ui::EventHandler: |
| 210 void OnKeyEvent(ui::KeyEvent* event) override; | 214 void OnKeyEvent(ui::KeyEvent* event) override; |
| 211 void OnMouseEvent(ui::MouseEvent* event) override; | 215 void OnMouseEvent(ui::MouseEvent* event) override; |
| 212 | 216 |
| 213 // Overridden from ui::AcceleratorTarget: | 217 // Overridden from ui::AcceleratorTarget: |
| 214 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 218 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 215 | 219 |
| 216 private: | 220 private: |
| 217 class ScopedConfigure; | 221 class ScopedConfigure; |
| 218 class ScopedAnimationsDisabled; | 222 class ScopedAnimationsDisabled; |
| 223 FRIEND_TEST_ALL_PREFIXES(ShellSurfaceTest, ShadowStartMaximized); |
| 219 | 224 |
| 220 // Surface state associated with each configure request. | 225 // Surface state associated with each configure request. |
| 221 struct Config { | 226 struct Config { |
| 222 uint32_t serial; | 227 uint32_t serial; |
| 223 gfx::Vector2d origin_offset; | 228 gfx::Vector2d origin_offset; |
| 224 int resize_component; | 229 int resize_component; |
| 225 }; | 230 }; |
| 226 | 231 |
| 227 // Creates the |widget_| for |surface_|. |show_state| is the initial state | 232 // Creates the |widget_| for |surface_|. |show_state| is the initial state |
| 228 // of the widget (e.g. maximized). | 233 // of the widget (e.g. maximized). |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h) | 286 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h) |
| 282 int pending_resize_component_ = HTCAPTION; | 287 int pending_resize_component_ = HTCAPTION; |
| 283 aura::Window* shadow_overlay_ = nullptr; | 288 aura::Window* shadow_overlay_ = nullptr; |
| 284 aura::Window* shadow_underlay_ = nullptr; | 289 aura::Window* shadow_underlay_ = nullptr; |
| 285 gfx::Rect shadow_content_bounds_; | 290 gfx::Rect shadow_content_bounds_; |
| 286 std::deque<Config> pending_configs_; | 291 std::deque<Config> pending_configs_; |
| 287 std::unique_ptr<ash::WindowResizer> resizer_; | 292 std::unique_ptr<ash::WindowResizer> resizer_; |
| 288 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_; | 293 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_; |
| 289 int top_inset_height_ = 0; | 294 int top_inset_height_ = 0; |
| 290 int pending_top_inset_height_ = 0; | 295 int pending_top_inset_height_ = 0; |
| 296 float background_opacity_ = 1.0; |
| 291 | 297 |
| 292 DISALLOW_COPY_AND_ASSIGN(ShellSurface); | 298 DISALLOW_COPY_AND_ASSIGN(ShellSurface); |
| 293 }; | 299 }; |
| 294 | 300 |
| 295 } // namespace exo | 301 } // namespace exo |
| 296 | 302 |
| 297 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ | 303 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ |
| OLD | NEW |