OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SKY_SHELL_SKY_VIEW_H_ | 5 #ifndef SKY_SHELL_PLATFORM_VIEW_H_ |
6 #define SKY_SHELL_SKY_VIEW_H_ | 6 #define SKY_SHELL_PLATFORM_VIEW_H_ |
7 | 7 |
8 #include "base/android/jni_weak_ref.h" | |
9 #include "base/android/scoped_java_ref.h" | |
10 #include "base/macros.h" | 8 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
12 #include "base/single_thread_task_runner.h" | |
13 #include "sky/shell/ui_delegate.h" | 10 #include "sky/shell/ui_delegate.h" |
14 | 11 |
15 struct ANativeWindow; | |
16 | |
17 namespace sky { | 12 namespace sky { |
18 namespace shell { | 13 namespace shell { |
19 | 14 |
20 class PlatformView { | 15 class PlatformView { |
21 public: | 16 public: |
22 struct Config { | 17 struct Config { |
23 base::WeakPtr<UIDelegate> ui_delegate; | 18 base::WeakPtr<UIDelegate> ui_delegate; |
24 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner; | 19 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner; |
25 }; | 20 }; |
26 | 21 |
27 static bool Register(JNIEnv* env); | |
28 | |
29 explicit PlatformView(const Config& config); | 22 explicit PlatformView(const Config& config); |
30 ~PlatformView(); | 23 virtual ~PlatformView(); |
31 | 24 |
32 void ConnectToViewportObserver( | 25 void ConnectToViewportObserver( |
33 mojo::InterfaceRequest<ViewportObserver> request); | 26 mojo::InterfaceRequest<ViewportObserver> request); |
34 | 27 |
35 // Called from Java | 28 protected: |
36 void Detach(JNIEnv* env, jobject obj); | 29 void SurfaceWasCreated(); |
37 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); | 30 void SurfaceWasDestroyed(); |
38 void SurfaceDestroyed(JNIEnv* env, jobject obj); | 31 |
39 void SurfaceSetSize(JNIEnv* env, | 32 Config config_; |
40 jobject obj, | 33 gfx::AcceleratedWidget window_; |
41 jint width, | |
42 jint height, | |
43 jfloat density); | |
44 | 34 |
45 private: | 35 private: |
46 void ReleaseWindow(); | |
47 | |
48 Config config_; | |
49 ANativeWindow* window_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(PlatformView); | 36 DISALLOW_COPY_AND_ASSIGN(PlatformView); |
52 }; | 37 }; |
53 | 38 |
54 } // namespace shell | 39 } // namespace shell |
55 } // namespace sky | 40 } // namespace sky |
56 | 41 |
57 #endif // SKY_SHELL_SKY_VIEW_H_ | 42 #endif // SKY_SHELL_PLATFORM_VIEW_H_ |
OLD | NEW |