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

Side by Side Diff: android_webview/browser/browser_view_renderer.h

Issue 12697002: [Android WebView] Provide more information about WebView for web debugging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
7 7
8 #include "base/android/scoped_java_ref.h" 8 #include "base/android/scoped_java_ref.h"
9 #include "ui/gfx/point.h"
10 #include "ui/gfx/rect.h"
9 11
10 struct AwDrawGLInfo; 12 struct AwDrawGLInfo;
11 13
12 namespace content { 14 namespace content {
13 class ContentViewCore; 15 class ContentViewCore;
16 class WebContents;
14 } 17 }
15 18
16 namespace gfx { 19 namespace gfx {
17 class Rect; 20 class Rect;
18 } 21 }
19 22
20 namespace android_webview { 23 namespace android_webview {
21 24
22 // Interface for all the WebView-specific content rendering operations. 25 // Interface for all the WebView-specific content rendering operations.
23 // Provides software and hardware rendering and the Capture Picture API. 26 // Provides software and hardware rendering and the Capture Picture API.
24 class BrowserViewRenderer { 27 class BrowserViewRenderer {
25 public: 28 public:
26 class Client { 29 class Client {
27 public: 30 public:
28 // Called to trigger view invalidations. 31 // Called to trigger view invalidations.
29 virtual void Invalidate() = 0; 32 virtual void Invalidate() = 0;
30 33
31 // Called when a new Picture is available. Needs to be enabled 34 // Called when a new Picture is available. Needs to be enabled
32 // via the EnableOnNewPicture method. 35 // via the EnableOnNewPicture method.
33 virtual void OnNewPicture( 36 virtual void OnNewPicture(
34 const base::android::JavaRef<jobject>& picture) = 0; 37 const base::android::JavaRef<jobject>& picture) = 0;
35 38
39 // Called to figure out, if the view is attached to the UI views
40 // hierarchy.
41 virtual bool isAttachedToViewHierarchy() = 0;
joth 2013/03/08 23:23:46 both these methods: leading capital letter in C++
mnaganov (inactive) 2013/03/11 14:39:20 This is what happens when you mix Java and C++ :(
42
43 // Called to get view's absolute location on the screen.
44 virtual gfx::Point getLocationOnScreen() = 0;
45
36 protected: 46 protected:
37 virtual ~Client() {} 47 virtual ~Client() {}
38 }; 48 };
39 49
40 // Delegate to perform rendering actions involving Java objects. 50 // Delegate to perform rendering actions involving Java objects.
41 class JavaHelper { 51 class JavaHelper {
42 public: 52 public:
43 // Creates a RGBA_8888 Java Bitmap object of the requested size. 53 // Creates a RGBA_8888 Java Bitmap object of the requested size.
44 virtual base::android::ScopedJavaLocalRef<jobject> CreateBitmap( 54 virtual base::android::ScopedJavaLocalRef<jobject> CreateBitmap(
45 JNIEnv* env, 55 JNIEnv* env,
(...skipping 14 matching lines...) Expand all
60 protected: 70 protected:
61 virtual ~JavaHelper() {} 71 virtual ~JavaHelper() {}
62 }; 72 };
63 73
64 enum OnNewPictureMode { 74 enum OnNewPictureMode {
65 kOnNewPictureDisabled = 0, 75 kOnNewPictureDisabled = 0,
66 kOnNewPictureEnabled, 76 kOnNewPictureEnabled,
67 kOnNewPictureInvalidationOnly, 77 kOnNewPictureInvalidationOnly,
68 }; 78 };
69 79
80 static BrowserViewRenderer* FromWebContents(
81 content::WebContents* web_contents);
82
70 // Content control methods. 83 // Content control methods.
71 virtual void SetContents(content::ContentViewCore* content_view_core) = 0; 84 virtual void SetContents(content::ContentViewCore* content_view_core) = 0;
72 85
73 // Hardware rendering methods. 86 // Hardware rendering methods.
74 virtual void DrawGL(AwDrawGLInfo* draw_info) = 0; 87 virtual void DrawGL(AwDrawGLInfo* draw_info) = 0;
75 virtual void SetScrollForHWFrame(int x, int y) = 0; 88 virtual void SetScrollForHWFrame(int x, int y) = 0;
76 89
77 // Software rendering methods. 90 // Software rendering methods.
78 virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip_bounds) = 0; 91 virtual bool DrawSW(jobject java_canvas, const gfx::Rect& clip_bounds) = 0;
79 92
80 // CapturePicture API methods. 93 // CapturePicture API methods.
81 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() = 0; 94 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() = 0;
82 virtual void EnableOnNewPicture(OnNewPictureMode mode) = 0; 95 virtual void EnableOnNewPicture(OnNewPictureMode mode) = 0;
83 96
84 // View update notifications. 97 // View update notifications.
85 virtual void OnVisibilityChanged(bool view_visible, bool window_visible) = 0; 98 virtual void OnVisibilityChanged(bool view_visible, bool window_visible) = 0;
86 virtual void OnSizeChanged(int width, int height) = 0; 99 virtual void OnSizeChanged(int width, int height) = 0;
87 virtual void OnAttachedToWindow(int width, int height) = 0; 100 virtual void OnAttachedToWindow(int width, int height) = 0;
88 virtual void OnDetachedFromWindow() = 0; 101 virtual void OnDetachedFromWindow() = 0;
89 102
103 // Android views hierarchy gluing.
104 virtual bool isViewVisible() = 0;
105 virtual bool isAttachedToViewHierarchy() = 0;
106 virtual gfx::Rect getScreenRect() = 0;
joth 2013/03/08 23:23:46 ditto
mnaganov (inactive) 2013/03/11 14:39:20 Done.
107
90 virtual ~BrowserViewRenderer() {} 108 virtual ~BrowserViewRenderer() {}
91 }; 109 };
92 110
93 } // namespace android_webview 111 } // namespace android_webview
94 112
95 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 113 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698