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 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Close the underlying WebWidget. | 192 // Close the underlying WebWidget. |
193 virtual void Close(); | 193 virtual void Close(); |
194 | 194 |
195 // Notifies about a compositor frame commit operation having finished. | 195 // Notifies about a compositor frame commit operation having finished. |
196 virtual void DidCommitCompositorFrame(); | 196 virtual void DidCommitCompositorFrame(); |
197 | 197 |
198 float filtered_time_per_frame() const { | 198 float filtered_time_per_frame() const { |
199 return filtered_time_per_frame_; | 199 return filtered_time_per_frame_; |
200 } | 200 } |
201 | 201 |
202 enum ShowIme { | |
203 DO_NOT_SHOW_IME, | |
204 SHOW_IME_IF_NEEDED | |
205 }; | |
206 | |
207 // Handle common setup/teardown for handling IME events. | 202 // Handle common setup/teardown for handling IME events. |
208 void StartHandlingImeEvent(); | 203 void StartHandlingImeEvent(); |
209 void FinishHandlingImeEvent(); | 204 void FinishHandlingImeEvent(); |
210 | 205 |
211 virtual void InstrumentWillBeginFrame() {} | 206 virtual void InstrumentWillBeginFrame() {} |
212 virtual void InstrumentDidBeginFrame() {} | 207 virtual void InstrumentDidBeginFrame() {} |
213 virtual void InstrumentDidCancelFrame() {} | 208 virtual void InstrumentDidCancelFrame() {} |
214 virtual void InstrumentWillComposite() {} | 209 virtual void InstrumentWillComposite() {} |
215 | 210 |
216 virtual bool AllowPartialSwap() const; | 211 virtual bool AllowPartialSwap() const; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 const gfx::Size& desired_size); | 314 const gfx::Size& desired_size); |
320 void OnRepaint(gfx::Size size_to_paint); | 315 void OnRepaint(gfx::Size size_to_paint); |
321 void OnSmoothScrollCompleted(); | 316 void OnSmoothScrollCompleted(); |
322 void OnSetTextDirection(WebKit::WebTextDirection direction); | 317 void OnSetTextDirection(WebKit::WebTextDirection direction); |
323 void OnGetFPS(); | 318 void OnGetFPS(); |
324 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, | 319 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, |
325 const gfx::Rect& window_screen_rect); | 320 const gfx::Rect& window_screen_rect); |
326 #if defined(OS_ANDROID) | 321 #if defined(OS_ANDROID) |
327 void OnImeBatchStateChanged(bool is_begin); | 322 void OnImeBatchStateChanged(bool is_begin); |
328 void OnShowImeIfNeeded(); | 323 void OnShowImeIfNeeded(); |
| 324 |
| 325 // Whenever an IME event that needs an acknowledgement is sent to the browser, |
| 326 // the number of outstanding IME events that needs acknowledgement should be |
| 327 // incremented. All IME events will be dropped until we receive an ack from |
| 328 // the browser. |
| 329 void IncrementOutstandingImeEventAcks(); |
| 330 |
| 331 // Called by the browser process for every required IME acknowledgement. |
| 332 void OnImeEventAck(); |
329 #endif | 333 #endif |
| 334 // Returns whether we currently should handle an IME event. |
| 335 bool ShouldHandleImeEvent(); |
| 336 |
330 void OnSnapshot(const gfx::Rect& src_subrect); | 337 void OnSnapshot(const gfx::Rect& src_subrect); |
331 void OnSetBrowserRenderingStats(const BrowserRenderingStats& stats); | 338 void OnSetBrowserRenderingStats(const BrowserRenderingStats& stats); |
332 | 339 |
333 // Notify the compositor about a change in viewport size. This should be | 340 // Notify the compositor about a change in viewport size. This should be |
334 // used only with auto resize mode WebWidgets, as normal WebWidgets should | 341 // used only with auto resize mode WebWidgets, as normal WebWidgets should |
335 // go through OnResize. | 342 // go through OnResize. |
336 void AutoResizeCompositor(); | 343 void AutoResizeCompositor(); |
337 | 344 |
338 virtual void SetDeviceScaleFactor(float device_scale_factor); | 345 virtual void SetDeviceScaleFactor(float device_scale_factor); |
339 | 346 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 bool next_paint_is_restore_ack() const; | 406 bool next_paint_is_restore_ack() const; |
400 void set_next_paint_is_resize_ack(); | 407 void set_next_paint_is_resize_ack(); |
401 void set_next_paint_is_restore_ack(); | 408 void set_next_paint_is_restore_ack(); |
402 void set_next_paint_is_repaint_ack(); | 409 void set_next_paint_is_repaint_ack(); |
403 | 410 |
404 // Checks if the text input state and compose inline mode have been changed. | 411 // Checks if the text input state and compose inline mode have been changed. |
405 // If they are changed, the new value will be sent to the browser process. | 412 // If they are changed, the new value will be sent to the browser process. |
406 void UpdateTextInputType(); | 413 void UpdateTextInputType(); |
407 | 414 |
408 #if defined(OS_ANDROID) | 415 #if defined(OS_ANDROID) |
409 // |show_ime_if_needed| should be SHOW_IME_IF_NEEDED iff the update may cause | 416 // |show_ime_if_needed| should be true iff the update may cause the ime to be |
410 // the ime to be displayed, e.g. after a tap on an input field on mobile. | 417 // displayed, e.g. after a tap on an input field on mobile. |
411 void UpdateTextInputState(ShowIme show_ime); | 418 // |send_ime_ack| should be true iff the browser side is required to |
| 419 // acknowledge the change before the renderer handles any more IME events. |
| 420 // This is when the event did not originate from the browser side IME, such as |
| 421 // changes from JavaScript or autofill. |
| 422 void UpdateTextInputState(bool show_ime_if_needed, bool send_ime_ack); |
412 #endif | 423 #endif |
413 | 424 |
414 // Checks if the selection bounds have been changed. If they are changed, | 425 // Checks if the selection bounds have been changed. If they are changed, |
415 // the new value will be sent to the browser process. | 426 // the new value will be sent to the browser process. |
416 virtual void UpdateSelectionBounds(); | 427 virtual void UpdateSelectionBounds(); |
417 | 428 |
418 // Override point to obtain that the current input method state and caret | 429 // Override point to obtain that the current input method state and caret |
419 // position. | 430 // position. |
420 virtual ui::TextInputType GetTextInputType(); | 431 virtual ui::TextInputType GetTextInputType(); |
421 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end); | 432 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 // The last set of rendering stats received from the browser. This is only | 721 // The last set of rendering stats received from the browser. This is only |
711 // received when using the --enable-gpu-benchmarking flag. | 722 // received when using the --enable-gpu-benchmarking flag. |
712 BrowserRenderingStats browser_rendering_stats_; | 723 BrowserRenderingStats browser_rendering_stats_; |
713 | 724 |
714 // The latency information for any current non-accelerated-compositing | 725 // The latency information for any current non-accelerated-compositing |
715 // frame. | 726 // frame. |
716 ui::LatencyInfo latency_info_; | 727 ui::LatencyInfo latency_info_; |
717 | 728 |
718 uint32 next_output_surface_id_; | 729 uint32 next_output_surface_id_; |
719 | 730 |
| 731 #if defined(OS_ANDROID) |
| 732 // A counter for number of outstanding messages from the renderer to the |
| 733 // browser regarding IME-type events that have not been acknowledged by the |
| 734 // browser. If this value is not 0 IME events will be dropped. |
| 735 int outstanding_ime_acks_; |
| 736 #endif |
| 737 |
720 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; | 738 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
721 | 739 |
722 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 740 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
723 }; | 741 }; |
724 | 742 |
725 } // namespace content | 743 } // namespace content |
726 | 744 |
727 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 745 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |