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

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

Issue 2645663004: exo: Initial support for multiple displays in ARC (Closed)
Patch Set: Address nits Created 3 years, 9 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
« no previous file with comments | « components/exo/display_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 <cstdint>
8 #include <deque> 9 #include <deque>
9 #include <memory> 10 #include <memory>
10 #include <string> 11 #include <string>
11 12
12 #include "ash/common/wm/window_state_observer.h" 13 #include "ash/common/wm/window_state_observer.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "components/exo/surface_delegate.h" 16 #include "components/exo/surface_delegate.h"
16 #include "components/exo/surface_observer.h" 17 #include "components/exo/surface_observer.h"
17 #include "components/exo/wm_helper.h" 18 #include "components/exo/wm_helper.h"
(...skipping 20 matching lines...) Expand all
38 // This class provides functions for treating a surfaces like toplevel, 39 // This class provides functions for treating a surfaces like toplevel,
39 // fullscreen or popup widgets, move, resize or maximize them, associate 40 // fullscreen or popup widgets, move, resize or maximize them, associate
40 // metadata like title and class, etc. 41 // metadata like title and class, etc.
41 class ShellSurface : public SurfaceDelegate, 42 class ShellSurface : public SurfaceDelegate,
42 public SurfaceObserver, 43 public SurfaceObserver,
43 public views::WidgetDelegate, 44 public views::WidgetDelegate,
44 public views::View, 45 public views::View,
45 public ash::wm::WindowStateObserver, 46 public ash::wm::WindowStateObserver,
46 public aura::WindowObserver, 47 public aura::WindowObserver,
47 public WMHelper::ActivationObserver, 48 public WMHelper::ActivationObserver,
48 public WMHelper::AccessibilityObserver { 49 public WMHelper::AccessibilityObserver,
50 public WMHelper::DisplayConfigurationObserver {
49 public: 51 public:
50 enum class BoundsMode { SHELL, CLIENT, FIXED }; 52 enum class BoundsMode { SHELL, CLIENT, FIXED };
51 53
52 // The |origin| is in screen coordinates. When bounds are controlled by the 54 // 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. 55 // 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 56 // In that case, the position specified as part of the geometry is relative
55 // to the shell surface. 57 // to the shell surface.
56 // 58 //
57 // When bounds are controlled by the client, it represents the origin of a 59 // 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 60 // coordinate system to which the position of the shell surface, specified
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 93
92 // Set the callback to run when the client is asked to configure the surface. 94 // Set the callback to run when the client is asked to configure the surface.
93 // The size is a hint, in the sense that the client is free to ignore it if 95 // The size is a hint, in the sense that the client is free to ignore it if
94 // it doesn't resize, pick a smaller size (to satisfy aspect ratio or resize 96 // it doesn't resize, pick a smaller size (to satisfy aspect ratio or resize
95 // in steps of NxM pixels). 97 // in steps of NxM pixels).
96 using ConfigureCallback = 98 using ConfigureCallback =
97 base::Callback<uint32_t(const gfx::Size& size, 99 base::Callback<uint32_t(const gfx::Size& size,
98 ash::wm::WindowStateType state_type, 100 ash::wm::WindowStateType state_type,
99 bool resizing, 101 bool resizing,
100 bool activated, 102 bool activated,
101 const gfx::Point& origin)>; 103 const gfx::Vector2d& origin_offset)>;
102 void set_configure_callback(const ConfigureCallback& configure_callback) { 104 void set_configure_callback(const ConfigureCallback& configure_callback) {
103 configure_callback_ = configure_callback; 105 configure_callback_ = configure_callback;
104 } 106 }
105 107
106 // When the client is asked to configure the surface, it should acknowledge 108 // When the client is asked to configure the surface, it should acknowledge
107 // the configure request sometime before the commit. |serial| is the serial 109 // the configure request sometime before the commit. |serial| is the serial
108 // from the configure callback. 110 // from the configure callback.
109 void AcknowledgeConfigure(uint32_t serial); 111 void AcknowledgeConfigure(uint32_t serial);
110 112
111 // Set the "parent" of this surface. This window should be stacked above a 113 // Set the "parent" of this surface. This window should be stacked above a
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 void OnWindowDestroying(aura::Window* window) override; 245 void OnWindowDestroying(aura::Window* window) override;
244 246
245 // Overridden from WMHelper::ActivationObserver: 247 // Overridden from WMHelper::ActivationObserver:
246 void OnWindowActivated( 248 void OnWindowActivated(
247 aura::Window* gained_active, 249 aura::Window* gained_active,
248 aura::Window* lost_active) override; 250 aura::Window* lost_active) override;
249 251
250 // Overridden from WMHelper::AccessibilityObserver: 252 // Overridden from WMHelper::AccessibilityObserver:
251 void OnAccessibilityModeChanged() override; 253 void OnAccessibilityModeChanged() override;
252 254
255 // Overridden from WMHelper::DisplayConfigurationObserver:
256 void OnDisplayConfigurationChanged() override;
257
253 // Overridden from ui::EventHandler: 258 // Overridden from ui::EventHandler:
254 void OnKeyEvent(ui::KeyEvent* event) override; 259 void OnKeyEvent(ui::KeyEvent* event) override;
255 void OnMouseEvent(ui::MouseEvent* event) override; 260 void OnMouseEvent(ui::MouseEvent* event) override;
256 261
257 // Overridden from ui::AcceleratorTarget: 262 // Overridden from ui::AcceleratorTarget:
258 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; 263 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
259 264
260 aura::Window* shadow_overlay() { return shadow_overlay_; } 265 aura::Window* shadow_overlay() { return shadow_overlay_; }
261 aura::Window* shadow_underlay() { return shadow_underlay_; } 266 aura::Window* shadow_underlay() { return shadow_underlay_; }
262 267
(...skipping 10 matching lines...) Expand all
273 int resize_component; 278 int resize_component;
274 }; 279 };
275 280
276 // Creates the |widget_| for |surface_|. |show_state| is the initial state 281 // Creates the |widget_| for |surface_|. |show_state| is the initial state
277 // of the widget (e.g. maximized). 282 // of the widget (e.g. maximized).
278 void CreateShellSurfaceWidget(ui::WindowShowState show_state); 283 void CreateShellSurfaceWidget(ui::WindowShowState show_state);
279 284
280 // Asks the client to configure its surface. 285 // Asks the client to configure its surface.
281 void Configure(); 286 void Configure();
282 287
288 // Returns the window that has capture during dragging.
289 aura::Window* GetDragWindow() const;
290
283 // Attempt to start a drag operation. The type of drag operation to start is 291 // Attempt to start a drag operation. The type of drag operation to start is
284 // determined by |component|. 292 // determined by |component|.
285 void AttemptToStartDrag(int component); 293 void AttemptToStartDrag(int component);
286 294
287 // End current drag operation. 295 // End current drag operation.
288 void EndDrag(bool revert); 296 void EndDrag(bool revert);
289 297
290 // Returns true if surface is currently being resized. 298 // Returns true if surface is currently being resized.
291 bool IsResizing() const; 299 bool IsResizing() const;
292 300
(...skipping 10 matching lines...) Expand all
303 // Updates the bounds of surface to match the current widget bounds. 311 // Updates the bounds of surface to match the current widget bounds.
304 void UpdateSurfaceBounds(); 312 void UpdateSurfaceBounds();
305 313
306 // Creates, deletes and update the shadow bounds based on 314 // Creates, deletes and update the shadow bounds based on
307 // |pending_shadow_content_bounds_|. 315 // |pending_shadow_content_bounds_|.
308 void UpdateShadow(); 316 void UpdateShadow();
309 317
310 // Applies |system_modal_| to |widget_|. 318 // Applies |system_modal_| to |widget_|.
311 void UpdateSystemModal(); 319 void UpdateSystemModal();
312 320
321 // In the coordinate system of the parent root window.
322 gfx::Point GetMouseLocation() const;
323
313 views::Widget* widget_ = nullptr; 324 views::Widget* widget_ = nullptr;
314 Surface* surface_; 325 Surface* surface_;
315 aura::Window* parent_; 326 aura::Window* parent_;
316 const BoundsMode bounds_mode_; 327 const BoundsMode bounds_mode_;
328 int64_t primary_display_id_;
317 gfx::Point origin_; 329 gfx::Point origin_;
318 bool activatable_ = true; 330 bool activatable_ = true;
319 const bool can_minimize_; 331 const bool can_minimize_;
320 // Container Window Id (see ash/public/cpp/shell_window_ids.h) 332 // Container Window Id (see ash/public/cpp/shell_window_ids.h)
321 int container_; 333 int container_;
322 bool frame_enabled_ = false; 334 bool frame_enabled_ = false;
323 bool shadow_enabled_ = false; 335 bool shadow_enabled_ = false;
324 bool pending_show_widget_ = false; 336 bool pending_show_widget_ = false;
325 base::string16 title_; 337 base::string16 title_;
326 std::string application_id_; 338 std::string application_id_;
(...skipping 24 matching lines...) Expand all
351 int pending_top_inset_height_ = 0; 363 int pending_top_inset_height_ = 0;
352 bool shadow_underlay_in_surface_ = true; 364 bool shadow_underlay_in_surface_ = true;
353 bool system_modal_ = false; 365 bool system_modal_ = false;
354 366
355 DISALLOW_COPY_AND_ASSIGN(ShellSurface); 367 DISALLOW_COPY_AND_ASSIGN(ShellSurface);
356 }; 368 };
357 369
358 } // namespace exo 370 } // namespace exo
359 371
360 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ 372 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_
OLDNEW
« no previous file with comments | « components/exo/display_unittest.cc ('k') | components/exo/shell_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698