| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MUS_DISPLAY_MANAGER_H_ | 5 #ifndef COMPONENTS_MUS_DISPLAY_MANAGER_H_ | 
| 6 #define COMPONENTS_MUS_DISPLAY_MANAGER_H_ | 6 #define COMPONENTS_MUS_DISPLAY_MANAGER_H_ | 
| 7 | 7 | 
| 8 #include <map> | 8 #include <map> | 
| 9 | 9 | 
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 24 }  // namespace cc | 24 }  // namespace cc | 
| 25 | 25 | 
| 26 namespace gles2 { | 26 namespace gles2 { | 
| 27 class GpuState; | 27 class GpuState; | 
| 28 }  // namespace gles2 | 28 }  // namespace gles2 | 
| 29 | 29 | 
| 30 namespace mojo { | 30 namespace mojo { | 
| 31 class ApplicationImpl; | 31 class ApplicationImpl; | 
| 32 }  // namespace mojo | 32 }  // namespace mojo | 
| 33 | 33 | 
| 34 namespace surfaces { |  | 
| 35 class SurfacesScheduler; |  | 
| 36 class SurfacesState; |  | 
| 37 }  // namespace surfaces |  | 
| 38 |  | 
| 39 namespace ui { | 34 namespace ui { | 
| 40 class PlatformWindow; | 35 class PlatformWindow; | 
| 41 struct TextInputState; | 36 struct TextInputState; | 
| 42 }  // namespace ui | 37 }  // namespace ui | 
| 43 | 38 | 
| 44 namespace view_manager { | 39 namespace mus { | 
| 45 | 40 | 
| 46 class DisplayManagerFactory; | 41 class DisplayManagerFactory; | 
| 47 class EventDispatcher; | 42 class EventDispatcher; | 
| 48 class ServerView; | 43 class ServerView; | 
|  | 44 class SurfacesScheduler; | 
|  | 45 class SurfacesState; | 
| 49 | 46 | 
| 50 // DisplayManager is used to connect the root ServerView to a display. | 47 // DisplayManager is used to connect the root ServerView to a display. | 
| 51 class DisplayManager { | 48 class DisplayManager { | 
| 52  public: | 49  public: | 
| 53   virtual ~DisplayManager() {} | 50   virtual ~DisplayManager() {} | 
| 54 | 51 | 
| 55   static DisplayManager* Create( | 52   static DisplayManager* Create( | 
| 56       bool is_headless, | 53       bool is_headless, | 
| 57       mojo::ApplicationImpl* app_impl, | 54       mojo::ApplicationImpl* app_impl, | 
| 58       const scoped_refptr<gles2::GpuState>& gpu_state, | 55       const scoped_refptr<GpuState>& gpu_state, | 
| 59       const scoped_refptr<surfaces::SurfacesState>& surfaces_state); | 56       const scoped_refptr<SurfacesState>& surfaces_state); | 
| 60 | 57 | 
| 61   virtual void Init(DisplayManagerDelegate* delegate) = 0; | 58   virtual void Init(DisplayManagerDelegate* delegate) = 0; | 
| 62 | 59 | 
| 63   // Schedules a paint for the specified region in the coordinates of |view|. | 60   // Schedules a paint for the specified region in the coordinates of |view|. | 
| 64   virtual void SchedulePaint(const ServerView* view, | 61   virtual void SchedulePaint(const ServerView* view, | 
| 65                              const gfx::Rect& bounds) = 0; | 62                              const gfx::Rect& bounds) = 0; | 
| 66 | 63 | 
| 67   virtual void SetViewportSize(const gfx::Size& size) = 0; | 64   virtual void SetViewportSize(const gfx::Size& size) = 0; | 
| 68 | 65 | 
| 69   virtual void SetTitle(const base::string16& title) = 0; | 66   virtual void SetTitle(const base::string16& title) = 0; | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 82  private: | 79  private: | 
| 83   // Static factory instance (always NULL for non-test). | 80   // Static factory instance (always NULL for non-test). | 
| 84   static DisplayManagerFactory* factory_; | 81   static DisplayManagerFactory* factory_; | 
| 85 }; | 82 }; | 
| 86 | 83 | 
| 87 // DisplayManager implementation that connects to the services necessary to | 84 // DisplayManager implementation that connects to the services necessary to | 
| 88 // actually display. | 85 // actually display. | 
| 89 class DefaultDisplayManager : public DisplayManager, | 86 class DefaultDisplayManager : public DisplayManager, | 
| 90                               public ui::PlatformWindowDelegate { | 87                               public ui::PlatformWindowDelegate { | 
| 91  public: | 88  public: | 
| 92   DefaultDisplayManager( | 89   DefaultDisplayManager(bool is_headless, | 
| 93       bool is_headless, | 90                         mojo::ApplicationImpl* app_impl, | 
| 94       mojo::ApplicationImpl* app_impl, | 91                         const scoped_refptr<GpuState>& gpu_state, | 
| 95       const scoped_refptr<gles2::GpuState>& gpu_state, | 92                         const scoped_refptr<SurfacesState>& surfaces_state); | 
| 96       const scoped_refptr<surfaces::SurfacesState>& surfaces_state); |  | 
| 97   ~DefaultDisplayManager() override; | 93   ~DefaultDisplayManager() override; | 
| 98 | 94 | 
| 99   // DisplayManager: | 95   // DisplayManager: | 
| 100   void Init(DisplayManagerDelegate* delegate) override; | 96   void Init(DisplayManagerDelegate* delegate) override; | 
| 101   void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; | 97   void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; | 
| 102   void SetViewportSize(const gfx::Size& size) override; | 98   void SetViewportSize(const gfx::Size& size) override; | 
| 103   void SetTitle(const base::string16& title) override; | 99   void SetTitle(const base::string16& title) override; | 
| 104   const mojo::ViewportMetrics& GetViewportMetrics() override; | 100   const mojo::ViewportMetrics& GetViewportMetrics() override; | 
| 105   void UpdateTextInputState(const ui::TextInputState& state) override; | 101   void UpdateTextInputState(const ui::TextInputState& state) override; | 
| 106   void SetImeVisibility(bool visible) override; | 102   void SetImeVisibility(bool visible) override; | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 118   void OnCloseRequest() override; | 114   void OnCloseRequest() override; | 
| 119   void OnClosed() override; | 115   void OnClosed() override; | 
| 120   void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 116   void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 
| 121   void OnLostCapture() override; | 117   void OnLostCapture() override; | 
| 122   void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 118   void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 
| 123                                     float device_pixel_ratio) override; | 119                                     float device_pixel_ratio) override; | 
| 124   void OnActivationChanged(bool active) override; | 120   void OnActivationChanged(bool active) override; | 
| 125 | 121 | 
| 126   bool is_headless_; | 122   bool is_headless_; | 
| 127   mojo::ApplicationImpl* app_impl_; | 123   mojo::ApplicationImpl* app_impl_; | 
| 128   scoped_refptr<gles2::GpuState> gpu_state_; | 124   scoped_refptr<GpuState> gpu_state_; | 
| 129   scoped_refptr<surfaces::SurfacesState> surfaces_state_; | 125   scoped_refptr<SurfacesState> surfaces_state_; | 
| 130   DisplayManagerDelegate* delegate_; | 126   DisplayManagerDelegate* delegate_; | 
| 131 | 127 | 
| 132   mojo::ViewportMetrics metrics_; | 128   mojo::ViewportMetrics metrics_; | 
| 133   gfx::Rect dirty_rect_; | 129   gfx::Rect dirty_rect_; | 
| 134   base::Timer draw_timer_; | 130   base::Timer draw_timer_; | 
| 135   bool frame_pending_; | 131   bool frame_pending_; | 
| 136 | 132 | 
| 137   scoped_ptr<surfaces::TopLevelDisplayClient> top_level_display_client_; | 133   scoped_ptr<TopLevelDisplayClient> top_level_display_client_; | 
| 138   scoped_ptr<ui::PlatformWindow> platform_window_; | 134   scoped_ptr<ui::PlatformWindow> platform_window_; | 
| 139 | 135 | 
| 140   base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; | 136   base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; | 
| 141 | 137 | 
| 142   DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); | 138   DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); | 
| 143 }; | 139 }; | 
| 144 | 140 | 
| 145 }  // namespace view_manager | 141 }  // namespace mus | 
| 146 | 142 | 
| 147 #endif  // COMPONENTS_MUS_DISPLAY_MANAGER_H_ | 143 #endif  // COMPONENTS_MUS_DISPLAY_MANAGER_H_ | 
| OLD | NEW | 
|---|