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 <map> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "cc/debug/rendering_stats_instrumentation.h" | 17 #include "cc/debug/rendering_stats_instrumentation.h" |
18 #include "content/common/browser_rendering_stats.h" | 18 #include "content/common/browser_rendering_stats.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 20 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
21 #include "content/common/input/synthetic_gesture_params.h" | |
22 #include "content/renderer/paint_aggregator.h" | 21 #include "content/renderer/paint_aggregator.h" |
23 #include "ipc/ipc_listener.h" | 22 #include "ipc/ipc_listener.h" |
24 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
25 #include "third_party/WebKit/public/platform/WebRect.h" | 24 #include "third_party/WebKit/public/platform/WebRect.h" |
26 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 25 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
27 #include "third_party/WebKit/public/web/WebPopupType.h" | 26 #include "third_party/WebKit/public/web/WebPopupType.h" |
28 #include "third_party/WebKit/public/web/WebTextDirection.h" | 27 #include "third_party/WebKit/public/web/WebTextDirection.h" |
29 #include "third_party/WebKit/public/web/WebTextInputInfo.h" | 28 #include "third_party/WebKit/public/web/WebTextInputInfo.h" |
30 #include "third_party/WebKit/public/web/WebWidget.h" | 29 #include "third_party/WebKit/public/web/WebWidget.h" |
31 #include "third_party/WebKit/public/web/WebWidgetClient.h" | 30 #include "third_party/WebKit/public/web/WebWidgetClient.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 171 |
173 void GetBrowserRenderingStats(BrowserRenderingStats* stats); | 172 void GetBrowserRenderingStats(BrowserRenderingStats* stats); |
174 | 173 |
175 RenderWidgetCompositor* compositor() const; | 174 RenderWidgetCompositor* compositor() const; |
176 | 175 |
177 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback); | 176 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback); |
178 | 177 |
179 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll). | 178 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll). |
180 typedef base::Callback<void()> SyntheticGestureCompletionCallback; | 179 typedef base::Callback<void()> SyntheticGestureCompletionCallback; |
181 | 180 |
182 // Send a synthetic gesture to the browser to be queued to the synthetic | 181 // Directs the host to begin a smooth scroll. This scroll should have the same |
183 // gesture controller. | 182 // performance characteristics as a user-initiated scroll. Returns an ID of |
184 void QueueSyntheticGesture( | 183 // the scroll gesture. |mouse_event_x| and |mouse_event_y| are expected to be |
185 scoped_ptr<SyntheticGestureParams> gesture_params, | 184 // in local DIP coordinates. |
186 const SyntheticGestureCompletionCallback& callback); | 185 void BeginSmoothScroll(bool scroll_down, |
| 186 const SyntheticGestureCompletionCallback& callback, |
| 187 int pixels_to_scroll, |
| 188 int mouse_event_x, |
| 189 int mouse_event_y); |
| 190 |
| 191 // Directs the host to begin a pinch gesture. This gesture should have the |
| 192 // same performance characteristics as a user-initiated pinch. |
| 193 // |pixels_to_move|, |anchor_x| and |anchor_y| are expected to be in local |
| 194 // DIP coordinates. |
| 195 void BeginPinch(bool zoom_in, |
| 196 int pixels_to_move, |
| 197 int anchor_x, |
| 198 int anchor_y, |
| 199 const SyntheticGestureCompletionCallback& callback); |
187 | 200 |
188 // Close the underlying WebWidget. | 201 // Close the underlying WebWidget. |
189 virtual void Close(); | 202 virtual void Close(); |
190 | 203 |
191 // Notifies about a compositor frame commit operation having finished. | 204 // Notifies about a compositor frame commit operation having finished. |
192 virtual void DidCommitCompositorFrame(); | 205 virtual void DidCommitCompositorFrame(); |
193 | 206 |
194 float filtered_time_per_frame() const { | 207 float filtered_time_per_frame() const { |
195 return filtered_time_per_frame_; | 208 return filtered_time_per_frame_; |
196 } | 209 } |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // case NULL is added to the queue. | 749 // case NULL is added to the queue. |
737 std::deque<ViewHostMsg_UpdateRect*> updates_pending_swap_; | 750 std::deque<ViewHostMsg_UpdateRect*> updates_pending_swap_; |
738 | 751 |
739 // Properties of the screen hosting this RenderWidget instance. | 752 // Properties of the screen hosting this RenderWidget instance. |
740 blink::WebScreenInfo screen_info_; | 753 blink::WebScreenInfo screen_info_; |
741 | 754 |
742 // The device scale factor. This value is computed from the DPI entries in | 755 // The device scale factor. This value is computed from the DPI entries in |
743 // |screen_info_| on some platforms, and defaults to 1 on other platforms. | 756 // |screen_info_| on some platforms, and defaults to 1 on other platforms. |
744 float device_scale_factor_; | 757 float device_scale_factor_; |
745 | 758 |
746 // State associated with synthetic gestures. Synthetic gestures are processed | 759 // State associated with the synthetic gestures function |
747 // in-order, so a queue is sufficient to identify the correct state for a | 760 // (e.g. BeginSmoothScroll). |
748 // completed gesture. | 761 SyntheticGestureCompletionCallback pending_synthetic_gesture_; |
749 std::queue<SyntheticGestureCompletionCallback> | |
750 pending_synthetic_gesture_callbacks_; | |
751 | 762 |
752 // Specified whether the compositor will run in its own thread. | 763 // Specified whether the compositor will run in its own thread. |
753 bool is_threaded_compositing_enabled_; | 764 bool is_threaded_compositing_enabled_; |
754 | 765 |
755 // The last set of rendering stats received from the browser. This is only | 766 // The last set of rendering stats received from the browser. This is only |
756 // received when using the --enable-gpu-benchmarking flag. | 767 // received when using the --enable-gpu-benchmarking flag. |
757 BrowserRenderingStats browser_rendering_stats_; | 768 BrowserRenderingStats browser_rendering_stats_; |
758 | 769 |
759 // The latency information for any current non-accelerated-compositing | 770 // The latency information for any current non-accelerated-compositing |
760 // frame. | 771 // frame. |
(...skipping 17 matching lines...) Expand all Loading... |
778 float popup_origin_scale_for_emulation_; | 789 float popup_origin_scale_for_emulation_; |
779 | 790 |
780 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; | 791 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; |
781 | 792 |
782 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 793 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
783 }; | 794 }; |
784 | 795 |
785 } // namespace content | 796 } // namespace content |
786 | 797 |
787 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 798 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |