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

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: Rebase 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 TextInputManager;
70 class WebCursor; 71 class WebCursor;
71 struct DidOverscrollParams; 72 struct DidOverscrollParams;
72 struct NativeWebKeyboardEvent; 73 struct NativeWebKeyboardEvent;
73 struct TextInputState; 74 struct TextInputState;
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;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // the renderer. 123 // the renderer.
123 void DidReceiveRendererFrame(); 124 void DidReceiveRendererFrame();
124 125
125 // Notification that a resize or move session ended on the native widget. 126 // Notification that a resize or move session ended on the native widget.
126 void UpdateScreenInfo(gfx::NativeView view); 127 void UpdateScreenInfo(gfx::NativeView view);
127 128
128 // Tells if the display property (work area/scale factor) has 129 // Tells if the display property (work area/scale factor) has
129 // changed since the last time. 130 // changed since the last time.
130 bool HasDisplayPropertyChanged(gfx::NativeView view); 131 bool HasDisplayPropertyChanged(gfx::NativeView view);
131 132
133 // Called by the TextInputManager to notify the view about being removed from
134 // the list of registered views, i.e., TextInputManager is no longer tracking
135 // TextInputState from this view. The RWHV should reset |text_input_manager_|
136 // to nullptr.
137 void DidUnregisterFromTextInputManager(TextInputManager* text_input_manager);
138
132 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); 139 base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr();
133 140
134 //---------------------------------------------------------------------------- 141 //----------------------------------------------------------------------------
135 // The following methods can be overridden by derived classes. 142 // The following methods can be overridden by derived classes.
136 143
137 // Notifies the View that the renderer text selection has changed. 144 // Notifies the View that the renderer text selection has changed.
138 virtual void SelectionChanged(const base::string16& text, 145 virtual void SelectionChanged(const base::string16& text,
139 size_t offset, 146 size_t offset,
140 const gfx::Range& range); 147 const gfx::Range& range);
141 148
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // embedded within the RenderWidgetHostViewBase's Surface to the 243 // embedded within the RenderWidgetHostViewBase's Surface to the
237 // coordinate space of the embedding Surface. Typically this means that a 244 // coordinate space of the embedding Surface. Typically this means that a
238 // point was received from an out-of-process iframe's RenderWidget and needs 245 // point was received from an out-of-process iframe's RenderWidget and needs
239 // to be translated to viewport coordinates for the root RWHV, in which case 246 // to be translated to viewport coordinates for the root RWHV, in which case
240 // this method is called on the root RWHV with the out-of-process iframe's 247 // this method is called on the root RWHV with the out-of-process iframe's
241 // SurfaceId. 248 // SurfaceId.
242 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point, 249 virtual void TransformPointToLocalCoordSpace(const gfx::Point& point,
243 cc::SurfaceId original_surface, 250 cc::SurfaceId original_surface,
244 gfx::Point* transformed_point); 251 gfx::Point* transformed_point);
245 252
253 // Updates the state of the input method attached to the view.
Charlie Reis 2016/06/02 22:03:29 Please clarify why this would be overridden. (It'
EhsanK 2016/06/03 17:00:34 Yes. This should be temporary and resolved after w
254 virtual void TextInputStateChanged(const TextInputState& text_input_state);
255
246 //---------------------------------------------------------------------------- 256 //----------------------------------------------------------------------------
247 // The following static methods are implemented by each platform. 257 // The following static methods are implemented by each platform.
248 258
249 static void GetDefaultScreenInfo(blink::WebScreenInfo* results); 259 static void GetDefaultScreenInfo(blink::WebScreenInfo* results);
250 260
251 //---------------------------------------------------------------------------- 261 //----------------------------------------------------------------------------
252 // The following pure virtual methods are implemented by derived classes. 262 // The following pure virtual methods are implemented by derived classes.
253 263
254 // Perform all the initialization steps necessary for this object to represent 264 // Perform all the initialization steps necessary for this object to represent
255 // a popup (such as a <select> dropdown), then shows the popup at |pos|. 265 // a popup (such as a <select> dropdown), then shows the popup at |pos|.
256 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, 266 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
257 const gfx::Rect& bounds) = 0; 267 const gfx::Rect& bounds) = 0;
258 268
259 // Perform all the initialization steps necessary for this object to represent 269 // Perform all the initialization steps necessary for this object to represent
260 // a full screen window. 270 // a full screen window.
261 // |reference_host_view| is the view associated with the creating page that 271 // |reference_host_view| is the view associated with the creating page that
262 // helps to position the full screen widget on the correct monitor. 272 // helps to position the full screen widget on the correct monitor.
263 virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0; 273 virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0;
264 274
265 // Sets the cursor to the one associated with the specified cursor_type 275 // Sets the cursor to the one associated with the specified cursor_type
266 virtual void UpdateCursor(const WebCursor& cursor) = 0; 276 virtual void UpdateCursor(const WebCursor& cursor) = 0;
267 277
268 // Indicates whether the page has finished loading. 278 // Indicates whether the page has finished loading.
269 virtual void SetIsLoading(bool is_loading) = 0; 279 virtual void SetIsLoading(bool is_loading) = 0;
270 280
271 // Updates the state of the input method attached to the view.
272 virtual void TextInputStateChanged(const TextInputState& params) = 0;
273
274 // Cancel the ongoing composition of the input method attached to the view. 281 // Cancel the ongoing composition of the input method attached to the view.
275 virtual void ImeCancelComposition() = 0; 282 virtual void ImeCancelComposition() = 0;
276 283
277 // Notifies the View that the renderer has ceased to exist. 284 // Notifies the View that the renderer has ceased to exist.
278 virtual void RenderProcessGone(base::TerminationStatus status, 285 virtual void RenderProcessGone(base::TerminationStatus status,
279 int error_code) = 0; 286 int error_code) = 0;
280 287
281 // Tells the View to destroy itself. 288 // Tells the View to destroy itself.
282 virtual void Destroy() = 0; 289 virtual void Destroy() = 0;
283 290
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // Exposed for testing. 388 // Exposed for testing.
382 virtual bool IsChildFrameForTesting() const; 389 virtual bool IsChildFrameForTesting() const;
383 virtual cc::SurfaceId SurfaceIdForTesting() const; 390 virtual cc::SurfaceId SurfaceIdForTesting() const;
384 391
385 protected: 392 protected:
386 // Interface class only, do not construct. 393 // Interface class only, do not construct.
387 RenderWidgetHostViewBase(); 394 RenderWidgetHostViewBase();
388 395
389 void NotifyObserversAboutShutdown(); 396 void NotifyObserversAboutShutdown();
390 397
398 // Returns a reference to the current instance of TextInputManager. The
399 // reference is obtained from RenderWidgetHostDelegate. The first time a non-
400 // 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.
EhsanK 2016/06/03 17:00:34 Done.
401 // Then this view is registered with TextInputManage (i.e., the instance
Charlie Reis 2016/06/02 22:03:29 nit: is registered with |text_input_manager_|. Or
EhsanK 2016/06/03 17:00:34 Done. Second suggestion applied.
402 // |text_input_manager_| referes to). The RWHV will unregister from the
403 // TextInputManager if it is destroyed or if the TextInputManager itself is
404 // destroyed. The unregistration of the RWHV from TextInputManager is
405 // necessary and must be done by explicitly calling
406 // TextInputManager::Unregister. It is safer to use this method rather than
Charlie Reis 2016/06/02 22:03:29 nit: New paragraph for "It is safer..."
EhsanK 2016/06/03 17:00:34 Done.
407 // dereferencing |text_input_manager_|.
408 TextInputManager* GetTextInputManager();
409
391 // Whether this view is a popup and what kind of popup it is (select, 410 // Whether this view is a popup and what kind of popup it is (select,
392 // autofill...). 411 // autofill...).
393 blink::WebPopupType popup_type_; 412 blink::WebPopupType popup_type_;
394 413
395 // The background color of the web content. 414 // The background color of the web content.
396 SkColor background_color_; 415 SkColor background_color_;
397 416
398 // While the mouse is locked, the cursor is hidden from the user. Mouse events 417 // While the mouse is locked, the cursor is hidden from the user. Mouse events
399 // are still generated. However, the position they report is the last known 418 // are still generated. However, the position they report is the last known
400 // mouse position just as mouse lock was entered; the movement they report 419 // mouse position just as mouse lock was entered; the movement they report
401 // indicates what the change in position of the mouse would be had it not been 420 // indicates what the change in position of the mouse would be had it not been
402 // locked. 421 // locked.
403 bool mouse_locked_; 422 bool mouse_locked_;
404 423
405 // Whether we are showing a context menu. 424 // Whether we are showing a context menu.
406 bool showing_context_menu_; 425 bool showing_context_menu_;
407 426
408 // A buffer containing the text inside and around the current selection range. 427 // A buffer containing the text inside and around the current selection range.
409 base::string16 selection_text_; 428 base::string16 selection_text_;
410 429
411 // The offset of the text stored in |selection_text_| relative to the start of 430 // The offset of the text stored in |selection_text_| relative to the start of
412 // the web page. 431 // the web page.
413 size_t selection_text_offset_; 432 size_t selection_text_offset_;
414 433
415 // The current selection range relative to the start of the web page. 434 // The current selection range relative to the start of the web page.
416 gfx::Range selection_range_; 435 gfx::Range selection_range_;
417 436
418 protected:
419 // The scale factor of the display the renderer is currently on. 437 // The scale factor of the display the renderer is currently on.
420 float current_device_scale_factor_; 438 float current_device_scale_factor_;
421 439
422 // The orientation of the display the renderer is currently on. 440 // The orientation of the display the renderer is currently on.
423 display::Display::Rotation current_display_rotation_; 441 display::Display::Rotation current_display_rotation_;
424 442
425 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the 443 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the
426 // renderer. 444 // renderer.
427 bool pinch_zoom_enabled_; 445 bool pinch_zoom_enabled_;
428 446
447 // A reference to current TextInputManager instance this RWHV is registered
448 // with. This is initially nullptr until the first time the view calls
449 // GetTextInputManager(). It also becomes nullptr when TextInputManager is
450 // destroyed before the RWHV is destroyed.
451 TextInputManager* text_input_manager_;
452
429 private: 453 private:
430 void FlushInput(); 454 void FlushInput();
431 455
432 gfx::Rect current_display_area_; 456 gfx::Rect current_display_area_;
433 457
434 uint32_t renderer_frame_number_; 458 uint32_t renderer_frame_number_;
435 459
436 base::OneShotTimer flush_input_timer_; 460 base::OneShotTimer flush_input_timer_;
437 461
438 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; 462 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_;
439 463
440 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; 464 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_;
441 465
442 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); 466 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);
443 }; 467 };
444 468
445 } // namespace content 469 } // namespace content
446 470
447 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 471 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698