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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 { | 202 enum ShowIme { |
203 DO_NOT_SHOW_IME, | 203 DO_NOT_SHOW_IME, |
204 SHOW_IME_IF_NEEDED | 204 SHOW_IME_IF_NEEDED |
205 }; | 205 }; |
206 | 206 |
207 enum ImeAck { | |
208 SEND_IME_ACK, | |
209 NO_IME_ACK | |
jam
2013/07/31 20:57:09
i realize this is the convention in blink, but in
nyquist
2013/08/01 23:11:04
Done.
| |
210 }; | |
211 | |
207 // Handle common setup/teardown for handling IME events. | 212 // Handle common setup/teardown for handling IME events. |
208 void StartHandlingImeEvent(); | 213 void StartHandlingImeEvent(); |
209 void FinishHandlingImeEvent(); | 214 void FinishHandlingImeEvent(); |
210 | 215 |
211 virtual void InstrumentWillBeginFrame() {} | 216 virtual void InstrumentWillBeginFrame() {} |
212 virtual void InstrumentDidBeginFrame() {} | 217 virtual void InstrumentDidBeginFrame() {} |
213 virtual void InstrumentDidCancelFrame() {} | 218 virtual void InstrumentDidCancelFrame() {} |
214 virtual void InstrumentWillComposite() {} | 219 virtual void InstrumentWillComposite() {} |
215 | 220 |
216 virtual bool AllowPartialSwap() const; | 221 virtual bool AllowPartialSwap() const; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 const gfx::Size& desired_size); | 324 const gfx::Size& desired_size); |
320 void OnRepaint(gfx::Size size_to_paint); | 325 void OnRepaint(gfx::Size size_to_paint); |
321 void OnSmoothScrollCompleted(); | 326 void OnSmoothScrollCompleted(); |
322 void OnSetTextDirection(WebKit::WebTextDirection direction); | 327 void OnSetTextDirection(WebKit::WebTextDirection direction); |
323 void OnGetFPS(); | 328 void OnGetFPS(); |
324 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, | 329 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, |
325 const gfx::Rect& window_screen_rect); | 330 const gfx::Rect& window_screen_rect); |
326 #if defined(OS_ANDROID) | 331 #if defined(OS_ANDROID) |
327 void OnImeBatchStateChanged(bool is_begin); | 332 void OnImeBatchStateChanged(bool is_begin); |
328 void OnShowImeIfNeeded(); | 333 void OnShowImeIfNeeded(); |
334 | |
335 // Whenever an IME event that needs an acknowledgement is sent to the browser, | |
336 // the number of outstanding IME events that needs acknowledgement should be | |
337 // incremented. All IME events will be dropped until we receive an ack from | |
338 // the browser. | |
339 void IncrementOutstandingImeEventAcks(); | |
340 | |
341 // Called by the browser process for every required IME acknowledgement. | |
342 void OnImeEventAck(); | |
329 #endif | 343 #endif |
344 // Returns whether we currently should handle an IME event. | |
345 bool ShouldHandleImeEvent(); | |
346 | |
330 void OnSnapshot(const gfx::Rect& src_subrect); | 347 void OnSnapshot(const gfx::Rect& src_subrect); |
331 void OnSetBrowserRenderingStats(const BrowserRenderingStats& stats); | 348 void OnSetBrowserRenderingStats(const BrowserRenderingStats& stats); |
332 | 349 |
333 // Notify the compositor about a change in viewport size. This should be | 350 // Notify the compositor about a change in viewport size. This should be |
334 // used only with auto resize mode WebWidgets, as normal WebWidgets should | 351 // used only with auto resize mode WebWidgets, as normal WebWidgets should |
335 // go through OnResize. | 352 // go through OnResize. |
336 void AutoResizeCompositor(); | 353 void AutoResizeCompositor(); |
337 | 354 |
338 virtual void SetDeviceScaleFactor(float device_scale_factor); | 355 virtual void SetDeviceScaleFactor(float device_scale_factor); |
339 | 356 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 void set_next_paint_is_restore_ack(); | 418 void set_next_paint_is_restore_ack(); |
402 void set_next_paint_is_repaint_ack(); | 419 void set_next_paint_is_repaint_ack(); |
403 | 420 |
404 // Checks if the text input state and compose inline mode have been changed. | 421 // 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. | 422 // If they are changed, the new value will be sent to the browser process. |
406 void UpdateTextInputType(); | 423 void UpdateTextInputType(); |
407 | 424 |
408 #if defined(OS_ANDROID) | 425 #if defined(OS_ANDROID) |
409 // |show_ime_if_needed| should be SHOW_IME_IF_NEEDED iff the update may cause | 426 // |show_ime_if_needed| should be SHOW_IME_IF_NEEDED iff the update may cause |
410 // the ime to be displayed, e.g. after a tap on an input field on mobile. | 427 // the ime to be displayed, e.g. after a tap on an input field on mobile. |
411 void UpdateTextInputState(ShowIme show_ime); | 428 void UpdateTextInputState(ShowIme show_ime, ImeAck ack); |
412 #endif | 429 #endif |
413 | 430 |
414 // Checks if the selection bounds have been changed. If they are changed, | 431 // Checks if the selection bounds have been changed. If they are changed, |
415 // the new value will be sent to the browser process. | 432 // the new value will be sent to the browser process. |
416 virtual void UpdateSelectionBounds(); | 433 virtual void UpdateSelectionBounds(); |
417 | 434 |
418 // Override point to obtain that the current input method state and caret | 435 // Override point to obtain that the current input method state and caret |
419 // position. | 436 // position. |
420 virtual ui::TextInputType GetTextInputType(); | 437 virtual ui::TextInputType GetTextInputType(); |
421 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end); | 438 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 | 727 // The last set of rendering stats received from the browser. This is only |
711 // received when using the --enable-gpu-benchmarking flag. | 728 // received when using the --enable-gpu-benchmarking flag. |
712 BrowserRenderingStats browser_rendering_stats_; | 729 BrowserRenderingStats browser_rendering_stats_; |
713 | 730 |
714 // The latency information for any current non-accelerated-compositing | 731 // The latency information for any current non-accelerated-compositing |
715 // frame. | 732 // frame. |
716 ui::LatencyInfo latency_info_; | 733 ui::LatencyInfo latency_info_; |
717 | 734 |
718 uint32 next_output_surface_id_; | 735 uint32 next_output_surface_id_; |
719 | 736 |
737 #if defined(OS_ANDROID) | |
738 // A counter for number of outstanding messages from the renderer to the | |
739 // browser regarding IME-type events that have not been acknowledged by the | |
740 // browser. If this value is not 0 IME events will be dropped. | |
741 int outstanding_ime_acks_; | |
742 #endif | |
743 | |
720 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; | 744 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
721 | 745 |
722 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 746 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
723 }; | 747 }; |
724 | 748 |
725 } // namespace content | 749 } // namespace content |
726 | 750 |
727 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 751 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |