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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/browser/DEPS ('k') | android_webview/browser/browser_view_renderer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_BROWSER_BROWSER_VIEW_RENDERER_H_
6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
7
8 #include "base/android/scoped_java_ref.h"
9
10 struct AwDrawGLInfo;
11
12 namespace content {
13 class ContentViewCore;
14 }
15
16 namespace gfx {
17 class Rect;
18 }
19
20 namespace android_webview {
21
22 // Interface for all the WebView-specific content rendering operations.
23 // Provides software and hardware rendering and the Capture Picture API.
24 class BrowserViewRenderer {
25 public:
26 class Client {
27 public:
28 // Called to trigger view invalidations.
29 virtual void Invalidate() = 0;
30
31 // Called when a new Picture is available. Needs to be enabled
32 // via the EnableOnNewPicture method.
33 virtual void OnNewPicture(
34 const base::android::JavaRef<jobject>& picture) = 0;
35
36 protected:
37 virtual ~Client() {}
38 };
39
40 // Delegate to perform rendering actions involving Java objects.
41 class JavaHelper {
42 public:
43 // Creates a RGBA_8888 Java Bitmap object of the requested size.
44 virtual base::android::ScopedJavaLocalRef<jobject> CreateBitmap(
45 JNIEnv* env,
46 int width,
47 int height) = 0;
48
49 // Draws the provided Java Bitmap into the provided Java Canvas.
50 virtual void DrawBitmapIntoCanvas(
51 JNIEnv* env,
52 const base::android::JavaRef<jobject>& jbitmap,
53 const base::android::JavaRef<jobject>& jcanvas) = 0;
54
55 // Creates a Java Picture object that records drawing the provided Bitmap.
56 virtual base::android::ScopedJavaLocalRef<jobject> RecordBitmapIntoPicture(
57 JNIEnv* env,
58 const base::android::JavaRef<jobject>& jbitmap) = 0;
59
60 protected:
61 virtual ~JavaHelper() {}
62 };
63
64 enum OnNewPictureMode {
65 kOnNewPictureDisabled = 0,
66 kOnNewPictureEnabled,
67 kOnNewPictureInvalidationOnly,
68 };
69
70 // Content control methods.
71 virtual void SetContents(content::ContentViewCore* content_view_core) = 0;
72
73 // Hardware rendering methods.
74 virtual void DrawGL(AwDrawGLInfo* draw_info) = 0;
75 virtual void SetScrollForHWFrame(int x, int y) = 0;
76
77 // Software rendering methods.
78 virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip_bounds) = 0;
79
80 // CapturePicture API methods.
81 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() = 0;
82 virtual void EnableOnNewPicture(OnNewPictureMode mode) = 0;
83
84 // View update notifications.
85 virtual void OnVisibilityChanged(bool view_visible, bool window_visible) = 0;
86 virtual void OnSizeChanged(int width, int height) = 0;
87 virtual void OnAttachedToWindow(int width, int height) = 0;
88 virtual void OnDetachedFromWindow() = 0;
89
90 virtual ~BrowserViewRenderer() {}
91 };
92
93 } // namespace android_webview
94
95 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
OLDNEW
« 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