Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: components/exo/shell_surface.h

Issue 2040743002: exo: Implement version 2 of remote shell interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remote-shell-version-2
Patch Set: popup placement fix Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 public views::WidgetDelegate, 42 public views::WidgetDelegate,
43 public views::View, 43 public views::View,
44 public ash::wm::WindowStateObserver, 44 public ash::wm::WindowStateObserver,
45 public aura::WindowObserver, 45 public aura::WindowObserver,
46 public aura::client::ActivationChangeObserver { 46 public aura::client::ActivationChangeObserver {
47 public: 47 public:
48 ShellSurface(Surface* surface, 48 ShellSurface(Surface* surface,
49 ShellSurface* parent, 49 ShellSurface* parent,
50 const gfx::Rect& initial_bounds, 50 const gfx::Rect& initial_bounds,
51 bool activatable, 51 bool activatable,
52 bool resizeable,
53 int container); 52 int container);
54 explicit ShellSurface(Surface* surface); 53 explicit ShellSurface(Surface* surface);
55 ~ShellSurface() override; 54 ~ShellSurface() override;
56 55
57 // Set the callback to run when the user wants the shell surface to be closed. 56 // Set the callback to run when the user wants the shell surface to be closed.
58 // The receiver can chose to not close the window on this signal. 57 // The receiver can chose to not close the window on this signal.
59 void set_close_callback(const base::Closure& close_callback) { 58 void set_close_callback(const base::Closure& close_callback) {
60 close_callback_ = close_callback; 59 close_callback_ = close_callback;
61 } 60 }
62 61
63 // Set the callback to run when the surface is destroyed. 62 // Set the callback to run when the surface is destroyed.
64 void set_surface_destroyed_callback( 63 void set_surface_destroyed_callback(
65 const base::Closure& surface_destroyed_callback) { 64 const base::Closure& surface_destroyed_callback) {
66 surface_destroyed_callback_ = surface_destroyed_callback; 65 surface_destroyed_callback_ = surface_destroyed_callback;
67 } 66 }
68 67
68 // Set the callback to run when the surface state changed.
69 using StateChangedCallback =
70 base::Callback<void(ash::wm::WindowStateType old_state_type,
71 ash::wm::WindowStateType new_state_type)>;
72 void set_state_changed_callback(
73 const StateChangedCallback& state_changed_callback) {
74 state_changed_callback_ = state_changed_callback;
75 }
76
69 // Set the callback to run when the client is asked to configure the surface. 77 // Set the callback to run when the client is asked to configure the surface.
70 // The size is a hint, in the sense that the client is free to ignore it if 78 // The size is a hint, in the sense that the client is free to ignore it if
71 // it doesn't resize, pick a smaller size (to satisfy aspect ratio or resize 79 // it doesn't resize, pick a smaller size (to satisfy aspect ratio or resize
72 // in steps of NxM pixels). 80 // in steps of NxM pixels).
73 using ConfigureCallback = 81 using ConfigureCallback =
74 base::Callback<uint32_t(const gfx::Size& size, 82 base::Callback<uint32_t(const gfx::Size& size,
75 ash::wm::WindowStateType state_type, 83 ash::wm::WindowStateType state_type,
76 bool resizing, 84 bool resizing,
77 bool activated)>; 85 bool activated)>;
78 void set_configure_callback(const ConfigureCallback& configure_callback) { 86 void set_configure_callback(const ConfigureCallback& configure_callback) {
79 configure_callback_ = configure_callback; 87 configure_callback_ = configure_callback;
80 } 88 }
81 89
82 // When the client is asked to configure the surface, it should acknowledge 90 // When the client is asked to configure the surface, it should acknowledge
83 // the configure request sometime before the commit. |serial| is the serial 91 // the configure request sometime before the commit. |serial| is the serial
84 // from the configure callback. 92 // from the configure callback.
85 void AcknowledgeConfigure(uint32_t serial); 93 void AcknowledgeConfigure(uint32_t serial);
86 94
87 // Set the "parent" of this surface. This window should be stacked above a 95 // Set the "parent" of this surface. This window should be stacked above a
88 // parent. 96 // parent.
89 void SetParent(ShellSurface* parent); 97 void SetParent(ShellSurface* parent);
90 98
91 // Maximizes the shell surface. 99 // Maximizes the shell surface.
92 void Maximize(); 100 void Maximize();
93 101
102 // Minimize the shell surface.
103 void Minimize();
104
94 // Restore the shell surface. 105 // Restore the shell surface.
95 void Restore(); 106 void Restore();
96 107
97 // Set fullscreen state for shell surface. 108 // Set fullscreen state for shell surface.
98 void SetFullscreen(bool fullscreen); 109 void SetFullscreen(bool fullscreen);
99 110
100 // Set title for surface. 111 // Set title for surface.
101 void SetTitle(const base::string16& title); 112 void SetTitle(const base::string16& title);
102 113
103 // Sets the application ID for the window. The application ID identifies the 114 // Sets the application ID for the window. The application ID identifies the
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const; 148 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const;
138 149
139 // Overridden from SurfaceDelegate: 150 // Overridden from SurfaceDelegate:
140 void OnSurfaceCommit() override; 151 void OnSurfaceCommit() override;
141 bool IsSurfaceSynchronized() const override; 152 bool IsSurfaceSynchronized() const override;
142 153
143 // Overridden from SurfaceObserver: 154 // Overridden from SurfaceObserver:
144 void OnSurfaceDestroying(Surface* surface) override; 155 void OnSurfaceDestroying(Surface* surface) override;
145 156
146 // Overridden from views::WidgetDelegate: 157 // Overridden from views::WidgetDelegate:
158 bool CanResize() const override;
147 bool CanMaximize() const override; 159 bool CanMaximize() const override;
148 bool CanResize() const override; 160 bool CanMinimize() const override;
149 base::string16 GetWindowTitle() const override; 161 base::string16 GetWindowTitle() const override;
150 void WindowClosing() override; 162 void WindowClosing() override;
151 views::Widget* GetWidget() override; 163 views::Widget* GetWidget() override;
152 const views::Widget* GetWidget() const override; 164 const views::Widget* GetWidget() const override;
153 views::View* GetContentsView() override; 165 views::View* GetContentsView() override;
154 views::NonClientFrameView* CreateNonClientFrameView( 166 views::NonClientFrameView* CreateNonClientFrameView(
155 views::Widget* widget) override; 167 views::Widget* widget) override;
156 bool WidgetHasHitTestMask() const override; 168 bool WidgetHasHitTestMask() const override;
157 void GetWidgetHitTestMask(gfx::Path* mask) const override; 169 void GetWidgetHitTestMask(gfx::Path* mask) const override;
158 170
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 gfx::Point GetSurfaceOrigin() const; 226 gfx::Point GetSurfaceOrigin() const;
215 227
216 // Updates the bounds of widget to match the current surface bounds. 228 // Updates the bounds of widget to match the current surface bounds.
217 void UpdateWidgetBounds(); 229 void UpdateWidgetBounds();
218 230
219 views::Widget* widget_; 231 views::Widget* widget_;
220 Surface* surface_; 232 Surface* surface_;
221 aura::Window* parent_; 233 aura::Window* parent_;
222 const gfx::Rect initial_bounds_; 234 const gfx::Rect initial_bounds_;
223 const bool activatable_; 235 const bool activatable_;
224 const bool resizeable_;
225 // Container Window Id (see ash/common/shell_window_ids.h) 236 // Container Window Id (see ash/common/shell_window_ids.h)
226 const int container_; 237 const int container_;
238 bool pending_show_widget_;
227 base::string16 title_; 239 base::string16 title_;
228 std::string application_id_; 240 std::string application_id_;
229 gfx::Rect geometry_; 241 gfx::Rect geometry_;
230 gfx::Rect pending_geometry_; 242 gfx::Rect pending_geometry_;
231 double scale_; 243 double scale_;
232 double pending_scale_; 244 double pending_scale_;
233 base::Closure close_callback_; 245 base::Closure close_callback_;
234 base::Closure surface_destroyed_callback_; 246 base::Closure surface_destroyed_callback_;
247 StateChangedCallback state_changed_callback_;
235 ConfigureCallback configure_callback_; 248 ConfigureCallback configure_callback_;
236 ScopedConfigure* scoped_configure_; 249 ScopedConfigure* scoped_configure_;
237 bool ignore_window_bounds_changes_; 250 bool ignore_window_bounds_changes_;
238 gfx::Point origin_; 251 gfx::Point origin_;
239 gfx::Vector2d pending_origin_offset_; 252 gfx::Vector2d pending_origin_offset_;
240 gfx::Vector2d pending_origin_config_offset_; 253 gfx::Vector2d pending_origin_config_offset_;
241 int resize_component_; // HT constant (see ui/base/hit_test.h) 254 int resize_component_; // HT constant (see ui/base/hit_test.h)
242 int pending_resize_component_; 255 int pending_resize_component_;
243 std::deque<Config> pending_configs_; 256 std::deque<Config> pending_configs_;
244 std::unique_ptr<ash::WindowResizer> resizer_; 257 std::unique_ptr<ash::WindowResizer> resizer_;
245 258
246 DISALLOW_COPY_AND_ASSIGN(ShellSurface); 259 DISALLOW_COPY_AND_ASSIGN(ShellSurface);
247 }; 260 };
248 261
249 } // namespace exo 262 } // namespace exo
250 263
251 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ 264 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698