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_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
7 | 7 |
8 #include "android_webview/browser/browser_view_renderer_impl.h" | 8 #include "android_webview/browser/browser_view_renderer_impl.h" |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "content/public/renderer/android/synchronous_compositor_client.h" | 11 #include "content/public/browser/android/synchronous_compositor_client.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class SynchronousCompositor; | 14 class SynchronousCompositor; |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 namespace android_webview { | 18 namespace android_webview { |
19 | 19 |
20 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 20 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
21 // IPC messages to the renderer and from there to WebKit. | 21 // IPC messages to the renderer and from there to WebKit. |
22 class InProcessViewRenderer : public BrowserViewRenderer, | 22 class InProcessViewRenderer : public BrowserViewRenderer, |
23 public content::SynchronousCompositorClient { | 23 public content::SynchronousCompositorClient { |
24 public: | 24 public: |
25 InProcessViewRenderer(BrowserViewRenderer::Client* client, | 25 InProcessViewRenderer(BrowserViewRenderer::Client* client, |
26 JavaHelper* java_helper); | 26 JavaHelper* java_helper); |
27 virtual ~InProcessViewRenderer(); | 27 virtual ~InProcessViewRenderer(); |
28 | 28 |
29 static InProcessViewRenderer* FromWebContents( | 29 static InProcessViewRenderer* FromWebContents( |
30 content::WebContents* contents); | 30 content::WebContents* contents); |
31 static InProcessViewRenderer* FromId( | |
32 int render_process_id, int render_view_id); | |
33 void BindSynchronousCompositor( | |
34 content::SynchronousCompositor* compositor); | |
35 | 31 |
36 // BrowserViewRenderer overrides | 32 // BrowserViewRenderer overrides |
37 virtual void SetContents( | 33 virtual void SetContents( |
38 content::ContentViewCore* content_view_core) OVERRIDE; | 34 content::ContentViewCore* content_view_core) OVERRIDE; |
39 virtual bool PrepareDrawGL(int x, int y) OVERRIDE; | 35 virtual bool PrepareDrawGL(int x, int y) OVERRIDE; |
40 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; | 36 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; |
41 virtual bool DrawSW(jobject java_canvas, | 37 virtual bool DrawSW(jobject java_canvas, |
42 const gfx::Rect& clip_bounds) OVERRIDE; | 38 const gfx::Rect& clip_bounds) OVERRIDE; |
43 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE; | 39 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE; |
44 virtual void EnableOnNewPicture(bool enabled) OVERRIDE; | 40 virtual void EnableOnNewPicture(bool enabled) OVERRIDE; |
45 virtual void OnVisibilityChanged( | 41 virtual void OnVisibilityChanged( |
46 bool view_visible, bool window_visible) OVERRIDE; | 42 bool view_visible, bool window_visible) OVERRIDE; |
47 virtual void OnSizeChanged(int width, int height) OVERRIDE; | 43 virtual void OnSizeChanged(int width, int height) OVERRIDE; |
48 virtual void OnAttachedToWindow(int width, int height) OVERRIDE; | 44 virtual void OnAttachedToWindow(int width, int height) OVERRIDE; |
49 virtual void OnDetachedFromWindow() OVERRIDE; | 45 virtual void OnDetachedFromWindow() OVERRIDE; |
50 virtual bool IsAttachedToWindow() OVERRIDE; | 46 virtual bool IsAttachedToWindow() OVERRIDE; |
51 virtual bool IsViewVisible() OVERRIDE; | 47 virtual bool IsViewVisible() OVERRIDE; |
52 virtual gfx::Rect GetScreenRect() OVERRIDE; | 48 virtual gfx::Rect GetScreenRect() OVERRIDE; |
53 | 49 |
54 // SynchronousCompositorClient overrides | 50 // SynchronousCompositorClient overrides |
| 51 virtual void DidInitializeCompositor( |
| 52 content::SynchronousCompositor* compositor) OVERRIDE; |
55 virtual void DidDestroyCompositor( | 53 virtual void DidDestroyCompositor( |
56 content::SynchronousCompositor* compositor) OVERRIDE; | 54 content::SynchronousCompositor* compositor) OVERRIDE; |
57 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; | 55 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; |
58 | 56 |
59 void WebContentsGone(); | 57 void WebContentsGone(); |
60 | 58 |
61 private: | 59 private: |
62 void Invalidate(); | 60 void Invalidate(); |
63 void EnsureContinuousInvalidation(); | 61 void EnsureContinuousInvalidation(); |
64 bool DrawSWInternal(jobject java_canvas, | 62 bool DrawSWInternal(jobject java_canvas, |
(...skipping 29 matching lines...) Expand all Loading... |
94 gfx::Point hw_rendering_scroll_; | 92 gfx::Point hw_rendering_scroll_; |
95 | 93 |
96 base::WeakPtrFactory<InProcessViewRenderer> weak_factory_; | 94 base::WeakPtrFactory<InProcessViewRenderer> weak_factory_; |
97 | 95 |
98 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); | 96 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); |
99 }; | 97 }; |
100 | 98 |
101 } // namespace android_webview | 99 } // namespace android_webview |
102 | 100 |
103 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ | 101 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
OLD | NEW |