summaryrefslogtreecommitdiffstats
path: root/content/browser/android/content_view_render_view.h
blob: 65c3874a66fc8e5f3bc03c9572dbc224f0195fba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_
#define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_

#include "base/android/jni_helper.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/android/compositor_client.h"

namespace content {
class Compositor;

class ContentViewRenderView : public CompositorClient {
 public:
  // Registers the JNI methods for ContentViewRender.
  static bool RegisterContentViewRenderView(JNIEnv* env);

  ContentViewRenderView(JNIEnv* env, jobject obj);

  // Methods called from Java via JNI -----------------------------------------
  void Destroy(JNIEnv* env, jobject obj);
  void SetCurrentContentView(JNIEnv* env, jobject obj, int native_content_view);
  void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface);
  void SurfaceDestroyed(JNIEnv* env, jobject obj);
  void SurfaceSetSize(JNIEnv* env, jobject obj, jint width, jint height);
  jboolean Composite(JNIEnv* env, jobject obj);
  jboolean CompositeToBitmap(JNIEnv* env, jobject obj, jobject java_bitmap);

  // CompositorClient ---------------------------------------------------------
  virtual void ScheduleComposite() OVERRIDE;
  virtual void OnSwapBuffersPosted() OVERRIDE;
  virtual void OnSwapBuffersCompleted() OVERRIDE;

 private:
  virtual ~ContentViewRenderView();

  void InitCompositor();

  bool buffers_swapped_during_composite_;

  base::android::ScopedJavaGlobalRef<jobject> java_obj_;

  scoped_ptr<content::Compositor> compositor_;

  DISALLOW_COPY_AND_ASSIGN(ContentViewRenderView);
};



}

#endif  // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_