| 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 "cc/resources/shared_bitmap.h" | 26 #include "cc/resources/shared_bitmap.h" |
| 27 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 27 #include "content/browser/renderer_host/input/input_ack_handler.h" | 28 #include "content/browser/renderer_host/input/input_ack_handler.h" |
| 28 #include "content/browser/renderer_host/input/input_router_client.h" | 29 #include "content/browser/renderer_host/input/input_router_client.h" |
| 29 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 30 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| 30 #include "content/browser/renderer_host/input/touch_emulator_client.h" | 31 #include "content/browser/renderer_host/input/touch_emulator_client.h" |
| 31 #include "content/common/input/synthetic_gesture_packet.h" | 32 #include "content/common/input/synthetic_gesture_packet.h" |
| 32 #include "content/common/view_message_enums.h" | 33 #include "content/common/view_message_enums.h" |
| 33 #include "content/port/browser/event_with_latency_info.h" | 34 #include "content/port/browser/event_with_latency_info.h" |
| 34 #include "content/port/common/input_event_ack_state.h" | 35 #include "content/port/common/input_event_ack_state.h" |
| 35 #include "content/public/browser/render_widget_host.h" | 36 #include "content/public/browser/render_widget_host.h" |
| 36 #include "content/public/common/page_zoom.h" | 37 #include "content/public/common/page_zoom.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 class RenderWidgetHostDelegate; | 85 class RenderWidgetHostDelegate; |
| 85 class RenderWidgetHostViewPort; | 86 class RenderWidgetHostViewPort; |
| 86 class SyntheticGestureController; | 87 class SyntheticGestureController; |
| 87 class TimeoutMonitor; | 88 class TimeoutMonitor; |
| 88 class TouchEmulator; | 89 class TouchEmulator; |
| 89 class WebCursor; | 90 class WebCursor; |
| 90 struct EditCommand; | 91 struct EditCommand; |
| 91 | 92 |
| 92 // This implements the RenderWidgetHost interface that is exposed to | 93 // This implements the RenderWidgetHost interface that is exposed to |
| 93 // embedders of content, and adds things only visible to content. | 94 // embedders of content, and adds things only visible to content. |
| 94 class CONTENT_EXPORT RenderWidgetHostImpl : virtual public RenderWidgetHost, | 95 class CONTENT_EXPORT RenderWidgetHostImpl |
| 95 public InputRouterClient, | 96 : virtual public RenderWidgetHost, |
| 96 public InputAckHandler, | 97 public InputRouterClient, |
| 97 public TouchEmulatorClient, | 98 public InputAckHandler, |
| 98 public IPC::Listener { | 99 public TouchEmulatorClient, |
| 100 public IPC::Listener, |
| 101 public BrowserAccessibilityDelegate { |
| 99 public: | 102 public: |
| 100 // routing_id can be MSG_ROUTING_NONE, in which case the next available | 103 // routing_id can be MSG_ROUTING_NONE, in which case the next available |
| 101 // routing id is taken from the RenderProcessHost. | 104 // routing id is taken from the RenderProcessHost. |
| 102 // If this object outlives |delegate|, DetachDelegate() must be called when | 105 // If this object outlives |delegate|, DetachDelegate() must be called when |
| 103 // |delegate| goes away. | 106 // |delegate| goes away. |
| 104 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, | 107 RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, |
| 105 RenderProcessHost* process, | 108 RenderProcessHost* process, |
| 106 int routing_id, | 109 int routing_id, |
| 107 bool hidden); | 110 bool hidden); |
| 108 virtual ~RenderWidgetHostImpl(); | 111 virtual ~RenderWidgetHostImpl(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 virtual void RemoveKeyPressEventCallback( | 169 virtual void RemoveKeyPressEventCallback( |
| 167 const KeyPressEventCallback& callback) OVERRIDE; | 170 const KeyPressEventCallback& callback) OVERRIDE; |
| 168 virtual void AddMouseEventCallback( | 171 virtual void AddMouseEventCallback( |
| 169 const MouseEventCallback& callback) OVERRIDE; | 172 const MouseEventCallback& callback) OVERRIDE; |
| 170 virtual void RemoveMouseEventCallback( | 173 virtual void RemoveMouseEventCallback( |
| 171 const MouseEventCallback& callback) OVERRIDE; | 174 const MouseEventCallback& callback) OVERRIDE; |
| 172 virtual void GetWebScreenInfo(blink::WebScreenInfo* result) OVERRIDE; | 175 virtual void GetWebScreenInfo(blink::WebScreenInfo* result) OVERRIDE; |
| 173 | 176 |
| 174 virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; | 177 virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; |
| 175 | 178 |
| 176 virtual void AccessibilityDoDefaultAction(int object_id) OVERRIDE; | 179 // BrowserAccessibilityDelegate |
| 177 virtual void AccessibilitySetFocus(int object_id) OVERRIDE; | 180 virtual void AccessibilitySetFocus(int acc_obj_id) OVERRIDE; |
| 181 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE; |
| 182 virtual void AccessibilityShowMenu(int acc_obj_id) OVERRIDE; |
| 178 virtual void AccessibilityScrollToMakeVisible( | 183 virtual void AccessibilityScrollToMakeVisible( |
| 179 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; | 184 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; |
| 180 virtual void AccessibilityScrollToPoint( | 185 virtual void AccessibilityScrollToPoint( |
| 181 int acc_obj_id, gfx::Point point) OVERRIDE; | 186 int acc_obj_id, gfx::Point point) OVERRIDE; |
| 182 virtual void AccessibilitySetTextSelection( | 187 virtual void AccessibilitySetTextSelection( |
| 183 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; | 188 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; |
| 189 virtual bool AccessibilityViewHasFocus() const OVERRIDE; |
| 190 virtual gfx::Rect AccessibilityGetViewBounds() const OVERRIDE; |
| 191 virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) |
| 192 const OVERRIDE; |
| 193 virtual void AccessibilityFatalError() OVERRIDE; |
| 184 | 194 |
| 185 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const; | 195 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const; |
| 186 | 196 |
| 187 // Notification that the screen info has changed. | 197 // Notification that the screen info has changed. |
| 188 void NotifyScreenInfoChanged(); | 198 void NotifyScreenInfoChanged(); |
| 189 | 199 |
| 190 // Invalidates the cached screen info so that next resize request | 200 // Invalidates the cached screen info so that next resize request |
| 191 // will carry the up to date screen info. Unlike | 201 // will carry the up to date screen info. Unlike |
| 192 // |NotifyScreenInfoChanged|, this doesn't send a message to the renderer. | 202 // |NotifyScreenInfoChanged|, this doesn't send a message to the renderer. |
| 193 void InvalidateScreenInfo(); | 203 void InvalidateScreenInfo(); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // Removes the given accessibility mode from the current accessibility mode | 403 // Removes the given accessibility mode from the current accessibility mode |
| 394 // bitmap, managing the bits that are shared with other modes such that a | 404 // bitmap, managing the bits that are shared with other modes such that a |
| 395 // bit will only be turned off when all modes that depend on it have been | 405 // bit will only be turned off when all modes that depend on it have been |
| 396 // removed. | 406 // removed. |
| 397 void RemoveAccessibilityMode(AccessibilityMode mode); | 407 void RemoveAccessibilityMode(AccessibilityMode mode); |
| 398 | 408 |
| 399 // Resets the accessibility mode to the default setting in | 409 // Resets the accessibility mode to the default setting in |
| 400 // BrowserStateAccessibilityImpl. | 410 // BrowserStateAccessibilityImpl. |
| 401 void ResetAccessibilityMode(); | 411 void ResetAccessibilityMode(); |
| 402 | 412 |
| 403 // Kill the renderer because we got a fatal accessibility error. | |
| 404 void FatalAccessibilityTreeError(); | |
| 405 | |
| 406 #if defined(OS_WIN) | 413 #if defined(OS_WIN) |
| 407 void SetParentNativeViewAccessible( | 414 void SetParentNativeViewAccessible( |
| 408 gfx::NativeViewAccessible accessible_parent); | 415 gfx::NativeViewAccessible accessible_parent); |
| 409 gfx::NativeViewAccessible GetParentNativeViewAccessible() const; | 416 gfx::NativeViewAccessible GetParentNativeViewAccessible() const; |
| 410 #endif | 417 #endif |
| 411 | 418 |
| 412 // Executes the edit command on the RenderView. | 419 // Executes the edit command on the RenderView. |
| 413 void ExecuteEditCommand(const std::string& command, | 420 void ExecuteEditCommand(const std::string& command, |
| 414 const std::string& value); | 421 const std::string& value); |
| 415 | 422 |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 #endif | 889 #endif |
| 883 | 890 |
| 884 int64 last_input_number_; | 891 int64 last_input_number_; |
| 885 | 892 |
| 886 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); | 893 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); |
| 887 }; | 894 }; |
| 888 | 895 |
| 889 } // namespace content | 896 } // namespace content |
| 890 | 897 |
| 891 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ | 898 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ |
| OLD | NEW |