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

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

Issue 2645663004: exo: Initial support for multiple displays in ARC (Closed)
Patch Set: Rebase 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 public: 49 public:
50 enum class BoundsMode { SHELL, CLIENT, FIXED }; 50 enum class BoundsMode { SHELL, CLIENT, FIXED };
51 51
52 // The |origin| is in screen coordinates. When bounds are controlled by the 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. 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 54 // In that case, the position specified as part of the geometry is relative
55 // to the shell surface. 55 // to the shell surface.
56 // 56 //
57 // When bounds are controlled by the client, it represents the origin of a 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 58 // coordinate system to which the position of the shell surface, specified
59 // as part of the geometry, is relative. 59 // as part of the geometry, is relative. The client must acknowledge changes
60 // to the origin, and offset the geometry accordingly.
60 ShellSurface(Surface* surface, 61 ShellSurface(Surface* surface,
61 ShellSurface* parent, 62 ShellSurface* parent,
62 BoundsMode bounds_mode, 63 BoundsMode bounds_mode,
63 const gfx::Point& origin, 64 const gfx::Point& origin,
64 bool activatable, 65 bool activatable,
65 bool can_minimize, 66 bool can_minimize,
66 int container); 67 int container);
67 explicit ShellSurface(Surface* surface); 68 explicit ShellSurface(Surface* surface);
68 ~ShellSurface() override; 69 ~ShellSurface() override;
69 70
70 // Set the callback to run when the user wants the shell surface to be closed. 71 // Set the callback to run when the user wants the shell surface to be closed.
71 // The receiver can chose to not close the window on this signal. 72 // The receiver can chose to not close the window on this signal.
72 void set_close_callback(const base::Closure& close_callback) { 73 void set_close_callback(const base::Closure& close_callback) {
73 close_callback_ = close_callback; 74 close_callback_ = close_callback;
74 } 75 }
75 76
77 // Set the callback to run when the shell surface is destroyed.
78 void set_destroyed_callback(const base::Closure& destroyed_callback) {
79 destroyed_callback_ = destroyed_callback;
80 }
81
76 // Set the callback to run when the surface is destroyed. 82 // Set the callback to run when the surface is destroyed.
77 void set_surface_destroyed_callback( 83 void set_surface_destroyed_callback(
78 const base::Closure& surface_destroyed_callback) { 84 const base::Closure& surface_destroyed_callback) {
79 surface_destroyed_callback_ = surface_destroyed_callback; 85 surface_destroyed_callback_ = surface_destroyed_callback;
80 } 86 }
81 87
82 // Set the callback to run when the surface state changed. 88 // Set the callback to run when the surface state changed.
83 using StateChangedCallback = 89 using StateChangedCallback =
84 base::Callback<void(ash::wm::WindowStateType old_state_type, 90 base::Callback<void(ash::wm::WindowStateType old_state_type,
85 ash::wm::WindowStateType new_state_type)>; 91 ash::wm::WindowStateType new_state_type)>;
86 void set_state_changed_callback( 92 void set_state_changed_callback(
87 const StateChangedCallback& state_changed_callback) { 93 const StateChangedCallback& state_changed_callback) {
88 state_changed_callback_ = state_changed_callback; 94 state_changed_callback_ = state_changed_callback;
89 } 95 }
90 96
91 // Set the callback to run when the client is asked to configure the surface. 97 // Set the callback to run when the client is asked to configure the surface.
92 // The size is a hint, in the sense that the client is free to ignore it if 98 // The size is a hint, in the sense that the client is free to ignore it if
93 // it doesn't resize, pick a smaller size (to satisfy aspect ratio or resize 99 // it doesn't resize, pick a smaller size (to satisfy aspect ratio or resize
94 // in steps of NxM pixels). 100 // in steps of NxM pixels).
95 using ConfigureCallback = 101 using ConfigureCallback =
96 base::Callback<uint32_t(const gfx::Size& size, 102 base::Callback<uint32_t(const gfx::Size& size,
97 ash::wm::WindowStateType state_type, 103 ash::wm::WindowStateType state_type,
98 bool resizing, 104 bool resizing,
99 bool activated)>; 105 bool activated,
106 const gfx::Point& origin)>;
100 void set_configure_callback(const ConfigureCallback& configure_callback) { 107 void set_configure_callback(const ConfigureCallback& configure_callback) {
101 configure_callback_ = configure_callback; 108 configure_callback_ = configure_callback;
102 } 109 }
103 110
104 // When the client is asked to configure the surface, it should acknowledge 111 // When the client is asked to configure the surface, it should acknowledge
105 // the configure request sometime before the commit. |serial| is the serial 112 // the configure request sometime before the commit. |serial| is the serial
106 // from the configure callback. 113 // from the configure callback.
107 void AcknowledgeConfigure(uint32_t serial); 114 void AcknowledgeConfigure(uint32_t serial);
108 115
109 // Set the "parent" of this surface. This window should be stacked above a 116 // Set the "parent" of this surface. This window should be stacked above a
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // of the widget (e.g. maximized). 282 // of the widget (e.g. maximized).
276 void CreateShellSurfaceWidget(ui::WindowShowState show_state); 283 void CreateShellSurfaceWidget(ui::WindowShowState show_state);
277 284
278 // Asks the client to configure its surface. 285 // Asks the client to configure its surface.
279 void Configure(); 286 void Configure();
280 287
281 // Attempt to start a drag operation. The type of drag operation to start is 288 // Attempt to start a drag operation. The type of drag operation to start is
282 // determined by |component|. 289 // determined by |component|.
283 void AttemptToStartDrag(int component); 290 void AttemptToStartDrag(int component);
284 291
292 // Attempt to start a client-driven drag operation.
293 void AttemptToStartClientDrag();
294
285 // End current drag operation. 295 // End current drag operation.
286 void EndDrag(bool revert); 296 void EndDrag(bool revert);
297 void EndDrag(aura::Window* window, bool revert);
287 298
288 // Returns true if surface is currently being resized. 299 // Returns true if surface is currently being resized.
289 bool IsResizing() const; 300 bool IsResizing() const;
290 301
291 // Returns the "visible bounds" for the surface from the user's perspective. 302 // Returns the "visible bounds" for the surface from the user's perspective.
292 gfx::Rect GetVisibleBounds() const; 303 gfx::Rect GetVisibleBounds() const;
293 304
294 // Returns the origin for the surface taking visible bounds and current 305 // Returns the origin for the surface taking visible bounds and current
295 // resize direction into account. 306 // resize direction into account.
296 gfx::Point GetSurfaceOrigin() const; 307 gfx::Point GetSurfaceOrigin() const;
297 308
298 // Updates the bounds of widget to match the current surface bounds. 309 // Updates the bounds of widget to match the current surface bounds.
299 void UpdateWidgetBounds(); 310 void UpdateWidgetBounds();
300 311
301 // Updates the bounds of surface to match the current widget bounds. 312 // Updates the bounds of surface to match the current widget bounds.
302 void UpdateSurfaceBounds(); 313 void UpdateSurfaceBounds();
303 314
304 // Creates, deletes and update the shadow bounds based on 315 // Creates, deletes and update the shadow bounds based on
305 // |pending_shadow_content_bounds_|. 316 // |pending_shadow_content_bounds_|.
306 void UpdateShadow(); 317 void UpdateShadow();
307 318
319 // In the coordinate system of the parent root window.
320 gfx::Point GetMouseLocation() const;
321
308 views::Widget* widget_ = nullptr; 322 views::Widget* widget_ = nullptr;
309 Surface* surface_; 323 Surface* surface_;
310 aura::Window* parent_; 324 aura::Window* parent_;
311 const BoundsMode bounds_mode_; 325 const BoundsMode bounds_mode_;
312 gfx::Point origin_; 326 gfx::Point origin_;
313 bool activatable_ = true; 327 bool activatable_ = true;
314 const bool can_minimize_; 328 const bool can_minimize_;
315 // Container Window Id (see ash/public/cpp/shell_window_ids.h) 329 // Container Window Id (see ash/public/cpp/shell_window_ids.h)
316 int container_; 330 int container_;
317 bool frame_enabled_ = false; 331 bool frame_enabled_ = false;
318 bool shadow_enabled_ = false; 332 bool shadow_enabled_ = false;
319 bool pending_show_widget_ = false; 333 bool pending_show_widget_ = false;
320 base::string16 title_; 334 base::string16 title_;
321 std::string application_id_; 335 std::string application_id_;
322 gfx::Rect geometry_; 336 gfx::Rect geometry_;
323 gfx::Rect pending_geometry_; 337 gfx::Rect pending_geometry_;
324 double scale_ = 1.0; 338 double scale_ = 1.0;
325 double pending_scale_ = 1.0; 339 double pending_scale_ = 1.0;
326 base::Closure close_callback_; 340 base::Closure close_callback_;
341 base::Closure destroyed_callback_;
327 base::Closure surface_destroyed_callback_; 342 base::Closure surface_destroyed_callback_;
328 StateChangedCallback state_changed_callback_; 343 StateChangedCallback state_changed_callback_;
329 ConfigureCallback configure_callback_; 344 ConfigureCallback configure_callback_;
330 ScopedConfigure* scoped_configure_ = nullptr; 345 ScopedConfigure* scoped_configure_ = nullptr;
331 bool ignore_window_bounds_changes_ = false; 346 bool ignore_window_bounds_changes_ = false;
332 gfx::Vector2d origin_offset_; 347 gfx::Vector2d origin_offset_;
333 gfx::Vector2d pending_origin_offset_; 348 gfx::Vector2d pending_origin_offset_;
334 gfx::Vector2d pending_origin_offset_accumulator_; 349 gfx::Vector2d pending_origin_offset_accumulator_;
335 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h) 350 int resize_component_ = HTCAPTION; // HT constant (see ui/base/hit_test.h)
336 int pending_resize_component_ = HTCAPTION; 351 int pending_resize_component_ = HTCAPTION;
337 aura::Window* shadow_overlay_ = nullptr; 352 aura::Window* shadow_overlay_ = nullptr;
338 aura::Window* shadow_underlay_ = nullptr; 353 aura::Window* shadow_underlay_ = nullptr;
339 std::unique_ptr<ui::EventHandler> shadow_underlay_event_handler_; 354 std::unique_ptr<ui::EventHandler> shadow_underlay_event_handler_;
340 gfx::Rect shadow_content_bounds_; 355 gfx::Rect shadow_content_bounds_;
341 float shadow_background_opacity_ = 1.0; 356 float shadow_background_opacity_ = 1.0;
342 std::deque<Config> pending_configs_; 357 std::deque<Config> pending_configs_;
343 std::unique_ptr<ash::WindowResizer> resizer_; 358 std::unique_ptr<ash::WindowResizer> resizer_;
344 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_; 359 std::unique_ptr<ScopedAnimationsDisabled> scoped_animations_disabled_;
345 int top_inset_height_ = 0; 360 int top_inset_height_ = 0;
346 int pending_top_inset_height_ = 0; 361 int pending_top_inset_height_ = 0;
347 bool shadow_underlay_in_surface_ = true; 362 bool shadow_underlay_in_surface_ = true;
348 363
349 DISALLOW_COPY_AND_ASSIGN(ShellSurface); 364 DISALLOW_COPY_AND_ASSIGN(ShellSurface);
350 }; 365 };
351 366
352 } // namespace exo 367 } // namespace exo
353 368
354 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ 369 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698