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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_wayland.h

Issue 2027943002: [WIP] Make content_shell run under Wayland Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (09.28.2016)Rebase on master Created 4 years, 2 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_WAYLAND_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_WAYLAND_H_
7
8 #include <list>
9 #include <set>
10 #include <string>
11 #include <vector>
12
13 #include "base/macros.h"
14 #include "ui/aura/window_tree_host.h"
15 #include "ui/platform_window/platform_window.h"
16 #include "ui/platform_window/platform_window_delegate.h"
17 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
18
19 namespace views {
20
21 namespace corewm {
22 class Tooltip;
23 }
24
25 class VIEWS_EXPORT DesktopWindowTreeHostWayland
26 : public DesktopWindowTreeHost,
27 public aura::WindowTreeHost,
28 public ui::PlatformWindowDelegate {
29 public:
30 DesktopWindowTreeHostWayland(
31 internal::NativeWidgetDelegate* native_widget_delegate,
32 DesktopNativeWidgetAura* desktop_native_widget_aura);
33 ~DesktopWindowTreeHostWayland() override;
34
35 // Deallocates the internal list of open windows.
36 static void CleanUpWindowList();
37
38 // Returns window bounds. This is used by Screen to determine if a point
39 // belongs to a particular window.
40 gfx::Rect GetBoundsInScreen() const;
41
42 protected:
43 // Overridden from DesktopWindowTreeHost:
44 void Init(aura::Window* content_window,
45 const views::Widget::InitParams& params) override;
46 void OnNativeWidgetCreated(const views::Widget::InitParams& params) override;
47 std::unique_ptr<corewm::Tooltip> CreateTooltip() override;
48 std::unique_ptr<aura::client::DragDropClient> CreateDragDropClient(
49 DesktopNativeCursorManager* cursor_manager) override;
50 void Close() override;
51 void CloseNow() override;
52 aura::WindowTreeHost* AsWindowTreeHost() override;
53 void ShowWindowWithState(ui::WindowShowState show_state) override;
54 void ShowMaximizedWithBounds(const gfx::Rect& restored_bounds) override;
55 bool IsVisible() const override;
56 void SetSize(const gfx::Size& size) override;
57 void StackAbove(aura::Window* window) override;
58 void StackAtTop() override;
59 void CenterWindow(const gfx::Size& size) override;
60 void GetWindowPlacement(gfx::Rect* bounds,
61 ui::WindowShowState* show_state) const override;
62 gfx::Rect GetWindowBoundsInScreen() const override;
63 gfx::Rect GetClientAreaBoundsInScreen() const override;
64 gfx::Rect GetRestoredBounds() const override;
65 std::string GetWorkspace() const override;
66 gfx::Rect GetWorkAreaBoundsInScreen() const override;
67 void SetShape(std::unique_ptr<SkRegion> native_region) override;
68 void Activate() override;
69 void Deactivate() override;
70 bool IsActive() const override;
71 void Maximize() override;
72 void Minimize() override;
73 void Restore() override;
74 bool IsMaximized() const override;
75 bool IsMinimized() const override;
76 bool HasCapture() const override;
77 void SetAlwaysOnTop(bool always_on_top) override;
78 bool IsAlwaysOnTop() const override;
79 void SetVisibleOnAllWorkspaces(bool always_visible) override;
80 bool IsVisibleOnAllWorkspaces() const override;
81 bool SetWindowTitle(const base::string16& title) override;
82 void ClearNativeFocus() override;
83 views::Widget::MoveLoopResult RunMoveLoop(
84 const gfx::Vector2d& drag_offset,
85 views::Widget::MoveLoopSource source,
86 views::Widget::MoveLoopEscapeBehavior escape_behavior) override;
87 void EndMoveLoop() override;
88 void SetVisibilityChangedAnimationsEnabled(bool value) override;
89 bool ShouldUseNativeFrame() const override;
90 bool ShouldWindowContentsBeTransparent() const override;
91 void FrameTypeChanged() override;
92 void SetFullscreen(bool fullscreen) override;
93 bool IsFullscreen() const override;
94 void SetOpacity(float opacity) override;
95 void SetWindowIcons(const gfx::ImageSkia& window_icon,
96 const gfx::ImageSkia& app_icon) override;
97 void InitModalType(ui::ModalType modal_type) override;
98 void FlashFrame(bool flash_frame) override;
99 void OnRootViewLayout() override;
100 void OnNativeWidgetFocus() override;
101 void OnNativeWidgetBlur() override;
102 bool IsAnimatingClosed() const override;
103 bool IsTranslucentWindowOpacitySupported() const override;
104 void SizeConstraintsChanged() override;
105
106 // Overridden from aura::WindowTreeHost:
107 gfx::Transform GetRootTransform() const override;
108 ui::EventSource* GetEventSource() override;
109 gfx::AcceleratedWidget GetAcceleratedWidget() override;
110 void ShowImpl() override;
111 void HideImpl() override;
112 gfx::Rect GetBounds() const override;
113 void SetBounds(const gfx::Rect& bounds) override;
114 gfx::Point GetLocationOnNativeScreen() const override;
115 void SetCapture() override;
116 void ReleaseCapture() override;
117 void SetCursorNative(gfx::NativeCursor cursor) override;
118 void MoveCursorToNative(const gfx::Point& location) override;
119 void OnCursorVisibilityChangedNative(bool show) override;
120
121 // Overridden from ui::PlatformWindowDelegate:
122 void OnBoundsChanged(const gfx::Rect&) override;
123 void OnDamageRect(const gfx::Rect& damaged_region) override;
124 void DispatchEvent(ui::Event* event) override;
125 void OnCloseRequest() override;
126 void OnClosed() override;
127 void OnWindowStateChanged(ui::PlatformWindowState new_state) override;
128 void OnLostCapture() override;
129 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget,
130 float device_pixel_ratio) override;
131 void OnAcceleratedWidgetDestroyed() override;
132 void OnActivationChanged(bool active) override;
133
134 private:
135 enum {
136 Uninitialized = 0x00,
137 Visible = 0x01, // Window is Visible.
138 FullScreen = 0x02, // Window is in fullscreen mode.
139 Maximized = 0x04, // Window is maximized,
140 Minimized = 0x08, // Window is minimized.
141 Active = 0x10 // Window is Active.
142 };
143
144 typedef unsigned RootWindowState;
145
146 void Relayout();
147 gfx::Size AdjustSize(const gfx::Size& requested_size);
148 void ShowWindow();
149
150 static std::list<gfx::AcceleratedWidget>& open_windows();
151 gfx::Rect ToDIPRect(const gfx::Rect& rect_in_pixels) const;
152 gfx::Rect ToPixelRect(const gfx::Rect& rect_in_dip) const;
153 void ResetWindowRegion();
154
155 RootWindowState state_;
156 bool has_capture_;
157 bool custom_window_shape_;
158 bool always_on_top_;
159
160 // Original bounds of DRWH.
161 gfx::Rect previous_bounds_;
162 gfx::Rect previous_maximize_bounds_;
163 gfx::AcceleratedWidget window_;
164 base::string16 title_;
165
166 // Owned by DesktopNativeWidgetAura.
167 views::internal::NativeWidgetDelegate* native_widget_delegate_;
168 aura::Window* content_window_;
169
170 views::DesktopNativeWidgetAura* desktop_native_widget_aura_;
171 // We can optionally have a parent which can order us to close, or own
172 // children who we're responsible for closing when we CloseNow().
173 DesktopWindowTreeHostWayland* window_parent_;
174 std::set<DesktopWindowTreeHostWayland*> window_children_;
175
176 // Platform-specific part of this DesktopWindowTreeHost.
177 std::unique_ptr<ui::PlatformWindow> platform_window_;
178 base::WeakPtrFactory<DesktopWindowTreeHostWayland> close_widget_factory_;
179
180 // A list of all (top-level) windows that have been created but not yet
181 // destroyed.
182 static std::list<gfx::AcceleratedWidget>* open_windows_;
183 // List of all open aura::Window.
184 static std::vector<aura::Window*>* aura_windows_;
185
186 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostWayland);
187 };
188
189 } // namespace views
190
191 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_WAYLAND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698