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 SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ | 5 #ifndef SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ |
6 #define SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ | 6 #define SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void SetEventDispatcher( | 52 void SetEventDispatcher( |
53 mojo::NativeViewportEventDispatcherPtr dispatcher) override; | 53 mojo::NativeViewportEventDispatcherPtr dispatcher) override; |
54 | 54 |
55 // PlatformViewport::Delegate implementation. | 55 // PlatformViewport::Delegate implementation. |
56 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) override; | 56 void OnMetricsChanged(mojo::ViewportMetricsPtr metrics) override; |
57 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override; | 57 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override; |
58 void OnAcceleratedWidgetDestroyed() override; | 58 void OnAcceleratedWidgetDestroyed() override; |
59 bool OnEvent(mojo::EventPtr event) override; | 59 bool OnEvent(mojo::EventPtr event) override; |
60 void OnDestroyed() override; | 60 void OnDestroyed() override; |
61 | 61 |
| 62 // Get a weak pointer to this object. |
| 63 base::WeakPtr<NativeViewportImpl> GetWeakPtr(); |
| 64 // Notify the associated PlatformViewport that a new native surface is |
| 65 // available. Returns true if the new surface has been attached to, false |
| 66 // otherwise. |
| 67 bool NewNativeSurfaceAvailable(); |
| 68 |
62 private: | 69 private: |
63 // Callback when the dispatcher has processed a message we're waiting on | 70 // Callback when the dispatcher has processed a message we're waiting on |
64 // an ack from. |pointer_id| identifies the pointer the message was associated | 71 // an ack from. |pointer_id| identifies the pointer the message was associated |
65 // with. | 72 // with. |
66 void AckEvent(int32 pointer_id); | 73 void AckEvent(int32 pointer_id); |
67 | 74 |
68 bool is_headless_; | 75 bool is_headless_; |
69 scoped_ptr<PlatformViewport> platform_viewport_; | 76 scoped_ptr<PlatformViewport> platform_viewport_; |
70 OnscreenContextProvider context_provider_; | 77 OnscreenContextProvider context_provider_; |
71 bool sent_metrics_; | 78 bool sent_metrics_; |
72 mojo::ViewportMetricsPtr metrics_; | 79 mojo::ViewportMetricsPtr metrics_; |
73 CreateCallback create_callback_; | 80 CreateCallback create_callback_; |
74 RequestMetricsCallback metrics_callback_; | 81 RequestMetricsCallback metrics_callback_; |
75 mojo::NativeViewportEventDispatcherPtr event_dispatcher_; | 82 mojo::NativeViewportEventDispatcherPtr event_dispatcher_; |
76 mojo::StrongBinding<mojo::NativeViewport> binding_; | 83 mojo::StrongBinding<mojo::NativeViewport> binding_; |
77 | 84 |
78 // Set of pointer_ids we've sent a move to and are waiting on an ack. | 85 // Set of pointer_ids we've sent a move to and are waiting on an ack. |
79 std::set<int32> pointers_waiting_on_ack_; | 86 std::set<int32> pointers_waiting_on_ack_; |
80 | 87 |
81 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; | 88 base::WeakPtrFactory<NativeViewportImpl> weak_factory_; |
82 | 89 |
83 DISALLOW_COPY_AND_ASSIGN(NativeViewportImpl); | 90 DISALLOW_COPY_AND_ASSIGN(NativeViewportImpl); |
84 }; | 91 }; |
85 | 92 |
86 } // namespace native_viewport | 93 } // namespace native_viewport |
87 | 94 |
88 #endif // SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ | 95 #endif // SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_IMPL_H_ |
OLD | NEW |