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_VIEW_BASE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 class SurfaceHittestDelegate; | 55 class SurfaceHittestDelegate; |
56 } | 56 } |
57 | 57 |
58 namespace ui { | 58 namespace ui { |
59 class LatencyInfo; | 59 class LatencyInfo; |
60 } | 60 } |
61 | 61 |
62 namespace content { | 62 namespace content { |
63 class BrowserAccessibilityDelegate; | 63 class BrowserAccessibilityDelegate; |
64 class BrowserAccessibilityManager; | 64 class BrowserAccessibilityManager; |
65 class RenderFrameHostImpl; | |
65 class SyntheticGesture; | 66 class SyntheticGesture; |
66 class SyntheticGestureTarget; | 67 class SyntheticGestureTarget; |
67 class WebCursor; | 68 class WebCursor; |
68 struct DidOverscrollParams; | 69 struct DidOverscrollParams; |
69 struct NativeWebKeyboardEvent; | 70 struct NativeWebKeyboardEvent; |
70 struct WebPluginGeometry; | 71 struct WebPluginGeometry; |
71 | 72 |
73 using TextInputState = ViewHostMsg_TextInputState_Params; | |
Charlie Reis
2016/02/17 06:22:14
In cases that params are used widely, we tend to g
EhsanK
2016/02/18 05:48:01
Done. Hopefully I got it right.
| |
74 | |
72 // Basic implementation shared by concrete RenderWidgetHostView subclasses. | 75 // Basic implementation shared by concrete RenderWidgetHostView subclasses. |
73 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, | 76 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
74 public IPC::Listener { | 77 public IPC::Listener { |
75 public: | 78 public: |
76 ~RenderWidgetHostViewBase() override; | 79 ~RenderWidgetHostViewBase() override; |
77 | 80 |
78 float current_device_scale_factor() const { | 81 float current_device_scale_factor() const { |
79 return current_device_scale_factor_; | 82 return current_device_scale_factor_; |
80 } | 83 } |
81 | 84 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 // the renderer. | 120 // the renderer. |
118 void DidReceiveRendererFrame(); | 121 void DidReceiveRendererFrame(); |
119 | 122 |
120 // Notification that a resize or move session ended on the native widget. | 123 // Notification that a resize or move session ended on the native widget. |
121 void UpdateScreenInfo(gfx::NativeView view); | 124 void UpdateScreenInfo(gfx::NativeView view); |
122 | 125 |
123 // Tells if the display property (work area/scale factor) has | 126 // Tells if the display property (work area/scale factor) has |
124 // changed since the last time. | 127 // changed since the last time. |
125 bool HasDisplayPropertyChanged(gfx::NativeView view); | 128 bool HasDisplayPropertyChanged(gfx::NativeView view); |
126 | 129 |
130 // The current cached text input state which might be different from | |
131 // text_input_state_ if the view is for a main frame. | |
Charlie Reis
2016/02/17 06:22:14
I'm confused. Why would these two differ for the
EhsanK
2016/02/18 05:48:01
|text_input_state_| : the text input state corresp
| |
132 const TextInputState* current_text_input_state() const { | |
133 return cached_text_input_state_; | |
134 } | |
135 | |
127 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); | 136 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); |
128 | 137 |
129 //---------------------------------------------------------------------------- | 138 //---------------------------------------------------------------------------- |
130 // The following methods can be overridden by derived classes. | 139 // The following methods can be overridden by derived classes. |
131 | 140 |
132 // Notifies the View that the renderer text selection has changed. | 141 // Notifies the View that the renderer text selection has changed. |
133 virtual void SelectionChanged(const base::string16& text, | 142 virtual void SelectionChanged(const base::string16& text, |
134 size_t offset, | 143 size_t offset, |
135 const gfx::Range& range); | 144 const gfx::Range& range); |
136 | 145 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 | 180 |
172 // Create a BrowserAccessibilityManager for this view. | 181 // Create a BrowserAccessibilityManager for this view. |
173 virtual BrowserAccessibilityManager* CreateBrowserAccessibilityManager( | 182 virtual BrowserAccessibilityManager* CreateBrowserAccessibilityManager( |
174 BrowserAccessibilityDelegate* delegate); | 183 BrowserAccessibilityDelegate* delegate); |
175 | 184 |
176 virtual void AccessibilityShowMenu(const gfx::Point& point); | 185 virtual void AccessibilityShowMenu(const gfx::Point& point); |
177 virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds); | 186 virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds); |
178 virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget(); | 187 virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget(); |
179 virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible(); | 188 virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible(); |
180 | 189 |
181 // Informs that the focused DOM node has changed. | 190 // Informs that the DOM node has changed. |
Charlie Reis
2016/02/17 06:22:14
This doesn't seem like a good change to the commen
EhsanK
2016/02/18 05:48:01
Hmmm. I do not have any recollection of changing t
| |
182 virtual void FocusedNodeChanged(bool is_editable_node) {} | 191 virtual void FocusedNodeChanged(bool is_editable_node) {} |
183 | 192 |
184 virtual void OnSwapCompositorFrame(uint32_t output_surface_id, | 193 virtual void OnSwapCompositorFrame(uint32_t output_surface_id, |
185 scoped_ptr<cc::CompositorFrame> frame) {} | 194 scoped_ptr<cc::CompositorFrame> frame) {} |
186 | 195 |
187 // This method exists to allow removing of displayed graphics, after a new | 196 // This method exists to allow removing of displayed graphics, after a new |
188 // page has been loaded, to prevent the displayed URL from being out of sync | 197 // page has been loaded, to prevent the displayed URL from being out of sync |
189 // with what is visible on screen. | 198 // with what is visible on screen. |
190 virtual void ClearCompositorFrame() = 0; | 199 virtual void ClearCompositorFrame() = 0; |
191 | 200 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 // embedded within the RenderWidgetHostViewBase's Surface to the | 233 // embedded within the RenderWidgetHostViewBase's Surface to the |
225 // coordinate space of the embedding Surface. Typically this means that a | 234 // coordinate space of the embedding Surface. Typically this means that a |
226 // point was received from an out-of-process iframe's RenderWidget and needs | 235 // point was received from an out-of-process iframe's RenderWidget and needs |
227 // to be translated to viewport coordinates for the root RWHV, in which case | 236 // to be translated to viewport coordinates for the root RWHV, in which case |
228 // this method is called on the root RWHV with the out-of-process iframe's | 237 // this method is called on the root RWHV with the out-of-process iframe's |
229 // SurfaceId. | 238 // SurfaceId. |
230 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, | 239 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, |
231 cc::SurfaceId original_surface, | 240 cc::SurfaceId original_surface, |
232 gfx::Point* transformed_point); | 241 gfx::Point* transformed_point); |
233 | 242 |
243 // This method is excusively called by the owner RenderWidgetHost to inform | |
244 // the view about a change in the input state which originated in the | |
245 // corresponding RenderWidget. This state is stored at the RWHV. | |
246 // Also, this change does not necessarily reflect the current state the input | |
Charlie Reis
2016/02/17 06:22:14
Typo? (the current state the input state)
EhsanK
2016/02/18 05:48:01
Done.
| |
247 // state could be due to a change in the focused child-frame's (in OOPIF) or | |
248 // out of process content managed by BrowserPlugin. | |
249 // TODO(ekaramad): Make this non-virtual if possible. | |
250 virtual void TextInputStateChanged( | |
251 const ViewHostMsg_TextInputState_Params& params); | |
252 | |
253 // Notifies the top level RenderWidgetHostView or the corresponding | |
254 // ui::InputMethod of a change in text input state in either this RWHV or one | |
255 // of the child frame's RWHV. | |
256 virtual void UpdateTextInputState(); | |
257 | |
234 //---------------------------------------------------------------------------- | 258 //---------------------------------------------------------------------------- |
235 // The following static methods are implemented by each platform. | 259 // The following static methods are implemented by each platform. |
236 | 260 |
237 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); | 261 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); |
238 | 262 |
239 //---------------------------------------------------------------------------- | 263 //---------------------------------------------------------------------------- |
240 // The following pure virtual methods are implemented by derived classes. | 264 // The following pure virtual methods are implemented by derived classes. |
241 | 265 |
242 // Perform all the initialization steps necessary for this object to represent | 266 // Perform all the initialization steps necessary for this object to represent |
243 // a popup (such as a <select> dropdown), then shows the popup at |pos|. | 267 // a popup (such as a <select> dropdown), then shows the popup at |pos|. |
(...skipping 10 matching lines...) Expand all Loading... | |
254 // |scroll_offset| is the scroll offset of the render view. | 278 // |scroll_offset| is the scroll offset of the render view. |
255 virtual void MovePluginWindows( | 279 virtual void MovePluginWindows( |
256 const std::vector<WebPluginGeometry>& moves) = 0; | 280 const std::vector<WebPluginGeometry>& moves) = 0; |
257 | 281 |
258 // Sets the cursor to the one associated with the specified cursor_type | 282 // Sets the cursor to the one associated with the specified cursor_type |
259 virtual void UpdateCursor(const WebCursor& cursor) = 0; | 283 virtual void UpdateCursor(const WebCursor& cursor) = 0; |
260 | 284 |
261 // Indicates whether the page has finished loading. | 285 // Indicates whether the page has finished loading. |
262 virtual void SetIsLoading(bool is_loading) = 0; | 286 virtual void SetIsLoading(bool is_loading) = 0; |
263 | 287 |
264 // Updates the state of the input method attached to the view. | |
265 virtual void TextInputStateChanged( | |
266 const ViewHostMsg_TextInputState_Params& params) = 0; | |
267 | |
268 // Cancel the ongoing composition of the input method attached to the view. | 288 // Cancel the ongoing composition of the input method attached to the view. |
269 virtual void ImeCancelComposition() = 0; | 289 virtual void ImeCancelComposition() = 0; |
270 | 290 |
271 // Notifies the View that the renderer has ceased to exist. | 291 // Notifies the View that the renderer has ceased to exist. |
272 virtual void RenderProcessGone(base::TerminationStatus status, | 292 virtual void RenderProcessGone(base::TerminationStatus status, |
273 int error_code) = 0; | 293 int error_code) = 0; |
274 | 294 |
275 // Tells the View to destroy itself. | 295 // Tells the View to destroy itself. |
276 virtual void Destroy() = 0; | 296 virtual void Destroy() = 0; |
277 | 297 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 // A buffer containing the text inside and around the current selection range. | 447 // A buffer containing the text inside and around the current selection range. |
428 base::string16 selection_text_; | 448 base::string16 selection_text_; |
429 | 449 |
430 // The offset of the text stored in |selection_text_| relative to the start of | 450 // The offset of the text stored in |selection_text_| relative to the start of |
431 // the web page. | 451 // the web page. |
432 size_t selection_text_offset_; | 452 size_t selection_text_offset_; |
433 | 453 |
434 // The current selection range relative to the start of the web page. | 454 // The current selection range relative to the start of the web page. |
435 gfx::Range selection_range_; | 455 gfx::Range selection_range_; |
436 | 456 |
437 protected: | |
438 // The scale factor of the display the renderer is currently on. | 457 // The scale factor of the display the renderer is currently on. |
439 float current_device_scale_factor_; | 458 float current_device_scale_factor_; |
440 | 459 |
441 // The orientation of the display the renderer is currently on. | 460 // The orientation of the display the renderer is currently on. |
442 gfx::Display::Rotation current_display_rotation_; | 461 gfx::Display::Rotation current_display_rotation_; |
443 | 462 |
444 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the | 463 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the |
445 // renderer. | 464 // renderer. |
446 bool pinch_zoom_enabled_; | 465 bool pinch_zoom_enabled_; |
447 | 466 |
448 private: | 467 private: |
449 void FlushInput(); | 468 void FlushInput(); |
450 | 469 |
470 // Returns the current text input state from all text input elements in this | |
471 // view or one of the child frame views. | |
472 const TextInputState* FindCurrentTextInputState(); | |
473 | |
451 gfx::Rect current_display_area_; | 474 gfx::Rect current_display_area_; |
452 | 475 |
453 uint32_t renderer_frame_number_; | 476 uint32_t renderer_frame_number_; |
454 | 477 |
455 base::OneShotTimer flush_input_timer_; | 478 base::OneShotTimer flush_input_timer_; |
456 | 479 |
480 // The last reported input state from the RenderWidgetHost. | |
481 scoped_ptr<TextInputState> text_input_state_; | |
482 | |
483 // The current cached value of input state which could be obtained from | |
484 // another RWHV. | |
485 const TextInputState* cached_text_input_state_; | |
486 | |
457 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; | 487 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; |
458 | 488 |
459 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); | 489 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |
460 }; | 490 }; |
461 | 491 |
462 } // namespace content | 492 } // namespace content |
463 | 493 |
464 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 494 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
OLD | NEW |