OLD | NEW |
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 <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/wm/window_state_observer.h" | 10 #include "ash/wm/window_state_observer.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 class ShellSurface : public SurfaceDelegate, | 32 class ShellSurface : public SurfaceDelegate, |
33 public SurfaceObserver, | 33 public SurfaceObserver, |
34 public views::WidgetDelegate, | 34 public views::WidgetDelegate, |
35 public views::View, | 35 public views::View, |
36 public ash::wm::WindowStateObserver, | 36 public ash::wm::WindowStateObserver, |
37 public aura::WindowObserver, | 37 public aura::WindowObserver, |
38 public aura::client::ActivationChangeObserver { | 38 public aura::client::ActivationChangeObserver { |
39 public: | 39 public: |
40 ShellSurface(Surface* surface, | 40 ShellSurface(Surface* surface, |
41 ShellSurface* parent, | 41 ShellSurface* parent, |
42 const gfx::Rect& initial_bounds); | 42 const gfx::Rect& initial_bounds, |
| 43 bool activatable); |
43 explicit ShellSurface(Surface* surface); | 44 explicit ShellSurface(Surface* surface); |
44 ~ShellSurface() override; | 45 ~ShellSurface() override; |
45 | 46 |
46 // Set the callback to run when the user wants the shell surface to be closed. | 47 // Set the callback to run when the user wants the shell surface to be closed. |
47 // The receiver can chose to not close the window on this signal. | 48 // The receiver can chose to not close the window on this signal. |
48 void set_close_callback(const base::Closure& close_callback) { | 49 void set_close_callback(const base::Closure& close_callback) { |
49 close_callback_ = close_callback; | 50 close_callback_ = close_callback; |
50 } | 51 } |
51 | 52 |
52 // Set the callback to run when the surface is destroyed. | 53 // Set the callback to run when the surface is destroyed. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 113 |
113 // Overridden from SurfaceDelegate: | 114 // Overridden from SurfaceDelegate: |
114 void OnSurfaceCommit() override; | 115 void OnSurfaceCommit() override; |
115 bool IsSurfaceSynchronized() const override; | 116 bool IsSurfaceSynchronized() const override; |
116 | 117 |
117 // Overridden from SurfaceObserver: | 118 // Overridden from SurfaceObserver: |
118 void OnSurfaceDestroying(Surface* surface) override; | 119 void OnSurfaceDestroying(Surface* surface) override; |
119 | 120 |
120 // Overridden from views::WidgetDelegate: | 121 // Overridden from views::WidgetDelegate: |
121 base::string16 GetWindowTitle() const override; | 122 base::string16 GetWindowTitle() const override; |
| 123 void WindowClosing() override; |
122 views::Widget* GetWidget() override; | 124 views::Widget* GetWidget() override; |
123 const views::Widget* GetWidget() const override; | 125 const views::Widget* GetWidget() const override; |
124 views::View* GetContentsView() override; | 126 views::View* GetContentsView() override; |
125 views::NonClientFrameView* CreateNonClientFrameView( | 127 views::NonClientFrameView* CreateNonClientFrameView( |
126 views::Widget* widget) override; | 128 views::Widget* widget) override; |
127 bool WidgetHasHitTestMask() const override; | 129 bool WidgetHasHitTestMask() const override; |
128 void GetWidgetHitTestMask(gfx::Path* mask) const override; | 130 void GetWidgetHitTestMask(gfx::Path* mask) const override; |
129 | 131 |
130 // Overridden from views::View: | 132 // Overridden from views::View: |
131 gfx::Size GetPreferredSize() const override; | 133 gfx::Size GetPreferredSize() const override; |
(...skipping 11 matching lines...) Expand all Loading... |
143 aura::Window* gained_active, | 145 aura::Window* gained_active, |
144 aura::Window* lost_active) override; | 146 aura::Window* lost_active) override; |
145 | 147 |
146 private: | 148 private: |
147 // Creates the |widget_| for |surface_|. | 149 // Creates the |widget_| for |surface_|. |
148 void CreateShellSurfaceWidget(); | 150 void CreateShellSurfaceWidget(); |
149 | 151 |
150 // Asks the client to configure its surface. | 152 // Asks the client to configure its surface. |
151 void Configure(); | 153 void Configure(); |
152 | 154 |
153 scoped_ptr<views::Widget> widget_; | 155 // Returns the "visible bounds" for the surface from the user's perspective. |
| 156 gfx::Rect GetVisibleBounds() const; |
| 157 |
| 158 views::Widget* widget_; |
154 Surface* surface_; | 159 Surface* surface_; |
155 aura::Window* parent_; | 160 aura::Window* parent_; |
156 const gfx::Rect initial_bounds_; | 161 const gfx::Rect initial_bounds_; |
| 162 const bool activatable_; |
157 base::string16 title_; | 163 base::string16 title_; |
158 std::string application_id_; | 164 std::string application_id_; |
159 gfx::Rect geometry_; | 165 gfx::Rect geometry_; |
160 base::Closure close_callback_; | 166 base::Closure close_callback_; |
161 base::Closure surface_destroyed_callback_; | 167 base::Closure surface_destroyed_callback_; |
162 ConfigureCallback configure_callback_; | 168 ConfigureCallback configure_callback_; |
163 | 169 |
164 DISALLOW_COPY_AND_ASSIGN(ShellSurface); | 170 DISALLOW_COPY_AND_ASSIGN(ShellSurface); |
165 }; | 171 }; |
166 | 172 |
167 } // namespace exo | 173 } // namespace exo |
168 | 174 |
169 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ | 175 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ |
OLD | NEW |