12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef ANDROID_WEBVIEW_NATIVE_JAVA_BROWSER_VIEW_RENDERER_HELPER_H_
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define ANDROID_WEBVIEW_NATIVE_JAVA_BROWSER_VIEW_RENDERER_HELPER_H_
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "android_webview/browser/browser_view_renderer.h"
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/android/scoped_java_ref.h"
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/compiler_specific.h"
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace android_webview {
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Native side of java-class of same name.
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Provides utility methods for rendering involving with Java objects.
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// TODO(boliu): Rename this class to JavaRasterHelper.
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class JavaBrowserViewRendererHelper : public BrowserViewRendererJavaHelper {
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  JavaBrowserViewRendererHelper();
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual ~JavaBrowserViewRendererHelper();
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  static void SetAwDrawSWFunctionTable(AwDrawSWFunctionTable* table);
23ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  static JavaBrowserViewRendererHelper* GetInstance();
24ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch
25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // BrowserViewRendererJavaHelper implementation.
26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual bool RenderViaAuxilaryBitmapIfNeeded(
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      jobject java_canvas,
28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const gfx::Vector2d& scroll_correction,
295f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      const gfx::Size& auxiliary_bitmap_size,
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      RenderMethod render_source) OVERRIDE;
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) private:
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  bool RenderViaAuxilaryBitmap(JNIEnv* env,
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                               jobject java_canvas,
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                               const gfx::Vector2d& scroll_correction,
365f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                               const gfx::Size& auxiliary_bitmap_size,
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                               const RenderMethod& render_source);
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  bool RasterizeIntoBitmap(
392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      JNIEnv* env,
402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const base::android::JavaRef<jobject>& jbitmap,
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const JavaBrowserViewRendererHelper::RenderMethod& renderer);
422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool RegisterJavaBrowserViewRendererHelper(JNIEnv* env);
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace android_webview
472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif  // ANDROID_WEBVIEW_NATIVE_JAVA_BROWSER_VIEW_RENDERER_HELPER_H_
49