OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_SCENE_LAYER_H_ | |
6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_SCENE_LAYER_H_ | |
7 | |
8 #include <jni.h> | |
9 | |
10 #include "base/android/jni_weak_ref.h" | |
11 #include "base/android/scoped_java_ref.h" | |
12 #include "base/basictypes.h" | |
13 #include "base/memory/ref_counted.h" | |
14 #include "third_party/skia/include/core/SkColor.h" | |
15 | |
16 namespace cc { | |
17 class Layer; | |
18 } | |
19 | |
20 namespace chrome { | |
21 namespace android { | |
22 | |
23 // A native-side, cc::Layer based representation of how a scene should be drawn. | |
24 // Basically, this is a wrapper around cc::Layer and bridge with its Java | |
25 // counterpart. | |
26 class SceneLayer { | |
27 public: | |
28 static SceneLayer* FromJavaObject(JNIEnv* env, jobject jobj); | |
29 | |
30 // Create SceneLayer and creates an empty cc::Layer. | |
31 SceneLayer(JNIEnv* env, jobject jobj); | |
32 // Create SceneLayer with the already-instantiated |layer|. | |
33 | |
34 SceneLayer(JNIEnv* env, jobject jobj, scoped_refptr<cc::Layer> layer); | |
35 virtual ~SceneLayer(); | |
36 | |
37 // Notifies that this scene layer is about to be detached from its parent. | |
38 virtual void OnDetach(); | |
David Trainor- moved to gerrit
2015/01/13 18:57:19
Maybe add a TODO to investigate if we still need t
Changwan Ryu
2015/01/14 00:55:26
Done.
| |
39 | |
40 // Java SceneLayer can use this method to destroy its native-side counterpart. | |
41 virtual void Destroy(JNIEnv* env, jobject jobj); | |
42 | |
43 // Returns cc::Layer object that this SceneLayer contains. | |
44 scoped_refptr<cc::Layer> layer() { return layer_; } | |
45 | |
46 // Returns whether we should show background when we draw this SceneLayer. | |
47 virtual bool ShouldShowBackground(); | |
48 | |
49 // Returns the background color if it is needed. | |
50 virtual SkColor GetBackgroundColor(); | |
51 | |
52 protected: | |
53 JavaObjectWeakGlobalRef weak_java_scene_layer_; | |
54 scoped_refptr<cc::Layer> layer_; | |
55 | |
56 private: | |
57 DISALLOW_COPY_AND_ASSIGN(SceneLayer); | |
58 }; | |
59 | |
60 bool RegisterSceneLayer(JNIEnv* env); | |
61 | |
62 } // namespace android | |
63 } // namespace chrome | |
64 | |
65 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_SCENE_LAYER_H_ | |
OLD | NEW |