| 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 "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "components/exo/surface_delegate.h" | 13 #include "components/exo/surface_delegate.h" |
| 14 #include "components/exo/surface_observer.h" |
| 14 #include "ui/views/widget/widget_delegate.h" | 15 #include "ui/views/widget/widget_delegate.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 namespace trace_event { | 18 namespace trace_event { |
| 18 class TracedValue; | 19 class TracedValue; |
| 19 } | 20 } |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace exo { | 23 namespace exo { |
| 23 class Surface; | 24 class Surface; |
| 24 | 25 |
| 25 // This class provides functions for treating a surfaces like toplevel, | 26 // This class provides functions for treating a surfaces like toplevel, |
| 26 // fullscreen or popup widgets, move, resize or maximize them, associate | 27 // fullscreen or popup widgets, move, resize or maximize them, associate |
| 27 // metadata like title and class, etc. | 28 // metadata like title and class, etc. |
| 28 class ShellSurface : public SurfaceDelegate, public views::WidgetDelegate { | 29 class ShellSurface : public SurfaceDelegate, |
| 30 public SurfaceObserver, |
| 31 public views::WidgetDelegate { |
| 29 public: | 32 public: |
| 30 explicit ShellSurface(Surface* surface); | 33 explicit ShellSurface(Surface* surface); |
| 31 ~ShellSurface() override; | 34 ~ShellSurface() override; |
| 32 | 35 |
| 33 // Show surface at the time of the next commit. | 36 // Show surface at the time of the next commit. |
| 34 void Show(); | 37 void Show(); |
| 35 | 38 |
| 36 // Show surface as a toplevel window with decorations. | 39 // Show surface as a toplevel window with decorations. |
| 37 void SetToplevel(); | 40 void SetToplevel(); |
| 38 | 41 |
| 39 // Make the surface fullscreen. | 42 // Make the surface fullscreen. |
| 40 void SetFullscreen(bool fullscreen); | 43 void SetFullscreen(bool fullscreen); |
| 41 | 44 |
| 42 // Set title for surface. | 45 // Set title for surface. |
| 43 void SetTitle(const base::string16& title); | 46 void SetTitle(const base::string16& title); |
| 44 | 47 |
| 45 // Returns a trace value representing the state of the surface. | 48 // Returns a trace value representing the state of the surface. |
| 46 scoped_refptr<base::trace_event::TracedValue> AsTracedValue() const; | 49 scoped_refptr<base::trace_event::TracedValue> AsTracedValue() const; |
| 47 | 50 |
| 48 // Overridden from SurfaceDelegate: | 51 // Overridden from SurfaceDelegate: |
| 49 void OnSurfaceDestroying() override; | |
| 50 void OnSurfaceCommit() override; | 52 void OnSurfaceCommit() override; |
| 53 bool IsSurfaceSynchronized() const override; |
| 54 |
| 55 // Overridden from SurfaceObserver: |
| 56 void OnSurfaceDestroying(Surface* surface) override; |
| 51 | 57 |
| 52 // Overridden from views::WidgetDelegate: | 58 // Overridden from views::WidgetDelegate: |
| 53 base::string16 GetWindowTitle() const override; | 59 base::string16 GetWindowTitle() const override; |
| 54 views::Widget* GetWidget() override; | 60 views::Widget* GetWidget() override; |
| 55 const views::Widget* GetWidget() const override; | 61 const views::Widget* GetWidget() const override; |
| 56 views::View* GetContentsView() override; | 62 views::View* GetContentsView() override; |
| 57 views::NonClientFrameView* CreateNonClientFrameView( | 63 views::NonClientFrameView* CreateNonClientFrameView( |
| 58 views::Widget* widget) override; | 64 views::Widget* widget) override; |
| 59 | 65 |
| 60 private: | 66 private: |
| 61 scoped_ptr<views::Widget> widget_; | 67 scoped_ptr<views::Widget> widget_; |
| 62 Surface* surface_; | 68 Surface* surface_; |
| 63 ui::WindowShowState show_state_; | 69 ui::WindowShowState show_state_; |
| 64 base::string16 title_; | 70 base::string16 title_; |
| 65 | 71 |
| 66 DISALLOW_COPY_AND_ASSIGN(ShellSurface); | 72 DISALLOW_COPY_AND_ASSIGN(ShellSurface); |
| 67 }; | 73 }; |
| 68 | 74 |
| 69 } // namespace exo | 75 } // namespace exo |
| 70 | 76 |
| 71 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ | 77 #endif // COMPONENTS_EXO_SHELL_SURFACE_H_ |
| OLD | NEW |