| OLD | NEW |
| 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 get view's absolute location on the screen. |
| 40 virtual gfx::Point GetLocationOnScreen() = 0; |
| 41 |
| 36 protected: | 42 protected: |
| 37 virtual ~Client() {} | 43 virtual ~Client() {} |
| 38 }; | 44 }; |
| 39 | 45 |
| 40 // Delegate to perform rendering actions involving Java objects. | 46 // Delegate to perform rendering actions involving Java objects. |
| 41 class JavaHelper { | 47 class JavaHelper { |
| 42 public: | 48 public: |
| 43 // Creates a RGBA_8888 Java Bitmap object of the requested size. | 49 // Creates a RGBA_8888 Java Bitmap object of the requested size. |
| 44 virtual base::android::ScopedJavaLocalRef<jobject> CreateBitmap( | 50 virtual base::android::ScopedJavaLocalRef<jobject> CreateBitmap( |
| 45 JNIEnv* env, | 51 JNIEnv* env, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // CapturePicture API methods. | 86 // CapturePicture API methods. |
| 81 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() = 0; | 87 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() = 0; |
| 82 virtual void EnableOnNewPicture(OnNewPictureMode mode) = 0; | 88 virtual void EnableOnNewPicture(OnNewPictureMode mode) = 0; |
| 83 | 89 |
| 84 // View update notifications. | 90 // View update notifications. |
| 85 virtual void OnVisibilityChanged(bool view_visible, bool window_visible) = 0; | 91 virtual void OnVisibilityChanged(bool view_visible, bool window_visible) = 0; |
| 86 virtual void OnSizeChanged(int width, int height) = 0; | 92 virtual void OnSizeChanged(int width, int height) = 0; |
| 87 virtual void OnAttachedToWindow(int width, int height) = 0; | 93 virtual void OnAttachedToWindow(int width, int height) = 0; |
| 88 virtual void OnDetachedFromWindow() = 0; | 94 virtual void OnDetachedFromWindow() = 0; |
| 89 | 95 |
| 96 // Android views hierarchy gluing. |
| 97 virtual bool IsAttachedToWindow() = 0; |
| 98 virtual bool IsViewVisible() = 0; |
| 99 virtual gfx::Rect GetScreenRect() = 0; |
| 100 |
| 90 virtual ~BrowserViewRenderer() {} | 101 virtual ~BrowserViewRenderer() {} |
| 91 }; | 102 }; |
| 92 | 103 |
| 93 } // namespace android_webview | 104 } // namespace android_webview |
| 94 | 105 |
| 95 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 106 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |