ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / android / compositor / scene_layer / scene_layer.h
bloba0cd8674739dbeb438ab8e4aa3b35faf4bc048f6
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.
5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_SCENE_LAYER_H_
6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_SCENE_LAYER_H_
8 #include <jni.h>
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"
16 namespace cc {
17 class Layer;
20 namespace chrome {
21 namespace android {
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);
30 // Create SceneLayer and creates an empty cc::Layer.
31 SceneLayer(JNIEnv* env, jobject jobj);
32 // Create SceneLayer with the already-instantiated |layer|.
34 SceneLayer(JNIEnv* env, jobject jobj, scoped_refptr<cc::Layer> layer);
35 virtual ~SceneLayer();
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();
41 // Java SceneLayer can use this method to destroy its native-side counterpart.
42 virtual void Destroy(JNIEnv* env, jobject jobj);
44 // Returns cc::Layer object that this SceneLayer contains.
45 scoped_refptr<cc::Layer> layer() { return layer_; }
47 // Returns whether we should show background when we draw this SceneLayer.
48 virtual bool ShouldShowBackground();
50 // Returns the background color if it is needed.
51 virtual SkColor GetBackgroundColor();
53 protected:
54 JavaObjectWeakGlobalRef weak_java_scene_layer_;
55 scoped_refptr<cc::Layer> layer_;
57 private:
58 DISALLOW_COPY_AND_ASSIGN(SceneLayer);
61 bool RegisterSceneLayer(JNIEnv* env);
63 } // namespace android
64 } // namespace chrome
66 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_SCENE_LAYER_H_