Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_base.h

Issue 1948343002: [reland] Browser Side Text Input State Tracking for OOPIF (Aura Only) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing creis@ Comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // the renderer. 120 // the renderer.
120 void DidReceiveRendererFrame(); 121 void DidReceiveRendererFrame();
121 122
122 // 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.
123 void UpdateScreenInfo(gfx::NativeView view); 124 void UpdateScreenInfo(gfx::NativeView view);
124 125
125 // Tells if the display property (work area/scale factor) has 126 // Tells if the display property (work area/scale factor) has
126 // changed since the last time. 127 // changed since the last time.
127 bool HasDisplayPropertyChanged(gfx::NativeView view); 128 bool HasDisplayPropertyChanged(gfx::NativeView view);
128 129
130 // Called by the TextInputManager to notify the view about being removed from
131 // the list of registered views, i.e., TextInputManager is no longer tracking
132 // TextInputState from this view. The RWHV should reset |text_input_manager_|
133 // to nullptr.
134 void DidUnregisterFromTextInputManager(TextInputManager* text_input_manager);
135
129 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); 136 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr();
130 137
131 //---------------------------------------------------------------------------- 138 //----------------------------------------------------------------------------
132 // The following methods can be overridden by derived classes. 139 // The following methods can be overridden by derived classes.
133 140
134 // Notifies the View that the renderer text selection has changed. 141 // Notifies the View that the renderer text selection has changed.
135 virtual void SelectionChanged(const base::string16& text, 142 virtual void SelectionChanged(const base::string16& text,
136 size_t offset, 143 size_t offset,
137 const gfx::Range& range); 144 const gfx::Range& range);
138 145
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // embedded within the RenderWidgetHostViewBase's Surface to the 240 // embedded within the RenderWidgetHostViewBase's Surface to the
234 // coordinate space of the embedding Surface. Typically this means that a 241 // 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 242 // 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 243 // 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 244 // this method is called on the root RWHV with the out-of-process iframe's
238 // SurfaceId. 245 // SurfaceId.
239 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, 246 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point,
240 cc::SurfaceId original_surface, 247 cc::SurfaceId original_surface,
241 gfx::Point* transformed_point); 248 gfx::Point* transformed_point);
242 249
250 // Updates the state of the input method attached to the view.
251 virtual void TextInputStateChanged(const TextInputState& text_input_state);
252
243 //---------------------------------------------------------------------------- 253 //----------------------------------------------------------------------------
244 // The following static methods are implemented by each platform. 254 // The following static methods are implemented by each platform.
245 255
246 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); 256 static void GetDefaultScreenInfo(blink::WebScreenInfo* results);
247 257
248 //---------------------------------------------------------------------------- 258 //----------------------------------------------------------------------------
249 // The following pure virtual methods are implemented by derived classes. 259 // The following pure virtual methods are implemented by derived classes.
250 260
251 // Perform all the initialization steps necessary for this object to represent 261 // 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|. 262 // a popup (such as a <select> dropdown), then shows the popup at |pos|.
253 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, 263 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
254 const gfx::Rect& bounds) = 0; 264 const gfx::Rect& bounds) = 0;
255 265
256 // Perform all the initialization steps necessary for this object to represent 266 // Perform all the initialization steps necessary for this object to represent
257 // a full screen window. 267 // a full screen window.
258 // |reference_host_view| is the view associated with the creating page that 268 // |reference_host_view| is the view associated with the creating page that
259 // helps to position the full screen widget on the correct monitor. 269 // helps to position the full screen widget on the correct monitor.
260 virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0; 270 virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0;
261 271
262 // Sets the cursor to the one associated with the specified cursor_type 272 // Sets the cursor to the one associated with the specified cursor_type
263 virtual void UpdateCursor(const WebCursor& cursor) = 0; 273 virtual void UpdateCursor(const WebCursor& cursor) = 0;
264 274
265 // Indicates whether the page has finished loading. 275 // Indicates whether the page has finished loading.
266 virtual void SetIsLoading(bool is_loading) = 0; 276 virtual void SetIsLoading(bool is_loading) = 0;
267 277
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. 278 // Cancel the ongoing composition of the input method attached to the view.
272 virtual void ImeCancelComposition() = 0; 279 virtual void ImeCancelComposition() = 0;
273 280
274 // Notifies the View that the renderer has ceased to exist. 281 // Notifies the View that the renderer has ceased to exist.
275 virtual void RenderProcessGone(base::TerminationStatus status, 282 virtual void RenderProcessGone(base::TerminationStatus status,
276 int error_code) = 0; 283 int error_code) = 0;
277 284
278 // Tells the View to destroy itself. 285 // Tells the View to destroy itself.
279 virtual void Destroy() = 0; 286 virtual void Destroy() = 0;
280 287
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Exposed for testing. 385 // Exposed for testing.
379 virtual bool IsChildFrameForTesting() const; 386 virtual bool IsChildFrameForTesting() const;
380 virtual cc::SurfaceId SurfaceIdForTesting() const; 387 virtual cc::SurfaceId SurfaceIdForTesting() const;
381 388
382 protected: 389 protected:
383 // Interface class only, do not construct. 390 // Interface class only, do not construct.
384 RenderWidgetHostViewBase(); 391 RenderWidgetHostViewBase();
385 392
386 void NotifyObserversAboutShutdown(); 393 void NotifyObserversAboutShutdown();
387 394
395 // Returns a reference to the current instance of TextInputManager. The
396 // reference is obtained from RenderWidgetHostDelegate. The first time a non-
397 // null reference is obtained , its value is cached in |text_input_manager_|.
Charlie Reis 2016/06/02 22:03:29 nit: No space before comma.
398 // Then this view is registered with TextInputManage (i.e., the instance
399 // |text_input_manager_| referes to). The RWHV will unregister from the
400 // TextInputManager if it is destroyed or if the TextInputManager itself is
401 // destroyed. The unregistration of the RWHV from TextInputManager is
402 // necessary and must be done by explicitly calling
403 // TextInputManager::Unregister. It is safer to use this method rather than
404 // dereferencing |text_input_manager_|.
405 TextInputManager* GetTextInputManager();
406
388 // Whether this view is a popup and what kind of popup it is (select, 407 // Whether this view is a popup and what kind of popup it is (select,
389 // autofill...). 408 // autofill...).
390 blink::WebPopupType popup_type_; 409 blink::WebPopupType popup_type_;
391 410
392 // The background color of the web content. 411 // The background color of the web content.
393 SkColor background_color_; 412 SkColor background_color_;
394 413
395 // While the mouse is locked, the cursor is hidden from the user. Mouse events 414 // 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 415 // 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 416 // 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 417 // indicates what the change in position of the mouse would be had it not been
399 // locked. 418 // locked.
400 bool mouse_locked_; 419 bool mouse_locked_;
401 420
402 // Whether we are showing a context menu. 421 // Whether we are showing a context menu.
403 bool showing_context_menu_; 422 bool showing_context_menu_;
404 423
405 // A buffer containing the text inside and around the current selection range. 424 // A buffer containing the text inside and around the current selection range.
406 base::string16 selection_text_; 425 base::string16 selection_text_;
407 426
408 // The offset of the text stored in |selection_text_| relative to the start of 427 // The offset of the text stored in |selection_text_| relative to the start of
409 // the web page. 428 // the web page.
410 size_t selection_text_offset_; 429 size_t selection_text_offset_;
411 430
412 // The current selection range relative to the start of the web page. 431 // The current selection range relative to the start of the web page.
413 gfx::Range selection_range_; 432 gfx::Range selection_range_;
414 433
415 protected:
416 // The scale factor of the display the renderer is currently on. 434 // The scale factor of the display the renderer is currently on.
417 float current_device_scale_factor_; 435 float current_device_scale_factor_;
418 436
419 // The orientation of the display the renderer is currently on. 437 // The orientation of the display the renderer is currently on.
420 display::Display::Rotation current_display_rotation_; 438 display::Display::Rotation current_display_rotation_;
421 439
422 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the 440 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the
423 // renderer. 441 // renderer.
424 bool pinch_zoom_enabled_; 442 bool pinch_zoom_enabled_;
425 443
444 // A reference to current TextInputManager instance this RWHV is registered
445 // with. This is initially nullptr until the first time the view calls
446 // GetTextInputManager(). It also becomes nullptr when TextInputManager is
447 // destroyed before the RWHV is destroyed.
448 TextInputManager* text_input_manager_;
449
426 private: 450 private:
427 void FlushInput(); 451 void FlushInput();
428 452
429 gfx::Rect current_display_area_; 453 gfx::Rect current_display_area_;
430 454
431 uint32_t renderer_frame_number_; 455 uint32_t renderer_frame_number_;
432 456
433 base::OneShotTimer flush_input_timer_; 457 base::OneShotTimer flush_input_timer_;
434 458
435 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; 459 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_;
436 460
437 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; 461 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_;
438 462
439 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); 463 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);
440 }; 464 };
441 465
442 } // namespace content 466 } // namespace content
443 467
444 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 468 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698