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 MOJO_SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ |
6 #define MOJO_SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 class ServerView; | 33 class ServerView; |
34 | 34 |
35 // DisplayManager binds the root node to an actual display. | 35 // DisplayManager binds the root node to an actual display. |
36 class MOJO_VIEW_MANAGER_EXPORT DisplayManager | 36 class MOJO_VIEW_MANAGER_EXPORT DisplayManager |
37 : NON_EXPORTED_BASE(public NativeViewportClient), | 37 : NON_EXPORTED_BASE(public NativeViewportClient), |
38 NON_EXPORTED_BASE(public SurfaceClient) { | 38 NON_EXPORTED_BASE(public SurfaceClient) { |
39 public: | 39 public: |
40 DisplayManager(ApplicationConnection* app_connection, | 40 DisplayManager(ApplicationConnection* app_connection, |
41 ConnectionManager* connection_manager, | 41 ConnectionManager* connection_manager, |
42 const Callback<void()>& native_viewport_closed_callback); | 42 const Callback<void()>& native_viewport_closed_callback); |
43 virtual ~DisplayManager(); | 43 ~DisplayManager() override; |
44 | 44 |
45 // Schedules a paint for the specified region of the specified view. | 45 // Schedules a paint for the specified region of the specified view. |
46 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds); | 46 void SchedulePaint(const ServerView* view, const gfx::Rect& bounds); |
47 | 47 |
48 // See description above field for details. | 48 // See description above field for details. |
49 bool in_setup() const { return in_setup_; } | 49 bool in_setup() const { return in_setup_; } |
50 | 50 |
51 private: | 51 private: |
52 void OnCreatedNativeViewport(uint64_t native_viewport_id); | 52 void OnCreatedNativeViewport(uint64_t native_viewport_id); |
53 void OnSurfaceConnectionCreated(SurfacePtr surface, uint32_t id_namespace); | 53 void OnSurfaceConnectionCreated(SurfacePtr surface, uint32_t id_namespace); |
54 void Draw(); | 54 void Draw(); |
55 | 55 |
56 // NativeViewportClient implementation. | 56 // NativeViewportClient implementation. |
57 virtual void OnDestroyed() override; | 57 void OnDestroyed() override; |
58 virtual void OnSizeChanged(SizePtr size) override; | 58 void OnSizeChanged(SizePtr size) override; |
59 virtual void OnEvent(EventPtr event, | 59 void OnEvent(EventPtr event, const mojo::Callback<void()>& callback) override; |
60 const mojo::Callback<void()>& callback) override; | |
61 | 60 |
62 // SurfaceClient implementation. | 61 // SurfaceClient implementation. |
63 virtual void ReturnResources(Array<ReturnedResourcePtr> resources) override; | 62 void ReturnResources(Array<ReturnedResourcePtr> resources) override; |
64 | 63 |
65 ConnectionManager* connection_manager_; | 64 ConnectionManager* connection_manager_; |
66 | 65 |
67 // Returns true if adding the root view's window to |window_tree_host_|. | 66 // Returns true if adding the root view's window to |window_tree_host_|. |
68 bool in_setup_; | 67 bool in_setup_; |
69 | 68 |
70 gfx::Size size_; | 69 gfx::Size size_; |
71 gfx::Rect dirty_rect_; | 70 gfx::Rect dirty_rect_; |
72 base::Timer draw_timer_; | 71 base::Timer draw_timer_; |
73 | 72 |
74 SurfacesServicePtr surfaces_service_; | 73 SurfacesServicePtr surfaces_service_; |
75 SurfacePtr surface_; | 74 SurfacePtr surface_; |
76 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 75 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
77 cc::SurfaceId surface_id_; | 76 cc::SurfaceId surface_id_; |
78 NativeViewportPtr native_viewport_; | 77 NativeViewportPtr native_viewport_; |
79 Callback<void()> native_viewport_closed_callback_; | 78 Callback<void()> native_viewport_closed_callback_; |
80 base::WeakPtrFactory<DisplayManager> weak_factory_; | 79 base::WeakPtrFactory<DisplayManager> weak_factory_; |
81 | 80 |
82 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 81 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
83 }; | 82 }; |
84 | 83 |
85 } // namespace service | 84 } // namespace service |
86 } // namespace mojo | 85 } // namespace mojo |
87 | 86 |
88 #endif // MOJO_SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ | 87 #endif // MOJO_SERVICES_VIEW_MANAGER_DISPLAY_MANAGER_H_ |
OLD | NEW |