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

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

Issue 16255010: Hookup android_webview scroll offset delegation to Java side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile break Created 7 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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.h" 8 #include "android_webview/browser/browser_view_renderer.h"
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "content/public/browser/android/synchronous_compositor_client.h" 11 #include "content/public/browser/android/synchronous_compositor_client.h"
12 #include "ui/gfx/vector2d_f.h"
12 13
13 namespace content { 14 namespace content {
14 class SynchronousCompositor; 15 class SynchronousCompositor;
15 class WebContents; 16 class WebContents;
16 } 17 }
17 18
18 typedef void* EGLContext; 19 typedef void* EGLContext;
19 class SkCanvas; 20 class SkCanvas;
20 21
21 namespace android_webview { 22 namespace android_webview {
22 23
23 // Provides RenderViewHost wrapper functionality for sending WebView-specific 24 // Provides RenderViewHost wrapper functionality for sending WebView-specific
24 // IPC messages to the renderer and from there to WebKit. 25 // IPC messages to the renderer and from there to WebKit.
25 class InProcessViewRenderer : public BrowserViewRenderer, 26 class InProcessViewRenderer : public BrowserViewRenderer,
26 public content::SynchronousCompositorClient { 27 public content::SynchronousCompositorClient {
27 public: 28 public:
28 InProcessViewRenderer(BrowserViewRenderer::Client* client, 29 InProcessViewRenderer(BrowserViewRenderer::Client* client,
29 JavaHelper* java_helper, 30 JavaHelper* java_helper,
30 content::WebContents* web_contents); 31 content::WebContents* web_contents);
31 virtual ~InProcessViewRenderer(); 32 virtual ~InProcessViewRenderer();
32 33
33 static InProcessViewRenderer* FromWebContents( 34 static InProcessViewRenderer* FromWebContents(
34 content::WebContents* contents); 35 content::WebContents* contents);
35 36
36 // BrowserViewRenderer overrides 37 // BrowserViewRenderer overrides
37 virtual bool OnDraw(jobject java_canvas, 38 virtual bool OnDraw(jobject java_canvas,
38 bool is_hardware_canvas, 39 bool is_hardware_canvas,
39 const gfx::Point& scroll, 40 const gfx::Vector2d& scroll_,
40 const gfx::Rect& clip) OVERRIDE; 41 const gfx::Rect& clip) OVERRIDE;
41 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; 42 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE;
42 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE; 43 virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE;
43 virtual void EnableOnNewPicture(bool enabled) OVERRIDE; 44 virtual void EnableOnNewPicture(bool enabled) OVERRIDE;
44 virtual void OnVisibilityChanged( 45 virtual void OnVisibilityChanged(
45 bool view_visible, bool window_visible) OVERRIDE; 46 bool view_visible, bool window_visible) OVERRIDE;
46 virtual void OnSizeChanged(int width, int height) OVERRIDE; 47 virtual void OnSizeChanged(int width, int height) OVERRIDE;
48 virtual void ScrollTo(gfx::Vector2d new_value) OVERRIDE;
47 virtual void OnAttachedToWindow(int width, int height) OVERRIDE; 49 virtual void OnAttachedToWindow(int width, int height) OVERRIDE;
48 virtual void OnDetachedFromWindow() OVERRIDE; 50 virtual void OnDetachedFromWindow() OVERRIDE;
51 virtual void SetDipScale(float dip_scale) OVERRIDE;
49 virtual bool IsAttachedToWindow() OVERRIDE; 52 virtual bool IsAttachedToWindow() OVERRIDE;
50 virtual bool IsViewVisible() OVERRIDE; 53 virtual bool IsViewVisible() OVERRIDE;
51 virtual gfx::Rect GetScreenRect() OVERRIDE; 54 virtual gfx::Rect GetScreenRect() OVERRIDE;
52 55
53 // SynchronousCompositorClient overrides 56 // SynchronousCompositorClient overrides
54 virtual void DidInitializeCompositor( 57 virtual void DidInitializeCompositor(
55 content::SynchronousCompositor* compositor) OVERRIDE; 58 content::SynchronousCompositor* compositor) OVERRIDE;
56 virtual void DidDestroyCompositor( 59 virtual void DidDestroyCompositor(
57 content::SynchronousCompositor* compositor) OVERRIDE; 60 content::SynchronousCompositor* compositor) OVERRIDE;
58 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; 61 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE;
59 virtual void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value) OVERRIDE; 62 virtual void SetTotalRootLayerScrollOffset(
63 gfx::Vector2dF new_value_css) OVERRIDE;
60 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE; 64 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE;
61 65
62 void WebContentsGone(); 66 void WebContentsGone();
63 67
64 private: 68 private:
65 void EnsureContinuousInvalidation(AwDrawGLInfo* draw_info); 69 void EnsureContinuousInvalidation(AwDrawGLInfo* draw_info);
66 bool DrawSWInternal(jobject java_canvas, 70 bool DrawSWInternal(jobject java_canvas,
67 const gfx::Rect& clip_bounds); 71 const gfx::Rect& clip_bounds);
68 bool RenderSW(SkCanvas* canvas); 72 bool RenderSW(SkCanvas* canvas);
69 bool CompositeSW(SkCanvas* canvas); 73 bool CompositeSW(SkCanvas* canvas);
70 74
71 BrowserViewRenderer::Client* client_; 75 BrowserViewRenderer::Client* client_;
72 BrowserViewRenderer::JavaHelper* java_helper_; 76 BrowserViewRenderer::JavaHelper* java_helper_;
73 content::WebContents* web_contents_; 77 content::WebContents* web_contents_;
74 content::SynchronousCompositor* compositor_; 78 content::SynchronousCompositor* compositor_;
75 79
76 bool view_visible_; 80 bool view_visible_;
81 float dip_scale_;
77 82
78 // When true, we should continuously invalidate and keep drawing, for example 83 // When true, we should continuously invalidate and keep drawing, for example
79 // to drive animation. 84 // to drive animation.
80 bool continuous_invalidate_; 85 bool continuous_invalidate_;
81 // Used to block additional invalidates while one is already pending or before 86 // Used to block additional invalidates while one is already pending or before
82 // compositor draw which may switch continuous_invalidate on and off in the 87 // compositor draw which may switch continuous_invalidate on and off in the
83 // process. 88 // process.
84 bool block_invalidates_; 89 bool block_invalidates_;
85 90
86 int width_; 91 int width_;
87 int height_; 92 int height_;
88 93
89 bool attached_to_window_; 94 bool attached_to_window_;
90 bool hardware_initialized_; 95 bool hardware_initialized_;
91 bool hardware_failed_; 96 bool hardware_failed_;
92 97
93 // Used only for detecting Android View System context changes. 98 // Used only for detecting Android View System context changes.
94 // Not to be used between draw calls. 99 // Not to be used between draw calls.
95 EGLContext last_egl_context_; 100 EGLContext last_egl_context_;
96 101
97 // Last View scroll when View.onDraw() was called. 102 // Last View scroll when View.onDraw() was called.
98 gfx::Point scroll_at_start_of_frame_; 103 gfx::Vector2d scroll_at_start_of_frame_;
99 104
100 gfx::Vector2dF scroll_offset_; 105 // Current scroll offset in CSS pixels.
106 gfx::Vector2dF scroll_offset_css_;
101 107
102 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); 108 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer);
103 }; 109 };
104 110
105 } // namespace android_webview 111 } // namespace android_webview
106 112
107 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_ 113 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_IN_PROCESS_VIEW_RENDERER_H_
OLDNEW
« no previous file with comments | « android_webview/browser/browser_view_renderer.h ('k') | android_webview/browser/in_process_view_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698