Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1718)

Unified Diff: android_webview/browser/browser_view_renderer.h

Issue 12041009: [Android WebView] Migrate the rendering code to a separate set of classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload error, re-uploading. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/DEPS ('k') | android_webview/browser/browser_view_renderer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/browser_view_renderer.h
diff --git a/android_webview/browser/browser_view_renderer.h b/android_webview/browser/browser_view_renderer.h
new file mode 100644
index 0000000000000000000000000000000000000000..02f47bcc714770b995ad702f0203e0c35763251f
--- /dev/null
+++ b/android_webview/browser/browser_view_renderer.h
@@ -0,0 +1,95 @@
+// Copyright (c) 2013 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 ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
+#define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
+
+#include "base/android/scoped_java_ref.h"
+
+struct AwDrawGLInfo;
+
+namespace content {
+class ContentViewCore;
+}
+
+namespace gfx {
+class Rect;
+}
+
+namespace android_webview {
+
+// Interface for all the WebView-specific content rendering operations.
+// Provides software and hardware rendering and the Capture Picture API.
+class BrowserViewRenderer {
+ public:
+ class Client {
+ public:
+ // Called to trigger view invalidations.
+ virtual void Invalidate() = 0;
+
+ // Called when a new Picture is available. Needs to be enabled
+ // via the EnableOnNewPicture method.
+ virtual void OnNewPicture(
+ const base::android::JavaRef<jobject>& picture) = 0;
+
+ protected:
+ virtual ~Client() {}
+ };
+
+ // Delegate to perform rendering actions involving Java objects.
+ class JavaHelper {
+ public:
+ // Creates a RGBA_8888 Java Bitmap object of the requested size.
+ virtual base::android::ScopedJavaLocalRef<jobject> CreateBitmap(
+ JNIEnv* env,
+ int width,
+ int height) = 0;
+
+ // Draws the provided Java Bitmap into the provided Java Canvas.
+ virtual void DrawBitmapIntoCanvas(
+ JNIEnv* env,
+ const base::android::JavaRef<jobject>& jbitmap,
+ const base::android::JavaRef<jobject>& jcanvas) = 0;
+
+ // Creates a Java Picture object that records drawing the provided Bitmap.
+ virtual base::android::ScopedJavaLocalRef<jobject> RecordBitmapIntoPicture(
+ JNIEnv* env,
+ const base::android::JavaRef<jobject>& jbitmap) = 0;
+
+ protected:
+ virtual ~JavaHelper() {}
+ };
+
+ enum OnNewPictureMode {
+ kOnNewPictureDisabled = 0,
+ kOnNewPictureEnabled,
+ kOnNewPictureInvalidationOnly,
+ };
+
+ // Content control methods.
+ virtual void SetContents(content::ContentViewCore* content_view_core) = 0;
+
+ // Hardware rendering methods.
+ virtual void DrawGL(AwDrawGLInfo* draw_info) = 0;
+ virtual void SetScrollForHWFrame(int x, int y) = 0;
+
+ // Software rendering methods.
+ virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip_bounds) = 0;
+
+ // CapturePicture API methods.
+ virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() = 0;
+ virtual void EnableOnNewPicture(OnNewPictureMode mode) = 0;
+
+ // View update notifications.
+ virtual void OnVisibilityChanged(bool view_visible, bool window_visible) = 0;
+ virtual void OnSizeChanged(int width, int height) = 0;
+ virtual void OnAttachedToWindow(int width, int height) = 0;
+ virtual void OnDetachedFromWindow() = 0;
+
+ virtual ~BrowserViewRenderer() {}
+};
+
+} // namespace android_webview
+
+#endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
« no previous file with comments | « android_webview/browser/DEPS ('k') | android_webview/browser/browser_view_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698