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

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

Issue 2688483003: exo: Refactor ShellSurface and WaylandRemoteShell (Closed)
Patch Set: Address nits Created 3 years, 10 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 29 matching lines...) Expand all
40 // metadata like title and class, etc. 40 // metadata like title and class, etc.
41 class ShellSurface : public SurfaceDelegate, 41 class ShellSurface : public SurfaceDelegate,
42 public SurfaceObserver, 42 public SurfaceObserver,
43 public views::WidgetDelegate, 43 public views::WidgetDelegate,
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 enum class BoundsMode { SHELL, CLIENT, FIXED };
51
52 // The |origin| is in screen coordinates. When bounds are controlled by the
53 // shell or fixed, it determines the initial position of the shell surface.
54 // In that case, the position specified as part of the geometry is relative
55 // to the shell surface.
56 //
57 // When bounds are controlled by the client, it represents the origin of a
58 // coordinate system to which the position of the shell surface, specified
59 // as part of the geometry, is relative.
50 ShellSurface(Surface* surface, 60 ShellSurface(Surface* surface,
51 ShellSurface* parent, 61 ShellSurface* parent,
52 const gfx::Rect& initial_bounds, 62 BoundsMode bounds_mode,
63 const gfx::Point& origin,
53 bool activatable, 64 bool activatable,
54 bool can_minimize, 65 bool can_minimize,
55 int container); 66 int container);
56 explicit ShellSurface(Surface* surface); 67 explicit ShellSurface(Surface* surface);
57 ~ShellSurface() override; 68 ~ShellSurface() override;
58 69
59 // Set the callback to run when the user wants the shell surface to be closed. 70 // Set the callback to run when the user wants the shell surface to be closed.
60 // The receiver can chose to not close the window on this signal. 71 // The receiver can chose to not close the window on this signal.
61 void set_close_callback(const base::Closure& close_callback) { 72 void set_close_callback(const base::Closure& close_callback) {
62 close_callback_ = close_callback; 73 close_callback_ = close_callback;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Returns the "visible bounds" for the surface from the user's perspective. 291 // Returns the "visible bounds" for the surface from the user's perspective.
281 gfx::Rect GetVisibleBounds() const; 292 gfx::Rect GetVisibleBounds() const;
282 293
283 // Returns the origin for the surface taking visible bounds and current 294 // Returns the origin for the surface taking visible bounds and current
284 // resize direction into account. 295 // resize direction into account.
285 gfx::Point GetSurfaceOrigin() const; 296 gfx::Point GetSurfaceOrigin() const;
286 297
287 // Updates the bounds of widget to match the current surface bounds. 298 // Updates the bounds of widget to match the current surface bounds.
288 void UpdateWidgetBounds(); 299 void UpdateWidgetBounds();
289 300
301 // Updates the bounds of surface to match the current widget bounds.
302 void UpdateSurfaceBounds();
303
290 // Creates, deletes and update the shadow bounds based on 304 // Creates, deletes and update the shadow bounds based on
291 // |pending_shadow_content_bounds_|. 305 // |pending_shadow_content_bounds_|.
292 void UpdateShadow(); 306 void UpdateShadow();
293 307
294 views::Widget* widget_ = nullptr; 308 views::Widget* widget_ = nullptr;
295 Surface* surface_; 309 Surface* surface_;
296 aura::Window* parent_; 310 aura::Window* parent_;
297 gfx::Rect initial_bounds_; 311 const BoundsMode bounds_mode_;
312 gfx::Point origin_;
298 bool activatable_ = true; 313 bool activatable_ = true;
299 const bool can_minimize_; 314 const bool can_minimize_;
300 // Container Window Id (see ash/public/cpp/shell_window_ids.h) 315 // Container Window Id (see ash/public/cpp/shell_window_ids.h)
301 int container_; 316 int container_;
302 bool frame_enabled_ = false; 317 bool frame_enabled_ = false;
303 bool shadow_enabled_ = false; 318 bool shadow_enabled_ = false;
304 bool pending_show_widget_ = false; 319 bool pending_show_widget_ = false;
305 base::string16 title_; 320 base::string16 title_;
306 std::string application_id_; 321 std::string application_id_;
307 gfx::Rect geometry_; 322 gfx::Rect geometry_;
308 gfx::Rect pending_geometry_; 323 gfx::Rect pending_geometry_;
309 double scale_ = 1.0; 324 double scale_ = 1.0;
310 double pending_scale_ = 1.0; 325 double pending_scale_ = 1.0;
311 base::Closure close_callback_; 326 base::Closure close_callback_;
312 base::Closure surface_destroyed_callback_; 327 base::Closure surface_destroyed_callback_;
313 StateChangedCallback state_changed_callback_; 328 StateChangedCallback state_changed_callback_;
314 ConfigureCallback configure_callback_; 329 ConfigureCallback configure_callback_;
315 ScopedConfigure* scoped_configure_ = nullptr; 330 ScopedConfigure* scoped_configure_ = nullptr;
316 bool ignore_window_bounds_changes_ = false; 331 bool ignore_window_bounds_changes_ = false;
317 gfx::Point origin_; 332 gfx::Vector2d origin_offset_;
318 gfx::Vector2d pending_origin_offset_; 333 gfx::Vector2d pending_origin_offset_;
319 gfx::Vector2d pending_origin_config_offset_; 334 gfx::Vector2d pending_origin_offset_accumulator_;
320 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h) 335 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h)
321 int pending_resize_component_ = HTCAPTION; 336 int pending_resize_component_ = HTCAPTION;
322 aura::Window* shadow_overlay_ = nullptr; 337 aura::Window* shadow_overlay_ = nullptr;
323 aura::Window* shadow_underlay_ = nullptr; 338 aura::Window* shadow_underlay_ = nullptr;
324 std::unique_ptr<ui::EventHandler> shadow_underlay_event_handler_; 339 std::unique_ptr<ui::EventHandler> shadow_underlay_event_handler_;
325 gfx::Rect shadow_content_bounds_; 340 gfx::Rect shadow_content_bounds_;
326 float shadow_background_opacity_ = 1.0; 341 float shadow_background_opacity_ = 1.0;
327 std::deque<Config> pending_configs_; 342 std::deque<Config> pending_configs_;
328 std::unique_ptr<ash::WindowResizer> resizer_; 343 std::unique_ptr<ash::WindowResizer> resizer_;
329 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_; 344 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_;
330 int top_inset_height_ = 0; 345 int top_inset_height_ = 0;
331 int pending_top_inset_height_ = 0; 346 int pending_top_inset_height_ = 0;
332 bool shadow_underlay_in_surface_ = true; 347 bool shadow_underlay_in_surface_ = true;
333 348
334 DISALLOW_COPY_AND_ASSIGN(ShellSurface); 349 DISALLOW_COPY_AND_ASSIGN(ShellSurface);
335 }; 350 };
336 351
337 } // namespace exo 352 } // namespace exo
338 353
339 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ 354 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698