| 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_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "base/process/kill.h" | 21 #include "base/process/kill.h" |
| 22 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
| 23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 24 #include "base/timer/timer.h" | 24 #include "base/timer/timer.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "content/browser/renderer_host/input/input_ack_handler.h" | 26 #include "content/browser/renderer_host/input/input_ack_handler.h" |
| 27 #include "content/browser/renderer_host/input/input_router_client.h" | 27 #include "content/browser/renderer_host/input/input_router_client.h" |
| 28 #include "content/browser/renderer_host/synthetic_gesture_controller.h" | |
| 29 #include "content/common/browser_rendering_stats.h" | 28 #include "content/common/browser_rendering_stats.h" |
| 29 #include "content/common/input/synthetic_gesture_packet.h" |
| 30 #include "content/common/view_message_enums.h" | 30 #include "content/common/view_message_enums.h" |
| 31 #include "content/port/browser/event_with_latency_info.h" | 31 #include "content/port/browser/event_with_latency_info.h" |
| 32 #include "content/port/common/input_event_ack_state.h" | 32 #include "content/port/common/input_event_ack_state.h" |
| 33 #include "content/public/browser/render_widget_host.h" | 33 #include "content/public/browser/render_widget_host.h" |
| 34 #include "content/public/common/page_zoom.h" | 34 #include "content/public/common/page_zoom.h" |
| 35 #include "ipc/ipc_listener.h" | 35 #include "ipc/ipc_listener.h" |
| 36 #include "ui/base/ime/text_input_mode.h" | 36 #include "ui/base/ime/text_input_mode.h" |
| 37 #include "ui/base/ime/text_input_type.h" | 37 #include "ui/base/ime/text_input_type.h" |
| 38 #include "ui/events/latency_info.h" | 38 #include "ui/events/latency_info.h" |
| 39 #include "ui/gfx/native_widget_types.h" | 39 #include "ui/gfx/native_widget_types.h" |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 504 |
| 505 void DetachDelegate(); | 505 void DetachDelegate(); |
| 506 | 506 |
| 507 // Update the renderer's cache of the screen rect of the view and window. | 507 // Update the renderer's cache of the screen rect of the view and window. |
| 508 void SendScreenRects(); | 508 void SendScreenRects(); |
| 509 | 509 |
| 510 OverscrollController* overscroll_controller() const { | 510 OverscrollController* overscroll_controller() const { |
| 511 return overscroll_controller_.get(); | 511 return overscroll_controller_.get(); |
| 512 } | 512 } |
| 513 | 513 |
| 514 base::TimeDelta GetSyntheticGestureMessageInterval() const; | |
| 515 | |
| 516 // Sets whether the overscroll controller should be enabled for this page. | 514 // Sets whether the overscroll controller should be enabled for this page. |
| 517 void SetOverscrollControllerEnabled(bool enabled); | 515 void SetOverscrollControllerEnabled(bool enabled); |
| 518 | 516 |
| 519 // Suppreses future char events until a keydown. See | 517 // Suppreses future char events until a keydown. See |
| 520 // suppress_next_char_events_. | 518 // suppress_next_char_events_. |
| 521 void SuppressNextCharEvents(); | 519 void SuppressNextCharEvents(); |
| 522 | 520 |
| 523 // Called by RenderWidgetHostView in response to OnSetNeedsFlushInput. | 521 // Called by RenderWidgetHostView in response to OnSetNeedsFlushInput. |
| 524 void FlushInput(); | 522 void FlushInput(); |
| 525 | 523 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 void OnPaintAtSizeAck(int tag, const gfx::Size& size); | 651 void OnPaintAtSizeAck(int tag, const gfx::Size& size); |
| 654 #if defined(OS_MACOSX) | 652 #if defined(OS_MACOSX) |
| 655 void OnCompositorSurfaceBuffersSwapped( | 653 void OnCompositorSurfaceBuffersSwapped( |
| 656 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params); | 654 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params); |
| 657 #endif | 655 #endif |
| 658 bool OnSwapCompositorFrame(const IPC::Message& message); | 656 bool OnSwapCompositorFrame(const IPC::Message& message); |
| 659 void OnOverscrolled(gfx::Vector2dF accumulated_overscroll, | 657 void OnOverscrolled(gfx::Vector2dF accumulated_overscroll, |
| 660 gfx::Vector2dF current_fling_velocity); | 658 gfx::Vector2dF current_fling_velocity); |
| 661 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); | 659 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); |
| 662 void OnUpdateIsDelayed(); | 660 void OnUpdateIsDelayed(); |
| 663 void OnBeginSmoothScroll( | 661 void OnQueueSyntheticGesture(const SyntheticGesturePacket& gesture_packet); |
| 664 const ViewHostMsg_BeginSmoothScroll_Params& params); | |
| 665 void OnBeginPinch( | |
| 666 const ViewHostMsg_BeginPinch_Params& params); | |
| 667 virtual void OnFocus(); | 662 virtual void OnFocus(); |
| 668 virtual void OnBlur(); | 663 virtual void OnBlur(); |
| 669 void OnSetCursor(const WebCursor& cursor); | 664 void OnSetCursor(const WebCursor& cursor); |
| 670 void OnTextInputTypeChanged(ui::TextInputType type, | 665 void OnTextInputTypeChanged(ui::TextInputType type, |
| 671 ui::TextInputMode input_mode, | 666 ui::TextInputMode input_mode, |
| 672 bool can_compose_inline); | 667 bool can_compose_inline); |
| 673 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) | 668 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) |
| 674 void OnImeCompositionRangeChanged( | 669 void OnImeCompositionRangeChanged( |
| 675 const gfx::Range& range, | 670 const gfx::Range& range, |
| 676 const std::vector<gfx::Rect>& character_bounds); | 671 const std::vector<gfx::Rect>& character_bounds); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 bool pending_mouse_lock_request_; | 891 bool pending_mouse_lock_request_; |
| 897 bool allow_privileged_mouse_lock_; | 892 bool allow_privileged_mouse_lock_; |
| 898 | 893 |
| 899 // Keeps track of whether the webpage has any touch event handler. If it does, | 894 // Keeps track of whether the webpage has any touch event handler. If it does, |
| 900 // then touch events are sent to the renderer. Otherwise, the touch events are | 895 // then touch events are sent to the renderer. Otherwise, the touch events are |
| 901 // not sent to the renderer. | 896 // not sent to the renderer. |
| 902 bool has_touch_handler_; | 897 bool has_touch_handler_; |
| 903 | 898 |
| 904 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; | 899 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; |
| 905 | 900 |
| 906 SyntheticGestureController synthetic_gesture_controller_; | 901 scoped_ptr<SyntheticGestureController> synthetic_gesture_controller_; |
| 907 | 902 |
| 908 // Receives and handles all input events. | 903 // Receives and handles all input events. |
| 909 scoped_ptr<InputRouter> input_router_; | 904 scoped_ptr<InputRouter> input_router_; |
| 910 | 905 |
| 911 scoped_ptr<OverscrollController> overscroll_controller_; | 906 scoped_ptr<OverscrollController> overscroll_controller_; |
| 912 | 907 |
| 913 #if defined(OS_WIN) | 908 #if defined(OS_WIN) |
| 914 std::list<HWND> dummy_windows_for_activation_; | 909 std::list<HWND> dummy_windows_for_activation_; |
| 915 #endif | 910 #endif |
| 916 | 911 |
| 917 // List of callbacks for pending snapshot requests to the renderer. | 912 // List of callbacks for pending snapshot requests to the renderer. |
| 918 std::queue<base::Callback<void(bool, const SkBitmap&)> > pending_snapshots_; | 913 std::queue<base::Callback<void(bool, const SkBitmap&)> > pending_snapshots_; |
| 919 | 914 |
| 920 int64 last_input_number_; | 915 int64 last_input_number_; |
| 921 | 916 |
| 922 BrowserRenderingStats rendering_stats_; | 917 BrowserRenderingStats rendering_stats_; |
| 923 | 918 |
| 924 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 919 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
| 925 }; | 920 }; |
| 926 | 921 |
| 927 } // namespace content | 922 } // namespace content |
| 928 | 923 |
| 929 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 924 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| OLD | NEW |