Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/android/compositor/scene_layer/scene_layer.h

Issue 852433002: [Android] Upstream scene layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // TODO(changwan): check if we can remove this.
39 virtual void OnDetach();
40
41 // Java SceneLayer can use this method to destroy its native-side counterpart.
42 virtual void Destroy(JNIEnv* env, jobject jobj);
43
44 // Returns cc::Layer object that this SceneLayer contains.
45 scoped_refptr<cc::Layer> layer() { return layer_; }
46
47 // Returns whether we should show background when we draw this SceneLayer.
48 virtual bool ShouldShowBackground();
49
50 // Returns the background color if it is needed.
51 virtual SkColor GetBackgroundColor();
52
53 protected:
54 JavaObjectWeakGlobalRef weak_java_scene_layer_;
55 scoped_refptr<cc::Layer> layer_;
56
57 private:
58 DISALLOW_COPY_AND_ASSIGN(SceneLayer);
59 };
60
61 bool RegisterSceneLayer(JNIEnv* env);
62
63 } // namespace android
64 } // namespace chrome
65
66 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_SCENE_LAYER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/browser/android/compositor/scene_layer/scene_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698