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/gfx/size.h" | |
11 | |
12 namespace gpu { | |
13 class GLInProcessContext; | |
14 } | |
15 | 10 |
16 struct ANativeWindow; | 11 struct ANativeWindow; |
17 | 12 |
18 namespace mojo { | 13 namespace mojo { |
19 namespace services { | 14 namespace services { |
20 | 15 |
21 class NativeViewportAndroid : public NativeViewport { | 16 class NativeViewportAndroid : public NativeViewport { |
22 public: | 17 public: |
23 explicit NativeViewportAndroid(NativeViewportDelegate* delegate); | 18 explicit NativeViewportAndroid(NativeViewportDelegate* delegate); |
24 virtual ~NativeViewportAndroid(); | 19 virtual ~NativeViewportAndroid(); |
25 | 20 |
26 base::WeakPtr<NativeViewportAndroid> GetWeakPtr() { | 21 base::WeakPtr<NativeViewportAndroid> GetWeakPtr() { |
27 return weak_factory_.GetWeakPtr(); | 22 return weak_factory_.GetWeakPtr(); |
28 } | 23 } |
29 | 24 |
30 void OnNativeWindowCreated(ANativeWindow* window); | 25 void OnNativeWindowCreated(ANativeWindow* window); |
31 void OnNativeWindowDestroyed(); | 26 void OnNativeWindowDestroyed(); |
32 void OnResized(const gfx::Size& size); | 27 void OnResized(const gfx::Size& size); |
33 | 28 |
34 private: | 29 private: |
35 // Overridden from NativeViewport: | 30 // Overridden from NativeViewport: |
36 virtual void Close() OVERRIDE; | 31 virtual void Close() OVERRIDE; |
37 | 32 |
38 void OnGLContextLost(); | |
39 void ReleaseWindow(); | 33 void ReleaseWindow(); |
40 | 34 |
41 NativeViewportDelegate* delegate_; | |
42 ANativeWindow* window_; | |
43 gfx::Size size_; | |
44 scoped_ptr<gpu::GLInProcessContext> gl_context_; | |
45 | |
46 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; | 35 base::WeakPtrFactory<NativeViewportAndroid> weak_factory_; |
47 | 36 |
48 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); | 37 DISALLOW_COPY_AND_ASSIGN(NativeViewportAndroid); |
49 }; | 38 }; |
50 | 39 |
51 | 40 |
52 } // namespace services | 41 } // namespace services |
53 } // namespace mojo | 42 } // namespace mojo |
54 | 43 |
55 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ | 44 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_NATIVE_VIEWPORT_ANDROID_H_ |
OLD | NEW |