OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_RENDER_WIDGET_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
| 9 #include <map> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/time.h" | 16 #include "base/time.h" |
16 #include "base/timer.h" | 17 #include "base/timer.h" |
17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
18 #include "content/renderer/paint_aggregator.h" | 19 #include "content/renderer/paint_aggregator.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Called when a plugin window has been destroyed, to make sure the currently | 153 // Called when a plugin window has been destroyed, to make sure the currently |
153 // pending moves don't try to reference it. | 154 // pending moves don't try to reference it. |
154 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); | 155 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); |
155 | 156 |
156 // Fills in a WebRenderingStats struct containing information about | 157 // Fills in a WebRenderingStats struct containing information about |
157 // rendering, e.g. count of frames rendered, time spent painting. | 158 // rendering, e.g. count of frames rendered, time spent painting. |
158 // This call is relatively expensive in threaded compositing mode, | 159 // This call is relatively expensive in threaded compositing mode, |
159 // as it blocks on the compositor thread. | 160 // as it blocks on the compositor thread. |
160 void GetRenderingStats(WebKit::WebRenderingStats&) const; | 161 void GetRenderingStats(WebKit::WebRenderingStats&) const; |
161 | 162 |
| 163 // Callback for use with BeginSmoothScroll. |
| 164 typedef base::Callback<void()> SmoothScrollCompletionCallback; |
| 165 |
162 // Directs the host to begin a smooth scroll. This scroll should have the same | 166 // Directs the host to begin a smooth scroll. This scroll should have the same |
163 // performance characteristics as a user-initiated scroll. | 167 // performance characteristics as a user-initiated scroll. Returns an ID of |
164 void BeginSmoothScroll(bool scroll_down, bool scroll_far); | 168 // the scroll gesture. |
| 169 void BeginSmoothScroll(bool scroll_down, |
| 170 bool scroll_far, |
| 171 const SmoothScrollCompletionCallback& callback); |
165 | 172 |
166 // Close the underlying WebWidget. | 173 // Close the underlying WebWidget. |
167 virtual void Close(); | 174 virtual void Close(); |
168 | 175 |
169 float filtered_time_per_frame() const { | 176 float filtered_time_per_frame() const { |
170 return filtered_time_per_frame_; | 177 return filtered_time_per_frame_; |
171 } | 178 } |
172 | 179 |
173 protected: | 180 protected: |
174 // Friend RefCounted so that the dtor can be non-public. Using this class | 181 // Friend RefCounted so that the dtor can be non-public. Using this class |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 265 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
259 int selection_start, | 266 int selection_start, |
260 int selection_end); | 267 int selection_end); |
261 virtual void OnImeConfirmComposition( | 268 virtual void OnImeConfirmComposition( |
262 const string16& text, const ui::Range& replacement_range); | 269 const string16& text, const ui::Range& replacement_range); |
263 void OnMsgPaintAtSize(const TransportDIB::Handle& dib_id, | 270 void OnMsgPaintAtSize(const TransportDIB::Handle& dib_id, |
264 int tag, | 271 int tag, |
265 const gfx::Size& page_size, | 272 const gfx::Size& page_size, |
266 const gfx::Size& desired_size); | 273 const gfx::Size& desired_size); |
267 void OnMsgRepaint(const gfx::Size& size_to_paint); | 274 void OnMsgRepaint(const gfx::Size& size_to_paint); |
| 275 void OnMsgSmoothScrollCompleted(int gesture_id); |
268 virtual void OnSetDeviceScaleFactor(float device_scale_factor); | 276 virtual void OnSetDeviceScaleFactor(float device_scale_factor); |
269 void OnSetTextDirection(WebKit::WebTextDirection direction); | 277 void OnSetTextDirection(WebKit::WebTextDirection direction); |
270 void OnGetFPS(); | 278 void OnGetFPS(); |
271 void OnScreenInfoChanged(const WebKit::WebScreenInfo& screen_info); | 279 void OnScreenInfoChanged(const WebKit::WebScreenInfo& screen_info); |
272 | 280 |
273 // Override points to notify derived classes that a paint has happened. | 281 // Override points to notify derived classes that a paint has happened. |
274 // WillInitiatePaint happens when we're about to generate a new bitmap and | 282 // WillInitiatePaint happens when we're about to generate a new bitmap and |
275 // send it to the browser. DidInitiatePaint happens when that has completed, | 283 // send it to the browser. DidInitiatePaint happens when that has completed, |
276 // and subsequent rendering won't affect the painted content. DidFlushPaint | 284 // and subsequent rendering won't affect the painted content. DidFlushPaint |
277 // happens once we've received the ACK that the screen has been updated. | 285 // happens once we've received the ACK that the screen has been updated. |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // Properties of the screen hosting this RenderWidget instance. | 579 // Properties of the screen hosting this RenderWidget instance. |
572 WebKit::WebScreenInfo screen_info_; | 580 WebKit::WebScreenInfo screen_info_; |
573 | 581 |
574 // The device scale factor. This value is computed from the DPI entries in | 582 // The device scale factor. This value is computed from the DPI entries in |
575 // |screen_info_| on some platforms, and defaults to 1 on other platforms. | 583 // |screen_info_| on some platforms, and defaults to 1 on other platforms. |
576 float device_scale_factor_; | 584 float device_scale_factor_; |
577 | 585 |
578 // Specifies whether input event throttling is enabled for this widget. | 586 // Specifies whether input event throttling is enabled for this widget. |
579 bool throttle_input_events_; | 587 bool throttle_input_events_; |
580 | 588 |
| 589 // State associated with the BeginSmoothScroll synthetic scrolling function. |
| 590 int next_smooth_scroll_gesture_id_; |
| 591 typedef std::map<int, SmoothScrollCompletionCallback> |
| 592 PendingSmoothScrollGestureMap; |
| 593 PendingSmoothScrollGestureMap pending_smooth_scroll_gestures_; |
| 594 |
581 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 595 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
582 }; | 596 }; |
583 | 597 |
584 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 598 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |