| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 namespace ui { | 59 namespace ui { |
| 60 class LatencyInfo; | 60 class LatencyInfo; |
| 61 } | 61 } |
| 62 | 62 |
| 63 namespace content { | 63 namespace content { |
| 64 class BrowserAccessibilityDelegate; | 64 class BrowserAccessibilityDelegate; |
| 65 class BrowserAccessibilityManager; | 65 class BrowserAccessibilityManager; |
| 66 class RenderWidgetHostViewBaseObserver; | 66 class RenderWidgetHostViewBaseObserver; |
| 67 class SyntheticGesture; | 67 class SyntheticGesture; |
| 68 class SyntheticGestureTarget; | 68 class SyntheticGestureTarget; |
| 69 class TextInputManager; |
| 69 class WebCursor; | 70 class WebCursor; |
| 70 struct DidOverscrollParams; | 71 struct DidOverscrollParams; |
| 71 struct NativeWebKeyboardEvent; | 72 struct NativeWebKeyboardEvent; |
| 72 struct TextInputState; | 73 struct TextInputState; |
| 73 | 74 |
| 74 // Basic implementation shared by concrete RenderWidgetHostView subclasses. | 75 // Basic implementation shared by concrete RenderWidgetHostView subclasses. |
| 75 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, | 76 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
| 76 public IPC::Listener { | 77 public IPC::Listener { |
| 77 public: | 78 public: |
| 78 ~RenderWidgetHostViewBase() override; | 79 ~RenderWidgetHostViewBase() override; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // embedded within the RenderWidgetHostViewBase's Surface to the | 234 // embedded within the RenderWidgetHostViewBase's Surface to the |
| 234 // coordinate space of the embedding Surface. Typically this means that a | 235 // coordinate space of the embedding Surface. Typically this means that a |
| 235 // 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 |
| 236 // 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 |
| 237 // 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 |
| 238 // SurfaceId. | 239 // SurfaceId. |
| 239 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, | 240 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, |
| 240 cc::SurfaceId original_surface, | 241 cc::SurfaceId original_surface, |
| 241 gfx::Point* transformed_point); | 242 gfx::Point* transformed_point); |
| 242 | 243 |
| 244 // Updates the state of the input method attached to the view. |
| 245 virtual void TextInputStateChanged(const TextInputState& text_input_state); |
| 246 |
| 243 //---------------------------------------------------------------------------- | 247 //---------------------------------------------------------------------------- |
| 244 // The following static methods are implemented by each platform. | 248 // The following static methods are implemented by each platform. |
| 245 | 249 |
| 246 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); | 250 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); |
| 247 | 251 |
| 248 //---------------------------------------------------------------------------- | 252 //---------------------------------------------------------------------------- |
| 249 // The following pure virtual methods are implemented by derived classes. | 253 // The following pure virtual methods are implemented by derived classes. |
| 250 | 254 |
| 251 // Perform all the initialization steps necessary for this object to represent | 255 // Perform all the initialization steps necessary for this object to represent |
| 252 // a popup (such as a <select> dropdown), then shows the popup at |pos|. | 256 // a popup (such as a <select> dropdown), then shows the popup at |pos|. |
| 253 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 257 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 254 const gfx::Rect& bounds) = 0; | 258 const gfx::Rect& bounds) = 0; |
| 255 | 259 |
| 256 // Perform all the initialization steps necessary for this object to represent | 260 // Perform all the initialization steps necessary for this object to represent |
| 257 // a full screen window. | 261 // a full screen window. |
| 258 // |reference_host_view| is the view associated with the creating page that | 262 // |reference_host_view| is the view associated with the creating page that |
| 259 // helps to position the full screen widget on the correct monitor. | 263 // helps to position the full screen widget on the correct monitor. |
| 260 virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0; | 264 virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0; |
| 261 | 265 |
| 262 // Sets the cursor to the one associated with the specified cursor_type | 266 // Sets the cursor to the one associated with the specified cursor_type |
| 263 virtual void UpdateCursor(const WebCursor& cursor) = 0; | 267 virtual void UpdateCursor(const WebCursor& cursor) = 0; |
| 264 | 268 |
| 265 // Indicates whether the page has finished loading. | 269 // Indicates whether the page has finished loading. |
| 266 virtual void SetIsLoading(bool is_loading) = 0; | 270 virtual void SetIsLoading(bool is_loading) = 0; |
| 267 | 271 |
| 268 // Updates the state of the input method attached to the view. | |
| 269 virtual void TextInputStateChanged(const TextInputState& params) = 0; | |
| 270 | |
| 271 // Cancel the ongoing composition of the input method attached to the view. | 272 // Cancel the ongoing composition of the input method attached to the view. |
| 272 virtual void ImeCancelComposition() = 0; | 273 virtual void ImeCancelComposition() = 0; |
| 273 | 274 |
| 274 // Notifies the View that the renderer has ceased to exist. | 275 // Notifies the View that the renderer has ceased to exist. |
| 275 virtual void RenderProcessGone(base::TerminationStatus status, | 276 virtual void RenderProcessGone(base::TerminationStatus status, |
| 276 int error_code) = 0; | 277 int error_code) = 0; |
| 277 | 278 |
| 278 // Tells the View to destroy itself. | 279 // Tells the View to destroy itself. |
| 279 virtual void Destroy() = 0; | 280 virtual void Destroy() = 0; |
| 280 | 281 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 // Exposed for testing. | 379 // Exposed for testing. |
| 379 virtual bool IsChildFrameForTesting() const; | 380 virtual bool IsChildFrameForTesting() const; |
| 380 virtual cc::SurfaceId SurfaceIdForTesting() const; | 381 virtual cc::SurfaceId SurfaceIdForTesting() const; |
| 381 | 382 |
| 382 protected: | 383 protected: |
| 383 // Interface class only, do not construct. | 384 // Interface class only, do not construct. |
| 384 RenderWidgetHostViewBase(); | 385 RenderWidgetHostViewBase(); |
| 385 | 386 |
| 386 void NotifyObserversAboutShutdown(); | 387 void NotifyObserversAboutShutdown(); |
| 387 | 388 |
| 389 // Returns a reference to the current instance of TextInputManager. If no |
| 390 // no reference is found, this method tries to obtain one from the |
| 391 // RenderWidgetHostDelegate. Returns nullptr if no reference exists or |
| 392 // can be obtained. Unless not possible, this method should be used internally |
| 393 // to obtain TextInputManager. |
| 394 TextInputManager* GetTextInputManager(); |
| 395 |
| 388 // Whether this view is a popup and what kind of popup it is (select, | 396 // Whether this view is a popup and what kind of popup it is (select, |
| 389 // autofill...). | 397 // autofill...). |
| 390 blink::WebPopupType popup_type_; | 398 blink::WebPopupType popup_type_; |
| 391 | 399 |
| 392 // The background color of the web content. | 400 // The background color of the web content. |
| 393 SkColor background_color_; | 401 SkColor background_color_; |
| 394 | 402 |
| 395 // While the mouse is locked, the cursor is hidden from the user. Mouse events | 403 // While the mouse is locked, the cursor is hidden from the user. Mouse events |
| 396 // are still generated. However, the position they report is the last known | 404 // are still generated. However, the position they report is the last known |
| 397 // mouse position just as mouse lock was entered; the movement they report | 405 // mouse position just as mouse lock was entered; the movement they report |
| 398 // indicates what the change in position of the mouse would be had it not been | 406 // indicates what the change in position of the mouse would be had it not been |
| 399 // locked. | 407 // locked. |
| 400 bool mouse_locked_; | 408 bool mouse_locked_; |
| 401 | 409 |
| 402 // Whether we are showing a context menu. | 410 // Whether we are showing a context menu. |
| 403 bool showing_context_menu_; | 411 bool showing_context_menu_; |
| 404 | 412 |
| 405 // A buffer containing the text inside and around the current selection range. | 413 // A buffer containing the text inside and around the current selection range. |
| 406 base::string16 selection_text_; | 414 base::string16 selection_text_; |
| 407 | 415 |
| 408 // The offset of the text stored in |selection_text_| relative to the start of | 416 // The offset of the text stored in |selection_text_| relative to the start of |
| 409 // the web page. | 417 // the web page. |
| 410 size_t selection_text_offset_; | 418 size_t selection_text_offset_; |
| 411 | 419 |
| 412 // The current selection range relative to the start of the web page. | 420 // The current selection range relative to the start of the web page. |
| 413 gfx::Range selection_range_; | 421 gfx::Range selection_range_; |
| 414 | 422 |
| 415 protected: | |
| 416 // The scale factor of the display the renderer is currently on. | 423 // The scale factor of the display the renderer is currently on. |
| 417 float current_device_scale_factor_; | 424 float current_device_scale_factor_; |
| 418 | 425 |
| 419 // The orientation of the display the renderer is currently on. | 426 // The orientation of the display the renderer is currently on. |
| 420 display::Display::Rotation current_display_rotation_; | 427 display::Display::Rotation current_display_rotation_; |
| 421 | 428 |
| 422 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the | 429 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the |
| 423 // renderer. | 430 // renderer. |
| 424 bool pinch_zoom_enabled_; | 431 bool pinch_zoom_enabled_; |
| 425 | 432 |
| 433 // A reference to current TextInputManager instance this RWHV is registered |
| 434 // with. |
| 435 TextInputManager* text_input_manager_; |
| 436 |
| 426 private: | 437 private: |
| 427 void FlushInput(); | 438 void FlushInput(); |
| 428 | 439 |
| 429 gfx::Rect current_display_area_; | 440 gfx::Rect current_display_area_; |
| 430 | 441 |
| 431 uint32_t renderer_frame_number_; | 442 uint32_t renderer_frame_number_; |
| 432 | 443 |
| 433 base::OneShotTimer flush_input_timer_; | 444 base::OneShotTimer flush_input_timer_; |
| 434 | 445 |
| 435 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; | 446 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; |
| 436 | 447 |
| 437 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; | 448 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; |
| 438 | 449 |
| 439 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); | 450 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |
| 440 }; | 451 }; |
| 441 | 452 |
| 442 } // namespace content | 453 } // namespace content |
| 443 | 454 |
| 444 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 455 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
| OLD | NEW |