| 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_WS_DISPLAY_MANAGER_H_ | 5 #ifndef COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ |
| 6 #define COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ | 6 #define COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "components/mus/public/interfaces/view_tree.mojom.h" | 14 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 15 #include "components/mus/surfaces/top_level_display_client.h" | 15 #include "components/mus/surfaces/top_level_display_client.h" |
| 16 #include "components/mus/ws/display_manager_delegate.h" | 16 #include "components/mus/ws/display_manager_delegate.h" |
| 17 #include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h" | 17 #include "third_party/mojo/src/mojo/public/cpp/bindings/callback.h" |
| 18 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 19 #include "ui/platform_window/platform_window_delegate.h" | 19 #include "ui/platform_window/platform_window_delegate.h" |
| 20 | 20 |
| 21 namespace cc { | 21 namespace cc { |
| 22 class SurfaceIdAllocator; | 22 class SurfaceIdAllocator; |
| 23 class SurfaceManager; | 23 class SurfaceManager; |
| 24 } // namespace cc | 24 } // namespace cc |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 virtual void Init(DisplayManagerDelegate* delegate) = 0; | 57 virtual void Init(DisplayManagerDelegate* delegate) = 0; |
| 58 | 58 |
| 59 // Schedules a paint for the specified region in the coordinates of |view|. | 59 // Schedules a paint for the specified region in the coordinates of |view|. |
| 60 virtual void SchedulePaint(const ServerView* view, | 60 virtual void SchedulePaint(const ServerView* view, |
| 61 const gfx::Rect& bounds) = 0; | 61 const gfx::Rect& bounds) = 0; |
| 62 | 62 |
| 63 virtual void SetViewportSize(const gfx::Size& size) = 0; | 63 virtual void SetViewportSize(const gfx::Size& size) = 0; |
| 64 | 64 |
| 65 virtual void SetTitle(const base::string16& title) = 0; | 65 virtual void SetTitle(const base::string16& title) = 0; |
| 66 | 66 |
| 67 virtual const mojo::ViewportMetrics& GetViewportMetrics() = 0; | 67 virtual const mojom::ViewportMetrics& GetViewportMetrics() = 0; |
| 68 | 68 |
| 69 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0; | 69 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0; |
| 70 virtual void SetImeVisibility(bool visible) = 0; | 70 virtual void SetImeVisibility(bool visible) = 0; |
| 71 | 71 |
| 72 // Overrides factory for testing. Default (NULL) value indicates regular | 72 // Overrides factory for testing. Default (NULL) value indicates regular |
| 73 // (non-test) environment. | 73 // (non-test) environment. |
| 74 static void set_factory_for_testing(DisplayManagerFactory* factory) { | 74 static void set_factory_for_testing(DisplayManagerFactory* factory) { |
| 75 DisplayManager::factory_ = factory; | 75 DisplayManager::factory_ = factory; |
| 76 } | 76 } |
| 77 | 77 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 88 DefaultDisplayManager(mojo::ApplicationImpl* app_impl, | 88 DefaultDisplayManager(mojo::ApplicationImpl* app_impl, |
| 89 const scoped_refptr<GpuState>& gpu_state, | 89 const scoped_refptr<GpuState>& gpu_state, |
| 90 const scoped_refptr<SurfacesState>& surfaces_state); | 90 const scoped_refptr<SurfacesState>& surfaces_state); |
| 91 ~DefaultDisplayManager() override; | 91 ~DefaultDisplayManager() override; |
| 92 | 92 |
| 93 // DisplayManager: | 93 // DisplayManager: |
| 94 void Init(DisplayManagerDelegate* delegate) override; | 94 void Init(DisplayManagerDelegate* delegate) override; |
| 95 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; | 95 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds) override; |
| 96 void SetViewportSize(const gfx::Size& size) override; | 96 void SetViewportSize(const gfx::Size& size) override; |
| 97 void SetTitle(const base::string16& title) override; | 97 void SetTitle(const base::string16& title) override; |
| 98 const mojo::ViewportMetrics& GetViewportMetrics() override; | 98 const mojom::ViewportMetrics& GetViewportMetrics() override; |
| 99 void UpdateTextInputState(const ui::TextInputState& state) override; | 99 void UpdateTextInputState(const ui::TextInputState& state) override; |
| 100 void SetImeVisibility(bool visible) override; | 100 void SetImeVisibility(bool visible) override; |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 void WantToDraw(); | 103 void WantToDraw(); |
| 104 | 104 |
| 105 // This method initiates a top level redraw of the display. | 105 // This method initiates a top level redraw of the display. |
| 106 // TODO(fsamuel): This should use vblank as a signal rather than a timer | 106 // TODO(fsamuel): This should use vblank as a signal rather than a timer |
| 107 // http://crbug.com/533042 | 107 // http://crbug.com/533042 |
| 108 void Draw(); | 108 void Draw(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 124 void OnLostCapture() override; | 124 void OnLostCapture() override; |
| 125 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 125 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
| 126 float device_pixel_ratio) override; | 126 float device_pixel_ratio) override; |
| 127 void OnActivationChanged(bool active) override; | 127 void OnActivationChanged(bool active) override; |
| 128 | 128 |
| 129 mojo::ApplicationImpl* app_impl_; | 129 mojo::ApplicationImpl* app_impl_; |
| 130 scoped_refptr<GpuState> gpu_state_; | 130 scoped_refptr<GpuState> gpu_state_; |
| 131 scoped_refptr<SurfacesState> surfaces_state_; | 131 scoped_refptr<SurfacesState> surfaces_state_; |
| 132 DisplayManagerDelegate* delegate_; | 132 DisplayManagerDelegate* delegate_; |
| 133 | 133 |
| 134 mojo::ViewportMetrics metrics_; | 134 mojom::ViewportMetrics metrics_; |
| 135 gfx::Rect dirty_rect_; | 135 gfx::Rect dirty_rect_; |
| 136 base::Timer draw_timer_; | 136 base::Timer draw_timer_; |
| 137 bool frame_pending_; | 137 bool frame_pending_; |
| 138 | 138 |
| 139 scoped_ptr<TopLevelDisplayClient> top_level_display_client_; | 139 scoped_ptr<TopLevelDisplayClient> top_level_display_client_; |
| 140 scoped_ptr<ui::PlatformWindow> platform_window_; | 140 scoped_ptr<ui::PlatformWindow> platform_window_; |
| 141 | 141 |
| 142 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; | 142 base::WeakPtrFactory<DefaultDisplayManager> weak_factory_; |
| 143 | 143 |
| 144 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); | 144 DISALLOW_COPY_AND_ASSIGN(DefaultDisplayManager); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 } // namespace mus | 147 } // namespace mus |
| 148 | 148 |
| 149 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ | 149 #endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_ |
| OLD | NEW |