Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 34 #include "ui/gfx/display.h" | 34 #include "ui/gfx/display.h" |
| 35 #include "ui/gfx/geometry/rect.h" | 35 #include "ui/gfx/geometry/rect.h" |
| 36 #include "ui/gfx/native_widget_types.h" | 36 #include "ui/gfx/native_widget_types.h" |
| 37 #include "ui/gfx/range/range.h" | 37 #include "ui/gfx/range/range.h" |
| 38 #include "ui/surface/transport_dib.h" | 38 #include "ui/surface/transport_dib.h" |
| 39 | 39 |
| 40 class SkBitmap; | 40 class SkBitmap; |
| 41 | 41 |
| 42 struct AccessibilityHostMsg_EventParams; | 42 struct AccessibilityHostMsg_EventParams; |
| 43 struct ViewHostMsg_SelectionBounds_Params; | 43 struct ViewHostMsg_SelectionBounds_Params; |
| 44 struct ViewHostMsg_TextInputState_Params; | 44 struct TextInputState; |
| 45 | 45 |
| 46 namespace media { | 46 namespace media { |
| 47 class VideoFrame; | 47 class VideoFrame; |
| 48 } | 48 } |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| 51 struct WebScreenInfo; | 51 struct WebScreenInfo; |
| 52 class WebMouseEvent; | 52 class WebMouseEvent; |
| 53 class WebMouseWheelEvent; | 53 class WebMouseWheelEvent; |
| 54 } | 54 } |
| 55 | 55 |
| 56 namespace cc { | 56 namespace cc { |
| 57 class SurfaceHittestDelegate; | 57 class SurfaceHittestDelegate; |
| 58 } | 58 } |
| 59 | 59 |
| 60 namespace ui { | 60 namespace ui { |
| 61 class LatencyInfo; | 61 class LatencyInfo; |
| 62 } | 62 } |
| 63 | 63 |
| 64 namespace content { | 64 namespace content { |
| 65 class BrowserAccessibilityDelegate; | 65 class BrowserAccessibilityDelegate; |
| 66 class BrowserAccessibilityManager; | 66 class BrowserAccessibilityManager; |
| 67 class RenderWidgetHostViewBaseObserver; | 67 class RenderWidgetHostViewBaseObserver; |
| 68 class SyntheticGesture; | 68 class SyntheticGesture; |
| 69 class SyntheticGestureTarget; | 69 class SyntheticGestureTarget; |
| 70 class WebCursor; | 70 class WebCursor; |
| 71 struct DidOverscrollParams; | 71 struct DidOverscrollParams; |
| 72 struct NativeWebKeyboardEvent; | 72 struct NativeWebKeyboardEvent; |
| 73 struct TextInputState; | |
| 73 struct WebPluginGeometry; | 74 struct WebPluginGeometry; |
| 74 | 75 |
| 75 // Basic implementation shared by concrete RenderWidgetHostView subclasses. | 76 // Basic implementation shared by concrete RenderWidgetHostView subclasses. |
| 76 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, | 77 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
| 77 public IPC::Listener { | 78 public IPC::Listener { |
| 78 public: | 79 public: |
| 79 ~RenderWidgetHostViewBase() override; | 80 ~RenderWidgetHostViewBase() override; |
| 80 | 81 |
| 81 float current_device_scale_factor() const { | 82 float current_device_scale_factor() const { |
| 82 return current_device_scale_factor_; | 83 return current_device_scale_factor_; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 // the renderer. | 121 // the renderer. |
| 121 void DidReceiveRendererFrame(); | 122 void DidReceiveRendererFrame(); |
| 122 | 123 |
| 123 // Notification that a resize or move session ended on the native widget. | 124 // Notification that a resize or move session ended on the native widget. |
| 124 void UpdateScreenInfo(gfx::NativeView view); | 125 void UpdateScreenInfo(gfx::NativeView view); |
| 125 | 126 |
| 126 // Tells if the display property (work area/scale factor) has | 127 // Tells if the display property (work area/scale factor) has |
| 127 // changed since the last time. | 128 // changed since the last time. |
| 128 bool HasDisplayPropertyChanged(gfx::NativeView view); | 129 bool HasDisplayPropertyChanged(gfx::NativeView view); |
| 129 | 130 |
| 131 const TextInputState* text_input_state() const { | |
|
Charlie Reis
2016/03/15 18:32:00
Let's include a comment to give context about when
EhsanK
2016/03/15 23:51:18
Done.
| |
| 132 return text_input_state_.get(); | |
| 133 } | |
| 134 | |
| 130 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); | 135 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); |
| 131 | 136 |
| 132 //---------------------------------------------------------------------------- | 137 //---------------------------------------------------------------------------- |
| 133 // The following methods can be overridden by derived classes. | 138 // The following methods can be overridden by derived classes. |
| 134 | 139 |
| 135 // Notifies the View that the renderer text selection has changed. | 140 // Notifies the View that the renderer text selection has changed. |
| 136 virtual void SelectionChanged(const base::string16& text, | 141 virtual void SelectionChanged(const base::string16& text, |
| 137 size_t offset, | 142 size_t offset, |
| 138 const gfx::Range& range); | 143 const gfx::Range& range); |
| 139 | 144 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 // embedded within the RenderWidgetHostViewBase's Surface to the | 234 // embedded within the RenderWidgetHostViewBase's Surface to the |
| 230 // coordinate space of the embedding Surface. Typically this means that a | 235 // coordinate space of the embedding Surface. Typically this means that a |
| 231 // point was received from an out-of-process iframe's RenderWidget and needs | 236 // point was received from an out-of-process iframe's RenderWidget and needs |
| 232 // to be translated to viewport coordinates for the root RWHV, in which case | 237 // to be translated to viewport coordinates for the root RWHV, in which case |
| 233 // this method is called on the root RWHV with the out-of-process iframe's | 238 // this method is called on the root RWHV with the out-of-process iframe's |
| 234 // SurfaceId. | 239 // SurfaceId. |
| 235 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, | 240 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, |
| 236 cc::SurfaceId original_surface, | 241 cc::SurfaceId original_surface, |
| 237 gfx::Point* transformed_point); | 242 gfx::Point* transformed_point); |
| 238 | 243 |
| 244 // This method is excusively called by the owner RenderWidgetHost to inform | |
| 245 // the view about a change in the input state which originated in the | |
| 246 // corresponding RenderWidget. This state is stored at the RWHV. | |
| 247 // Also, this change does not necessarily reflect the current state of the | |
| 248 // input since the text input could be due to a change in the focused | |
|
Charlie Reis
2016/03/15 18:32:00
nit: Remove extra space.
EhsanK
2016/03/15 23:51:18
Done. Thanks!
| |
| 249 // child-frame's (in OOPIF) or the out of process content managed by | |
| 250 // BrowserPlugin. | |
| 251 // TODO(ekaramad): Make this non-virtual if possible. | |
| 252 virtual void TextInputStateChanged(const TextInputState& params); | |
| 253 | |
| 254 // This method is used by the WebContents owning this view to notify the view | |
| 255 // of a text input change in the tab. This method should not be called on | |
| 256 // RenderWidgetHostViewChildFrame. | |
|
Charlie Reis
2016/03/15 18:32:00
I'm unclear on the last sentence. Would it be cle
EhsanK
2016/03/15 23:51:17
Yes. Revised. Thanks!
| |
| 257 virtual void UpdateInputMethodIfNecessary(bool text_input_state_changed); | |
| 258 | |
| 239 //---------------------------------------------------------------------------- | 259 //---------------------------------------------------------------------------- |
| 240 // The following static methods are implemented by each platform. | 260 // The following static methods are implemented by each platform. |
| 241 | 261 |
| 242 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); | 262 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); |
| 243 | 263 |
| 244 //---------------------------------------------------------------------------- | 264 //---------------------------------------------------------------------------- |
| 245 // The following pure virtual methods are implemented by derived classes. | 265 // The following pure virtual methods are implemented by derived classes. |
| 246 | 266 |
| 247 // Perform all the initialization steps necessary for this object to represent | 267 // Perform all the initialization steps necessary for this object to represent |
| 248 // a popup (such as a <select> dropdown), then shows the popup at |pos|. | 268 // a popup (such as a <select> dropdown), then shows the popup at |pos|. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 259 // |scroll_offset| is the scroll offset of the render view. | 279 // |scroll_offset| is the scroll offset of the render view. |
| 260 virtual void MovePluginWindows( | 280 virtual void MovePluginWindows( |
| 261 const std::vector<WebPluginGeometry>& moves) = 0; | 281 const std::vector<WebPluginGeometry>& moves) = 0; |
| 262 | 282 |
| 263 // Sets the cursor to the one associated with the specified cursor_type | 283 // Sets the cursor to the one associated with the specified cursor_type |
| 264 virtual void UpdateCursor(const WebCursor& cursor) = 0; | 284 virtual void UpdateCursor(const WebCursor& cursor) = 0; |
| 265 | 285 |
| 266 // Indicates whether the page has finished loading. | 286 // Indicates whether the page has finished loading. |
| 267 virtual void SetIsLoading(bool is_loading) = 0; | 287 virtual void SetIsLoading(bool is_loading) = 0; |
| 268 | 288 |
| 269 // Updates the state of the input method attached to the view. | |
| 270 virtual void TextInputStateChanged( | |
| 271 const ViewHostMsg_TextInputState_Params& params) = 0; | |
| 272 | |
| 273 // Cancel the ongoing composition of the input method attached to the view. | 289 // Cancel the ongoing composition of the input method attached to the view. |
| 274 virtual void ImeCancelComposition() = 0; | 290 virtual void ImeCancelComposition() = 0; |
| 275 | 291 |
| 276 // Notifies the View that the renderer has ceased to exist. | 292 // Notifies the View that the renderer has ceased to exist. |
| 277 virtual void RenderProcessGone(base::TerminationStatus status, | 293 virtual void RenderProcessGone(base::TerminationStatus status, |
| 278 int error_code) = 0; | 294 int error_code) = 0; |
| 279 | 295 |
| 280 // Tells the View to destroy itself. | 296 // Tells the View to destroy itself. |
| 281 virtual void Destroy() = 0; | 297 virtual void Destroy() = 0; |
| 282 | 298 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 // A buffer containing the text inside and around the current selection range. | 459 // A buffer containing the text inside and around the current selection range. |
| 444 base::string16 selection_text_; | 460 base::string16 selection_text_; |
| 445 | 461 |
| 446 // The offset of the text stored in |selection_text_| relative to the start of | 462 // The offset of the text stored in |selection_text_| relative to the start of |
| 447 // the web page. | 463 // the web page. |
| 448 size_t selection_text_offset_; | 464 size_t selection_text_offset_; |
| 449 | 465 |
| 450 // The current selection range relative to the start of the web page. | 466 // The current selection range relative to the start of the web page. |
| 451 gfx::Range selection_range_; | 467 gfx::Range selection_range_; |
| 452 | 468 |
| 453 protected: | |
| 454 // The scale factor of the display the renderer is currently on. | 469 // The scale factor of the display the renderer is currently on. |
| 455 float current_device_scale_factor_; | 470 float current_device_scale_factor_; |
| 456 | 471 |
| 457 // The orientation of the display the renderer is currently on. | 472 // The orientation of the display the renderer is currently on. |
| 458 gfx::Display::Rotation current_display_rotation_; | 473 gfx::Display::Rotation current_display_rotation_; |
| 459 | 474 |
| 460 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the | 475 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the |
| 461 // renderer. | 476 // renderer. |
| 462 bool pinch_zoom_enabled_; | 477 bool pinch_zoom_enabled_; |
| 463 | 478 |
| 464 private: | 479 private: |
| 465 void FlushInput(); | 480 void FlushInput(); |
| 466 | 481 |
| 467 gfx::Rect current_display_area_; | 482 gfx::Rect current_display_area_; |
| 468 | 483 |
| 469 uint32_t renderer_frame_number_; | 484 uint32_t renderer_frame_number_; |
| 470 | 485 |
| 471 base::OneShotTimer flush_input_timer_; | 486 base::OneShotTimer flush_input_timer_; |
| 472 | 487 |
| 473 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; | 488 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; |
| 474 | 489 |
| 490 // The last reported input state by the RenderWidget. | |
| 491 scoped_ptr<TextInputState> text_input_state_; | |
| 492 | |
| 475 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; | 493 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; |
| 476 | 494 |
| 477 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); | 495 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |
| 478 }; | 496 }; |
| 479 | 497 |
| 480 } // namespace content | 498 } // namespace content |
| 481 | 499 |
| 482 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 500 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
| OLD | NEW |