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

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

Issue 2548653005: exo: Add initial support for service side decorations. (Closed)
Patch Set: fix typo Created 4 years 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
« no previous file with comments | « components/exo/pointer_unittest.cc ('k') | components/exo/shell_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 public views::View, 44 public views::View,
45 public ash::wm::WindowStateObserver, 45 public ash::wm::WindowStateObserver,
46 public aura::WindowObserver, 46 public aura::WindowObserver,
47 public WMHelper::ActivationObserver, 47 public WMHelper::ActivationObserver,
48 public WMHelper::AccessibilityObserver { 48 public WMHelper::AccessibilityObserver {
49 public: 49 public:
50 ShellSurface(Surface* surface, 50 ShellSurface(Surface* surface,
51 ShellSurface* parent, 51 ShellSurface* parent,
52 const gfx::Rect& initial_bounds, 52 const gfx::Rect& initial_bounds,
53 bool activatable, 53 bool activatable,
54 bool can_minimize,
54 int container); 55 int container);
55 explicit ShellSurface(Surface* surface); 56 explicit ShellSurface(Surface* surface);
56 ~ShellSurface() override; 57 ~ShellSurface() override;
57 58
58 // Set the callback to run when the user wants the shell surface to be closed. 59 // Set the callback to run when the user wants the shell surface to be closed.
59 // The receiver can chose to not close the window on this signal. 60 // The receiver can chose to not close the window on this signal.
60 void set_close_callback(const base::Closure& close_callback) { 61 void set_close_callback(const base::Closure& close_callback) {
61 close_callback_ = close_callback; 62 close_callback_ = close_callback;
62 } 63 }
63 64
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 void Resize(int component); 140 void Resize(int component);
140 141
141 // Signal a request to close the window. It is up to the implementation to 142 // Signal a request to close the window. It is up to the implementation to
142 // actually decide to do so though. 143 // actually decide to do so though.
143 void Close(); 144 void Close();
144 145
145 // Set geometry for surface. The geometry represents the "visible bounds" 146 // Set geometry for surface. The geometry represents the "visible bounds"
146 // for the surface from the user's perspective. 147 // for the surface from the user's perspective.
147 void SetGeometry(const gfx::Rect& geometry); 148 void SetGeometry(const gfx::Rect& geometry);
148 149
149 // Set the content bounds for the shadow. Empty bounds will delete 150 // Enable/disable rectangular shadow.
150 // the shadow. 151 void SetRectangularShadow(bool enabled);
151 void SetRectangularShadow(const gfx::Rect& content_bounds); 152
153 // Set the content bounds for the shadow. Shell surface geometry will be
154 // used if bounds are empty.
155 void SetRectangularShadowContentBounds(const gfx::Rect& content_bounds);
152 156
153 // Set the pacity of the background for the window that has a shadow. 157 // Set the pacity of the background for the window that has a shadow.
154 void SetRectangularShadowBackgroundOpacity(float opacity); 158 void SetRectangularShadowBackgroundOpacity(float opacity);
155 159
160 // Enable/disable window frame.
161 void SetFrame(bool enabled);
162
156 // Set scale factor for surface. The scale factor will be applied to surface 163 // Set scale factor for surface. The scale factor will be applied to surface
157 // and all descendants. 164 // and all descendants.
158 void SetScale(double scale); 165 void SetScale(double scale);
159 166
160 // Set top inset for surface. 167 // Set top inset for surface.
161 void SetTopInset(int height); 168 void SetTopInset(int height);
162 169
163 // Set origin in screen coordinate space. 170 // Set origin in screen coordinate space.
164 void SetOrigin(const gfx::Point& origin); 171 void SetOrigin(const gfx::Point& origin);
165 172
166 // Set activatable state for surface. 173 // Set container for surface.
167 void SetActivatable(bool activatable); 174 void SetContainer(int container);
168 175
169 // Sets the main surface for the window. 176 // Sets the main surface for the window.
170 static void SetMainSurface(aura::Window* window, Surface* surface); 177 static void SetMainSurface(aura::Window* window, Surface* surface);
171 178
172 // Returns the main Surface instance or nullptr if it is not set. 179 // Returns the main Surface instance or nullptr if it is not set.
173 // |window| must not be nullptr. 180 // |window| must not be nullptr.
174 static Surface* GetMainSurface(const aura::Window* window); 181 static Surface* GetMainSurface(const aura::Window* window);
175 182
176 // Returns a trace value representing the state of the surface. 183 // Returns a trace value representing the state of the surface.
177 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const; 184 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const;
(...skipping 14 matching lines...) Expand all
192 views::Widget* GetWidget() override; 199 views::Widget* GetWidget() override;
193 const views::Widget* GetWidget() const override; 200 const views::Widget* GetWidget() const override;
194 views::View* GetContentsView() override; 201 views::View* GetContentsView() override;
195 views::NonClientFrameView* CreateNonClientFrameView( 202 views::NonClientFrameView* CreateNonClientFrameView(
196 views::Widget* widget) override; 203 views::Widget* widget) override;
197 bool WidgetHasHitTestMask() const override; 204 bool WidgetHasHitTestMask() const override;
198 void GetWidgetHitTestMask(gfx::Path* mask) const override; 205 void GetWidgetHitTestMask(gfx::Path* mask) const override;
199 206
200 // Overridden from views::View: 207 // Overridden from views::View:
201 gfx::Size GetPreferredSize() const override; 208 gfx::Size GetPreferredSize() const override;
209 gfx::Size GetMinimumSize() const override;
202 210
203 // Overridden from ash::wm::WindowStateObserver: 211 // Overridden from ash::wm::WindowStateObserver:
204 void OnPreWindowStateTypeChange(ash::wm::WindowState* window_state, 212 void OnPreWindowStateTypeChange(ash::wm::WindowState* window_state,
205 ash::wm::WindowStateType old_type) override; 213 ash::wm::WindowStateType old_type) override;
206 void OnPostWindowStateTypeChange(ash::wm::WindowState* window_state, 214 void OnPostWindowStateTypeChange(ash::wm::WindowState* window_state,
207 ash::wm::WindowStateType old_type) override; 215 ash::wm::WindowStateType old_type) override;
208 216
209 // Overridden from aura::WindowObserver: 217 // Overridden from aura::WindowObserver:
210 void OnWindowBoundsChanged(aura::Window* window, 218 void OnWindowBoundsChanged(aura::Window* window,
211 const gfx::Rect& old_bounds, 219 const gfx::Rect& old_bounds,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 277
270 // Creates, deletes and update the shadow bounds based on 278 // Creates, deletes and update the shadow bounds based on
271 // |pending_shadow_content_bounds_|. 279 // |pending_shadow_content_bounds_|.
272 void UpdateShadow(); 280 void UpdateShadow();
273 281
274 views::Widget* widget_ = nullptr; 282 views::Widget* widget_ = nullptr;
275 Surface* surface_; 283 Surface* surface_;
276 aura::Window* parent_; 284 aura::Window* parent_;
277 gfx::Rect initial_bounds_; 285 gfx::Rect initial_bounds_;
278 bool activatable_ = true; 286 bool activatable_ = true;
287 const bool can_minimize_;
279 // Container Window Id (see ash/public/cpp/shell_window_ids.h) 288 // Container Window Id (see ash/public/cpp/shell_window_ids.h)
280 const int container_; 289 int container_;
290 bool frame_enabled_ = false;
291 bool shadow_enabled_ = false;
281 bool pending_show_widget_ = false; 292 bool pending_show_widget_ = false;
282 base::string16 title_; 293 base::string16 title_;
283 std::string application_id_; 294 std::string application_id_;
284 gfx::Rect geometry_; 295 gfx::Rect geometry_;
285 gfx::Rect pending_geometry_; 296 gfx::Rect pending_geometry_;
286 double scale_ = 1.0; 297 double scale_ = 1.0;
287 double pending_scale_ = 1.0; 298 double pending_scale_ = 1.0;
288 base::Closure close_callback_; 299 base::Closure close_callback_;
289 base::Closure surface_destroyed_callback_; 300 base::Closure surface_destroyed_callback_;
290 StateChangedCallback state_changed_callback_; 301 StateChangedCallback state_changed_callback_;
291 ConfigureCallback configure_callback_; 302 ConfigureCallback configure_callback_;
292 ScopedConfigure* scoped_configure_ = nullptr; 303 ScopedConfigure* scoped_configure_ = nullptr;
293 bool ignore_window_bounds_changes_ = false; 304 bool ignore_window_bounds_changes_ = false;
294 gfx::Point origin_; 305 gfx::Point origin_;
295 gfx::Vector2d pending_origin_offset_; 306 gfx::Vector2d pending_origin_offset_;
296 gfx::Vector2d pending_origin_config_offset_; 307 gfx::Vector2d pending_origin_config_offset_;
297 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h) 308 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h)
298 int pending_resize_component_ = HTCAPTION; 309 int pending_resize_component_ = HTCAPTION;
299 aura::Window* shadow_overlay_ = nullptr; 310 aura::Window* shadow_overlay_ = nullptr;
300 aura::Window* shadow_underlay_ = nullptr; 311 aura::Window* shadow_underlay_ = nullptr;
301 std::unique_ptr<ui::EventHandler> shadow_underlay_event_handler_; 312 std::unique_ptr<ui::EventHandler> shadow_underlay_event_handler_;
302 gfx::Rect shadow_content_bounds_; 313 gfx::Rect shadow_content_bounds_;
314 float shadow_background_opacity_ = 1.0;
303 std::deque<Config> pending_configs_; 315 std::deque<Config> pending_configs_;
304 std::unique_ptr<ash::WindowResizer> resizer_; 316 std::unique_ptr<ash::WindowResizer> resizer_;
305 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_; 317 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_;
306 int top_inset_height_ = 0; 318 int top_inset_height_ = 0;
307 int pending_top_inset_height_ = 0; 319 int pending_top_inset_height_ = 0;
308 float rectangular_shadow_background_opacity_ = 1.0;
309 320
310 DISALLOW_COPY_AND_ASSIGN(ShellSurface); 321 DISALLOW_COPY_AND_ASSIGN(ShellSurface);
311 }; 322 };
312 323
313 } // namespace exo 324 } // namespace exo
314 325
315 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ 326 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_
OLDNEW
« no previous file with comments | « components/exo/pointer_unittest.cc ('k') | components/exo/shell_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698