1 // Copyright (c) 2012 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 CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_
6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_
8 #include "base/android/jni_weak_ref.h"
9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/android/compositor_client.h"
13 #include "ui/gfx/native_widget_types.h"
22 class ContentViewRenderView
: public CompositorClient
{
24 // Registers the JNI methods for ContentViewRender.
25 static bool RegisterContentViewRenderView(JNIEnv
* env
);
27 ContentViewRenderView(JNIEnv
* env
,
29 gfx::NativeWindow root_window
);
31 // Methods called from Java via JNI -----------------------------------------
32 void Destroy(JNIEnv
* env
, jobject obj
);
33 void SetCurrentContentViewCore(JNIEnv
* env
, jobject obj
,
34 jlong native_content_view_core
);
35 void SurfaceCreated(JNIEnv
* env
, jobject obj
);
36 void SurfaceDestroyed(JNIEnv
* env
, jobject obj
);
37 void SurfaceChanged(JNIEnv
* env
, jobject obj
,
38 jint format
, jint width
, jint height
, jobject surface
);
39 void SetOverlayVideoMode(JNIEnv
* env
, jobject obj
, bool enabled
);
40 void SetNeedsComposite(JNIEnv
* env
, jobject obj
);
42 // TODO(yusufo): Remove this once the compositor code is
43 // refactored to use a unified system.
44 jlong
GetUIResourceProvider(JNIEnv
* env
, jobject obj
);
46 // CompositorClient implementation
47 void Layout() override
;
48 void OnSwapBuffersCompleted(int pending_swap_buffers
) override
;
51 ~ContentViewRenderView() override
;
53 void InitCompositor();
55 base::android::ScopedJavaGlobalRef
<jobject
> java_obj_
;
57 scoped_ptr
<content::Compositor
> compositor_
;
59 gfx::NativeWindow root_window_
;
60 int current_surface_format_
;
62 DISALLOW_COPY_AND_ASSIGN(ContentViewRenderView
);
69 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_