Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_EXO_SHELL_SURFACE_BASE_H_ |
| 6 | #define COMPONENTS_EXO_SHELL_SURFACE_BASE_H_ |
| 7 | |
| 8 | #include <cstdint> |
| 9 | #include <memory> |
| 10 | #include <string> |
| 11 | |
| 12 | #include "ash/display/window_tree_host_manager.h" |
[email protected] | 9385573 | 2019-06-24 19:49:30 | [diff] [blame] | 13 | #include "base/gtest_prod_util.h" |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 14 | #include "base/macros.h" |
| 15 | #include "base/optional.h" |
| 16 | #include "base/strings/string16.h" |
| 17 | #include "components/exo/surface_observer.h" |
| 18 | #include "components/exo/surface_tree_host.h" |
Dominic Mazzoni | 336bc006 | 2018-09-23 16:46:43 | [diff] [blame] | 19 | #include "ui/accessibility/ax_tree_id.h" |
Mitsuru Oshima | a969732 | 2018-06-19 07:11:53 | [diff] [blame] | 20 | #include "ui/aura/client/capture_client_observer.h" |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 21 | #include "ui/aura/window_observer.h" |
| 22 | #include "ui/base/hit_test.h" |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 23 | #include "ui/display/display_observer.h" |
Dominik Laskowski | 4c265736 | 2018-09-05 00:35:09 | [diff] [blame] | 24 | #include "ui/display/types/display_constants.h" |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 25 | #include "ui/gfx/geometry/point.h" |
| 26 | #include "ui/gfx/geometry/rect.h" |
| 27 | #include "ui/gfx/geometry/vector2d.h" |
| 28 | #include "ui/views/widget/widget_delegate.h" |
Nicholas Hollingum | 266cddd | 2019-10-03 06:12:44 | [diff] [blame] | 29 | #include "ui/views/widget/widget_observer.h" |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 30 | #include "ui/wm/public/activation_change_observer.h" |
| 31 | |
| 32 | namespace ash { |
Mitsuru Oshima | 1143977 | 2017-12-14 02:06:59 | [diff] [blame] | 33 | class WindowState; |
Nicholas Hollingum | 605b837 | 2019-03-13 01:41:57 | [diff] [blame] | 34 | } // namespace ash |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 35 | |
| 36 | namespace base { |
| 37 | namespace trace_event { |
| 38 | class TracedValue; |
| 39 | } |
| 40 | } // namespace base |
| 41 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 42 | namespace exo { |
| 43 | class Surface; |
| 44 | |
| 45 | // This class provides functions for treating a surfaces like toplevel, |
| 46 | // fullscreen or popup widgets, move, resize or maximize them, associate |
| 47 | // metadata like title and class, etc. |
| 48 | class ShellSurfaceBase : public SurfaceTreeHost, |
| 49 | public SurfaceObserver, |
| 50 | public aura::WindowObserver, |
Mitsuru Oshima | a969732 | 2018-06-19 07:11:53 | [diff] [blame] | 51 | public aura::client::CaptureClientObserver, |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 52 | public views::WidgetDelegate, |
Nicholas Hollingum | 266cddd | 2019-10-03 06:12:44 | [diff] [blame] | 53 | public views::WidgetObserver, |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 54 | public views::View, |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 55 | public wm::ActivationChangeObserver { |
| 56 | public: |
| 57 | // The |origin| is the initial position in screen coordinates. The position |
| 58 | // specified as part of the geometry is relative to the shell surface. |
| 59 | ShellSurfaceBase(Surface* surface, |
| 60 | const gfx::Point& origin, |
| 61 | bool activatable, |
| 62 | bool can_minimize, |
| 63 | int container); |
| 64 | ~ShellSurfaceBase() override; |
| 65 | |
| 66 | // Set the callback to run when the user wants the shell surface to be closed. |
| 67 | // The receiver can chose to not close the window on this signal. |
| 68 | void set_close_callback(const base::RepeatingClosure& close_callback) { |
| 69 | close_callback_ = close_callback; |
| 70 | } |
| 71 | |
Nicholas Hollingum | 3acc1d1 | 2019-09-09 02:22:08 | [diff] [blame] | 72 | // Set the callback to run when the user has requested to close the surface. |
| 73 | // This runs before the normal |close_callback_| and should not be used to |
| 74 | // actually close the surface. |
| 75 | void set_pre_close_callback(const base::RepeatingClosure& close_callback) { |
| 76 | pre_close_callback_ = close_callback; |
| 77 | } |
| 78 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 79 | // Set the callback to run when the surface is destroyed. |
| 80 | void set_surface_destroyed_callback( |
| 81 | base::OnceClosure surface_destroyed_callback) { |
| 82 | surface_destroyed_callback_ = std::move(surface_destroyed_callback); |
| 83 | } |
| 84 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 85 | // Activates the shell surface. |
| 86 | void Activate(); |
| 87 | |
| 88 | // Set title for the surface. |
| 89 | void SetTitle(const base::string16& title); |
| 90 | |
| 91 | // Set icon for the surface. |
| 92 | void SetIcon(const gfx::ImageSkia& icon); |
| 93 | |
| 94 | // Sets the system modality. |
| 95 | void SetSystemModal(bool system_modal); |
| 96 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 97 | // Set the application ID for the surface. |
David Reveman | 8bc1641 | 2018-04-19 21:59:11 | [diff] [blame] | 98 | void SetApplicationId(const char* application_id); |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 99 | |
Tim Zheng | 08df566 | 2018-04-04 05:08:15 | [diff] [blame] | 100 | // Set the startup ID for the surface. |
| 101 | void SetStartupId(const char* startup_id); |
| 102 | |
Yuki Awano | b4514da | 2018-06-28 05:29:19 | [diff] [blame] | 103 | // Set the child ax tree ID for the surface. |
Dominic Mazzoni | 336bc006 | 2018-09-23 16:46:43 | [diff] [blame] | 104 | void SetChildAxTreeId(ui::AXTreeID child_ax_tree_id); |
Yuki Awano | b4514da | 2018-06-28 05:29:19 | [diff] [blame] | 105 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 106 | // Set geometry for surface. The geometry represents the "visible bounds" |
| 107 | // for the surface from the user's perspective. |
| 108 | void SetGeometry(const gfx::Rect& geometry); |
| 109 | |
Dominik Laskowski | 4c265736 | 2018-09-05 00:35:09 | [diff] [blame] | 110 | // If set, geometry is in display rather than window or screen coordinates. |
| 111 | void SetDisplay(int64_t display_id); |
| 112 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 113 | // Set origin in screen coordinate space. |
| 114 | void SetOrigin(const gfx::Point& origin); |
| 115 | |
| 116 | // Set activatable state for surface. |
| 117 | void SetActivatable(bool activatable); |
| 118 | |
| 119 | // Set container for surface. |
| 120 | void SetContainer(int container); |
| 121 | |
| 122 | // Set the maximum size for the surface. |
| 123 | void SetMaximumSize(const gfx::Size& size); |
| 124 | |
| 125 | // Set the miniumum size for the surface. |
| 126 | void SetMinimumSize(const gfx::Size& size); |
| 127 | |
yoshiki iguchi | 239252ce | 2019-01-12 03:22:06 | [diff] [blame] | 128 | // Set the aspect ratio for the surface. |
| 129 | void SetAspectRatio(const gfx::SizeF& aspect_ratio); |
| 130 | |
| 131 | // Set the flag if the surface can maximize or not. |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 132 | void SetCanMinimize(bool can_minimize); |
| 133 | |
Mitsuru Oshima | 6288137 | 2018-02-06 01:45:04 | [diff] [blame] | 134 | // Prevents shell surface from being moved. |
| 135 | void DisableMovement(); |
| 136 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 137 | // Returns a trace value representing the state of the surface. |
| 138 | std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const; |
| 139 | |
Peter Kasting | 9ffb58bc7 | 2020-01-13 17:28:05 | [diff] [blame] | 140 | // SurfaceDelegate: |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 141 | void OnSurfaceCommit() override; |
Dominik Laskowski | 14a16377 | 2018-02-09 19:25:18 | [diff] [blame] | 142 | bool IsInputEnabled(Surface* surface) const override; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 143 | void OnSetFrame(SurfaceFrameType type) override; |
David Reveman | 786d318 | 2017-12-20 22:04:33 | [diff] [blame] | 144 | void OnSetFrameColors(SkColor active_color, SkColor inactive_color) override; |
Tim Zheng | 08df566 | 2018-04-04 05:08:15 | [diff] [blame] | 145 | void OnSetStartupId(const char* startup_id) override; |
David Reveman | 21e2236d | 2018-04-12 06:01:10 | [diff] [blame] | 146 | void OnSetApplicationId(const char* application_id) override; |
Chloe Pelling | 8a8acdeb | 2020-07-07 10:45:20 | [diff] [blame] | 147 | void SetUseImmersiveForFullscreen(bool value) override; |
Nicholas Hollingum | bad8a05f6 | 2019-12-05 05:56:21 | [diff] [blame] | 148 | void OnActivationRequested() override; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 149 | |
Peter Kasting | 9ffb58bc7 | 2020-01-13 17:28:05 | [diff] [blame] | 150 | // SurfaceObserver: |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 151 | void OnSurfaceDestroying(Surface* surface) override; |
Prabir Pradhan | 875083e | 2020-07-22 20:06:27 | [diff] [blame] | 152 | void OnContentSizeChanged(Surface*) override {} |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 153 | |
Peter Kasting | 9ffb58bc7 | 2020-01-13 17:28:05 | [diff] [blame] | 154 | // CaptureClientObserver: |
Mitsuru Oshima | a969732 | 2018-06-19 07:11:53 | [diff] [blame] | 155 | void OnCaptureChanged(aura::Window* lost_capture, |
| 156 | aura::Window* gained_capture) override; |
| 157 | |
Peter Kasting | 9ffb58bc7 | 2020-01-13 17:28:05 | [diff] [blame] | 158 | // views::WidgetDelegate: |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 159 | bool CanResize() const override; |
| 160 | bool CanMaximize() const override; |
| 161 | bool CanMinimize() const override; |
Dana Fried | 46c516e | 2018-12-17 23:00:52 | [diff] [blame] | 162 | bool OnCloseRequested(views::Widget::ClosedReason close_reason) override; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 163 | void WindowClosing() override; |
Allen Bauer | d66100e | 2020-02-10 18:11:43 | [diff] [blame] | 164 | views::Widget* GetWidget() override; |
| 165 | const views::Widget* GetWidget() const override; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 166 | views::View* GetContentsView() override; |
Thomas Lukaszewicz | 814abb35 | 2020-06-29 21:35:16 | [diff] [blame] | 167 | std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView( |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 168 | views::Widget* widget) override; |
| 169 | bool WidgetHasHitTestMask() const override; |
Raul Tambre | 038e96d | 2019-01-07 21:47:44 | [diff] [blame] | 170 | void GetWidgetHitTestMask(SkPath* mask) const override; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 171 | |
Peter Kasting | 9ffb58bc7 | 2020-01-13 17:28:05 | [diff] [blame] | 172 | // views::WidgetObserver: |
Nicholas Hollingum | 266cddd | 2019-10-03 06:12:44 | [diff] [blame] | 173 | void OnWidgetClosing(views::Widget* widget) override; |
| 174 | |
Peter Kasting | 9ffb58bc7 | 2020-01-13 17:28:05 | [diff] [blame] | 175 | // views::View: |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 176 | gfx::Size CalculatePreferredSize() const override; |
| 177 | gfx::Size GetMinimumSize() const override; |
| 178 | gfx::Size GetMaximumSize() const override; |
Yuki Awano | b4514da | 2018-06-28 05:29:19 | [diff] [blame] | 179 | void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 180 | |
Peter Kasting | 9ffb58bc7 | 2020-01-13 17:28:05 | [diff] [blame] | 181 | // aura::WindowObserver: |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 182 | void OnWindowDestroying(aura::Window* window) override; |
Yuichiro Hanada | 3a6c31d0 | 2020-06-03 08:45:12 | [diff] [blame] | 183 | void OnWindowPropertyChanged(aura::Window* window, |
| 184 | const void* key, |
| 185 | intptr_t old_value) override; |
Mitsuru Oshima | 91322d5 | 2020-08-03 22:43:33 | [diff] [blame] | 186 | void OnWindowAddedToRootWindow(aura::Window* window) override; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 187 | |
Peter Kasting | 9ffb58bc7 | 2020-01-13 17:28:05 | [diff] [blame] | 188 | // wm::ActivationChangeObserver: |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 189 | void OnWindowActivated(ActivationReason reason, |
| 190 | aura::Window* gained_active, |
| 191 | aura::Window* lost_active) override; |
| 192 | |
Peter Kasting | 9ffb58bc7 | 2020-01-13 17:28:05 | [diff] [blame] | 193 | // ui::AcceleratorTarget: |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 194 | bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 195 | |
Mitsuru Oshima | 4eb127ce | 2018-07-09 23:53:39 | [diff] [blame] | 196 | bool frame_enabled() const { |
| 197 | return frame_type_ != SurfaceFrameType::NONE && |
| 198 | frame_type_ != SurfaceFrameType::SHADOW; |
| 199 | } |
| 200 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 201 | Surface* surface_for_testing() { return root_surface(); } |
Kazuki Takise | 709a7fc | 2020-07-07 10:39:00 | [diff] [blame] | 202 | bool get_shadow_bounds_changed_for_testing() { |
| 203 | return shadow_bounds_changed_; |
| 204 | } |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 205 | |
| 206 | protected: |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 207 | // Creates the |widget_| for |surface_|. |show_state| is the initial state |
| 208 | // of the widget (e.g. maximized). |
| 209 | void CreateShellSurfaceWidget(ui::WindowShowState show_state); |
| 210 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 211 | // Returns true if surface is currently being resized. |
| 212 | bool IsResizing() const; |
| 213 | |
| 214 | // Updates the bounds of widget to match the current surface bounds. |
| 215 | void UpdateWidgetBounds(); |
| 216 | |
| 217 | // Called by UpdateWidgetBounds to set widget bounds. |
Dominik Laskowski | 2398e74d | 2018-08-16 21:28:31 | [diff] [blame] | 218 | virtual void SetWidgetBounds(const gfx::Rect& bounds) = 0; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 219 | |
| 220 | // Updates the bounds of surface to match the current widget bounds. |
| 221 | void UpdateSurfaceBounds(); |
| 222 | |
| 223 | // Creates, deletes and update the shadow bounds based on |
| 224 | // |shadow_bounds_|. |
| 225 | void UpdateShadow(); |
| 226 | |
Kazuki Takise | 2186bd04 | 2020-05-12 03:25:32 | [diff] [blame] | 227 | virtual void UpdateFrameType(); |
| 228 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 229 | // Applies |system_modal_| to |widget_|. |
| 230 | void UpdateSystemModal(); |
| 231 | |
| 232 | // Returns the "visible bounds" for the surface from the user's perspective. |
| 233 | gfx::Rect GetVisibleBounds() const; |
| 234 | |
Mitsuru Oshima | a969732 | 2018-06-19 07:11:53 | [diff] [blame] | 235 | // Returns the bounds of the client area.nnn |
| 236 | gfx::Rect GetClientViewBounds() const; |
| 237 | |
Dominik Laskowski | 2d431641 | 2017-12-13 19:14:44 | [diff] [blame] | 238 | // In the local coordinate system of the window. |
| 239 | virtual gfx::Rect GetShadowBounds() const; |
| 240 | |
Mitsuru Oshima | a969732 | 2018-06-19 07:11:53 | [diff] [blame] | 241 | // Start the event capture on this surface. |
| 242 | void StartCapture(); |
| 243 | |
Mitsuru Oshima | 014ad08 | 2018-03-30 22:36:06 | [diff] [blame] | 244 | const gfx::Rect& geometry() const { return geometry_; } |
| 245 | |
Mitsuru Oshima | 37a0eedb | 2018-09-14 20:42:21 | [diff] [blame] | 246 | // Install custom window targeter. Used to restore window targeter. |
| 247 | void InstallCustomWindowTargeter(); |
| 248 | |
Mitsuru Oshima | aff9c529 | 2019-05-22 07:49:14 | [diff] [blame] | 249 | // Creates a NonClientFrameView for shell surface. |
Thomas Lukaszewicz | 814abb35 | 2020-06-29 21:35:16 | [diff] [blame] | 250 | std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameViewInternal( |
Mitsuru Oshima | aff9c529 | 2019-05-22 07:49:14 | [diff] [blame] | 251 | views::Widget* widget, |
| 252 | bool client_controlled); |
| 253 | |
Kazuki Takise | 709a7fc | 2020-07-07 10:39:00 | [diff] [blame] | 254 | virtual void OnPostWidgetCommit(); |
| 255 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 256 | views::Widget* widget_ = nullptr; |
| 257 | aura::Window* parent_ = nullptr; |
| 258 | bool movement_disabled_ = false; |
| 259 | gfx::Point origin_; |
| 260 | |
| 261 | // Container Window Id (see ash/public/cpp/shell_window_ids.h) |
| 262 | int container_; |
Jun Mukai | 17c449d | 2018-04-13 18:38:38 | [diff] [blame] | 263 | gfx::Rect geometry_; |
| 264 | gfx::Rect pending_geometry_; |
Dominik Laskowski | 4c265736 | 2018-09-05 00:35:09 | [diff] [blame] | 265 | int64_t display_id_ = display::kInvalidDisplayId; |
| 266 | int64_t pending_display_id_ = display::kInvalidDisplayId; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 267 | base::Optional<gfx::Rect> shadow_bounds_; |
| 268 | bool shadow_bounds_changed_ = false; |
Mitsuru Oshima | 8f00050 | 2018-04-07 23:11:50 | [diff] [blame] | 269 | SurfaceFrameType frame_type_ = SurfaceFrameType::NONE; |
Mitsuru Oshima | a969732 | 2018-06-19 07:11:53 | [diff] [blame] | 270 | bool is_popup_ = false; |
| 271 | bool has_grab_ = false; |
Mitsuru Oshima | 8f00050 | 2018-04-07 23:11:50 | [diff] [blame] | 272 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 273 | private: |
[email protected] | 9385573 | 2019-06-24 19:49:30 | [diff] [blame] | 274 | FRIEND_TEST_ALL_PREFIXES(ShellSurfaceTest, |
| 275 | HostWindowBoundsUpdatedAfterCommitWidget); |
| 276 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 277 | // Called on widget creation to initialize its window state. |
| 278 | // TODO(reveman): Remove virtual functions below to avoid FBC problem. |
James Cook | 00e65e9 | 2019-07-25 03:19:08 | [diff] [blame] | 279 | virtual void InitializeWindowState(ash::WindowState* window_state) = 0; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 280 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 281 | // Returns the scale of the surface tree relative to the shell surface. |
| 282 | virtual float GetScale() const; |
| 283 | |
Mitsuru Oshima | 9f18560 | 2018-04-02 21:16:06 | [diff] [blame] | 284 | // Return the bounds of the widget/origin of surface taking visible |
| 285 | // bounds and current resize direction into account. |
Dominik Laskowski | 090ddbf | 2018-08-16 21:21:18 | [diff] [blame] | 286 | virtual base::Optional<gfx::Rect> GetWidgetBounds() const = 0; |
| 287 | virtual gfx::Point GetSurfaceOrigin() const = 0; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 288 | |
Dominik Laskowski | 4e71dae | 2018-08-25 04:12:45 | [diff] [blame] | 289 | // Commit is deferred if this returns false. |
| 290 | virtual bool OnPreWidgetCommit() = 0; |
Dominik Laskowski | 5b1287f | 2018-08-15 23:18:46 | [diff] [blame] | 291 | |
| 292 | void CommitWidget(); |
| 293 | |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 294 | bool activatable_ = true; |
| 295 | bool can_minimize_ = true; |
David Reveman | 786d318 | 2017-12-20 22:04:33 | [diff] [blame] | 296 | bool has_frame_colors_ = false; |
| 297 | SkColor active_frame_color_ = SK_ColorBLACK; |
| 298 | SkColor inactive_frame_color_ = SK_ColorBLACK; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 299 | bool pending_show_widget_ = false; |
David Reveman | 8bc1641 | 2018-04-19 21:59:11 | [diff] [blame] | 300 | base::Optional<std::string> application_id_; |
| 301 | base::Optional<std::string> startup_id_; |
Chloe Pelling | 8a8acdeb | 2020-07-07 10:45:20 | [diff] [blame] | 302 | bool immersive_implied_by_fullscreen_ = true; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 303 | base::RepeatingClosure close_callback_; |
Nicholas Hollingum | 3acc1d1 | 2019-09-09 02:22:08 | [diff] [blame] | 304 | base::RepeatingClosure pre_close_callback_; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 305 | base::OnceClosure surface_destroyed_callback_; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 306 | bool system_modal_ = false; |
| 307 | bool non_system_modal_window_was_active_ = false; |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 308 | gfx::Size minimum_size_; |
| 309 | gfx::Size pending_minimum_size_; |
| 310 | gfx::Size maximum_size_; |
| 311 | gfx::Size pending_maximum_size_; |
yoshiki iguchi | 239252ce | 2019-01-12 03:22:06 | [diff] [blame] | 312 | gfx::SizeF pending_aspect_ratio_; |
Dominic Mazzoni | 336bc006 | 2018-09-23 16:46:43 | [diff] [blame] | 313 | ui::AXTreeID child_ax_tree_id_ = ui::AXTreeIDUnknown(); |
Mitsuru Oshima | 3e16579 | 2017-12-11 22:27:48 | [diff] [blame] | 314 | |
| 315 | DISALLOW_COPY_AND_ASSIGN(ShellSurfaceBase); |
| 316 | }; |
| 317 | |
| 318 | } // namespace exo |
| 319 | |
| 320 | #endif // COMPONENTS_EXO_SHELL_SURFACE_BASE_H_ |