Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / android_webview / native / java_browser_view_renderer_helper.h
1 // Copyright (c) 2013 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 ANDROID_WEBVIEW_NATIVE_JAVA_BROWSER_VIEW_RENDERER_HELPER_H_
6 #define ANDROID_WEBVIEW_NATIVE_JAVA_BROWSER_VIEW_RENDERER_HELPER_H_
7
8 #include "android_webview/browser/browser_view_renderer.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "base/compiler_specific.h"
11
12 struct AwDrawSWFunctionTable;
13
14 namespace android_webview {
15
16 // Native side of java-class of same name.
17 // Provides utility methods for rendering involving with Java objects.
18 // TODO(boliu): Rename this class to JavaRasterHelper.
19 class JavaBrowserViewRendererHelper : public BrowserViewRendererJavaHelper {
20  public:
21   JavaBrowserViewRendererHelper();
22   virtual ~JavaBrowserViewRendererHelper();
23
24   static void SetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table);
25   static JavaBrowserViewRendererHelper* GetInstance();
26
27   // BrowserViewRendererJavaHelper implementation.
28   virtual bool RenderViaAuxilaryBitmapIfNeeded(
29       jobject java_canvas,
30       const gfx::Vector2d& scroll_correction,
31       const gfx::Size& auxiliary_bitmap_size,
32       RenderMethod render_source) override;
33
34  private:
35   bool RenderViaAuxilaryBitmap(JNIEnv* env,
36                                jobject java_canvas,
37                                const gfx::Vector2d& scroll_correction,
38                                const gfx::Size& auxiliary_bitmap_size,
39                                const RenderMethod& render_source);
40   bool RasterizeIntoBitmap(
41       JNIEnv* env,
42       const base::android::JavaRef<jobject>& jbitmap,
43       const JavaBrowserViewRendererHelper::RenderMethod& renderer);
44 };
45
46 bool RegisterJavaBrowserViewRendererHelper(JNIEnv* env);
47
48 }  // namespace android_webview
49
50 #endif  // ANDROID_WEBVIEW_NATIVE_JAVA_BROWSER_VIEW_RENDERER_HELPER_H_