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/common/input_event_ack_state.h" |
11 #include "content/public/renderer/android/synchronous_compositor_client.h" | 12 #include "content/public/renderer/android/synchronous_compositor_client.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 class SynchronousCompositor; | 15 class SynchronousCompositor; |
| 16 class SynchronousInputEventHandler; |
15 class WebContents; | 17 class WebContents; |
16 } | 18 } |
17 | 19 |
| 20 namespace WebKit { |
| 21 class WebInputEvent; |
| 22 } |
| 23 |
18 namespace android_webview { | 24 namespace android_webview { |
19 | 25 |
20 // Provides RenderViewHost wrapper functionality for sending WebView-specific | 26 // Provides RenderViewHost wrapper functionality for sending WebView-specific |
21 // IPC messages to the renderer and from there to WebKit. | 27 // IPC messages to the renderer and from there to WebKit. |
22 class InProcessViewRenderer : public BrowserViewRenderer, | 28 class InProcessViewRenderer : public BrowserViewRenderer, |
23 public content::SynchronousCompositorClient { | 29 public content::SynchronousCompositorClient { |
24 public: | 30 public: |
25 InProcessViewRenderer(BrowserViewRenderer::Client* client, | 31 InProcessViewRenderer(BrowserViewRenderer::Client* client, |
26 JavaHelper* java_helper); | 32 JavaHelper* java_helper); |
27 virtual ~InProcessViewRenderer(); | 33 virtual ~InProcessViewRenderer(); |
28 | 34 |
29 static InProcessViewRenderer* FromWebContents( | 35 static InProcessViewRenderer* FromWebContents( |
30 content::WebContents* contents); | 36 content::WebContents* contents); |
31 static InProcessViewRenderer* FromId( | 37 static InProcessViewRenderer* FromId( |
32 int render_process_id, int render_view_id); | 38 int render_process_id, int render_view_id); |
33 void BindSynchronousCompositor( | 39 void BindSynchronousCompositor( |
34 content::SynchronousCompositor* compositor); | 40 content::SynchronousCompositor* compositor); |
| 41 void BindSynchronousInputEventHandler( |
| 42 content::SynchronousInputEventHandler* input_event_handler); |
35 | 43 |
36 // BrowserViewRenderer overrides | 44 // BrowserViewRenderer overrides |
37 virtual void SetContents( | 45 virtual void SetContents( |
38 content::ContentViewCore* content_view_core) OVERRIDE; | 46 content::ContentViewCore* content_view_core) OVERRIDE; |
39 virtual bool PrepareDrawGL(int x, int y) OVERRIDE; | 47 virtual bool PrepareDrawGL(int x, int y) OVERRIDE; |
40 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; | 48 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; |
41 virtual bool DrawSW(jobject java_canvas, | 49 virtual bool DrawSW(jobject java_canvas, |
42 const gfx::Rect& clip_bounds) OVERRIDE; | 50 const gfx::Rect& clip_bounds) OVERRIDE; |
43 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE; | 51 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE; |
44 virtual void EnableOnNewPicture(bool enabled) OVERRIDE; | 52 virtual void EnableOnNewPicture(bool enabled) OVERRIDE; |
(...skipping 13 matching lines...) Expand all Loading... |
58 | 66 |
59 void WebContentsGone(); | 67 void WebContentsGone(); |
60 | 68 |
61 private: | 69 private: |
62 void Invalidate(); | 70 void Invalidate(); |
63 void EnsureContinuousInvalidation(); | 71 void EnsureContinuousInvalidation(); |
64 bool DrawSWInternal(jobject java_canvas, | 72 bool DrawSWInternal(jobject java_canvas, |
65 const gfx::Rect& clip_bounds); | 73 const gfx::Rect& clip_bounds); |
66 bool RenderSW(SkCanvas* canvas); | 74 bool RenderSW(SkCanvas* canvas); |
67 bool CompositeSW(SkCanvas* canvas); | 75 bool CompositeSW(SkCanvas* canvas); |
| 76 content::InputEventAckState HandleInputEvent( |
| 77 int routing_id, |
| 78 const WebKit::WebInputEvent& input_event); |
68 | 79 |
69 BrowserViewRenderer::Client* client_; | 80 BrowserViewRenderer::Client* client_; |
70 BrowserViewRenderer::JavaHelper* java_helper_; | 81 BrowserViewRenderer::JavaHelper* java_helper_; |
| 82 content::ContentViewCore* content_view_core_; |
71 content::WebContents* web_contents_; | 83 content::WebContents* web_contents_; |
72 content::SynchronousCompositor* compositor_; | 84 content::SynchronousCompositor* compositor_; |
| 85 content::SynchronousInputEventHandler* input_event_handler_; |
73 | 86 |
74 bool view_visible_; | 87 bool view_visible_; |
75 | 88 |
76 // When true, we should continuously invalidate and keep drawing, for example | 89 // When true, we should continuously invalidate and keep drawing, for example |
77 // to drive animation. | 90 // to drive animation. |
78 bool continuous_invalidate_; | 91 bool continuous_invalidate_; |
79 // True while an asynchronous invalidation task is pending. | 92 // True while an asynchronous invalidation task is pending. |
80 bool continuous_invalidate_task_pending_; | 93 bool continuous_invalidate_task_pending_; |
81 | 94 |
82 int width_; | 95 int width_; |
(...skipping 11 matching lines...) Expand all Loading... |
94 gfx::Point hw_rendering_scroll_; | 107 gfx::Point hw_rendering_scroll_; |
95 | 108 |
96 base::WeakPtrFactory<InProcessViewRenderer> weak_factory_; | 109 base::WeakPtrFactory<InProcessViewRenderer> weak_factory_; |
97 | 110 |
98 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); | 111 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); |
99 }; | 112 }; |
100 | 113 |
101 } // namespace android_webview | 114 } // namespace android_webview |
102 | 115 |
103 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ | 116 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ |
OLD | NEW |