| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 5 #ifndef MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
| 6 #define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 6 #define MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "mojo/services/native_viewport/native_viewport.h" | 9 #include "mojo/services/native_viewport/native_viewport.h" |
| 10 #include "ui/events/event_constants.h" | 10 #include "ui/events/event_constants.h" |
| 11 #include "ui/gfx/sequential_id_generator.h" | 11 #include "ui/gfx/sequential_id_generator.h" |
| 12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
| 13 | 13 |
| 14 namespace gpu { | 14 namespace gpu { |
| 15 class GLInProcessContext; | 15 class GLInProcessContext; |
| 16 } | 16 } |
| 17 | 17 |
| 18 struct ANativeWindow; | 18 struct ANativeWindow; |
| 19 | 19 |
| 20 namespace mojo { | 20 namespace mojo { |
| 21 namespace services { | 21 namespace services { |
| 22 | 22 |
| 23 class NativeViewportAndroid : public NativeViewport { | 23 class NativeViewportAndroid : public NativeViewport { |
| 24 public: | 24 public: |
| 25 explicit NativeViewportAndroid(NativeViewportDelegate* delegate); | 25 explicit NativeViewportAndroid(shell::Context* context, |
| 26 NativeViewportDelegate* delegate); |
| 26 virtual ~NativeViewportAndroid(); | 27 virtual ~NativeViewportAndroid(); |
| 27 | 28 |
| 28 base::WeakPtr<NativeViewportAndroid> GetWeakPtr() { | 29 base::WeakPtr<NativeViewportAndroid> GetWeakPtr() { |
| 29 return weak_factory_.GetWeakPtr(); | 30 return weak_factory_.GetWeakPtr(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 void OnNativeWindowCreated(ANativeWindow* window); | 33 void OnNativeWindowCreated(ANativeWindow* window); |
| 33 void OnNativeWindowDestroyed(); | 34 void OnNativeWindowDestroyed(); |
| 34 void OnResized(const gfx::Size& size); | 35 void OnResized(const gfx::Size& size); |
| 35 void OnTouchEvent(int pointer_id, ui::EventType action, float x, float y, | 36 void OnTouchEvent(int pointer_id, ui::EventType action, float x, float y, |
| 36 int64 time_ms); | 37 int64 time_ms); |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 // Overridden from NativeViewport: | 40 // Overridden from NativeViewport: |
| 40 virtual gfx::Size GetSize() OVERRIDE; | 41 virtual gfx::Size GetSize() OVERRIDE; |
| 42 virtual void Init() OVERRIDE; |
| 41 virtual void Close() OVERRIDE; | 43 virtual void Close() OVERRIDE; |
| 42 | 44 |
| 43 void ReleaseWindow(); | 45 void ReleaseWindow(); |
| 44 | 46 |
| 45 NativeViewportDelegate* delegate_; | 47 NativeViewportDelegate* delegate_; |
| 48 shell::Context* context_; |
| 46 ANativeWindow* window_; | 49 ANativeWindow* window_; |
| 47 gfx::Size size_; | 50 gfx::Size size_; |
| 48 ui::SequentialIDGenerator id_generator_; | 51 ui::SequentialIDGenerator id_generator_; |
| 49 | 52 |
| 50 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; | 53 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; |
| 51 | 54 |
| 52 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); | 55 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); |
| 53 }; | 56 }; |
| 54 | 57 |
| 55 | 58 |
| 56 } // namespace services | 59 } // namespace services |
| 57 } // namespace mojo | 60 } // namespace mojo |
| 58 | 61 |
| 59 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 62 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
| OLD | NEW |