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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // Instructs the view to not drop the surface even when the view is hidden. | 390 // Instructs the view to not drop the surface even when the view is hidden. |
391 virtual void LockCompositingSurface() = 0; | 391 virtual void LockCompositingSurface() = 0; |
392 virtual void UnlockCompositingSurface() = 0; | 392 virtual void UnlockCompositingSurface() = 0; |
393 | 393 |
394 // Add and remove observers for lifetime event notifications. The order in | 394 // Add and remove observers for lifetime event notifications. The order in |
395 // which notifications are sent to observers is undefined. Clients must be | 395 // which notifications are sent to observers is undefined. Clients must be |
396 // sure to remove the observer before they go away. | 396 // sure to remove the observer before they go away. |
397 void AddObserver(RenderWidgetHostViewBaseObserver* observer); | 397 void AddObserver(RenderWidgetHostViewBaseObserver* observer); |
398 void RemoveObserver(RenderWidgetHostViewBaseObserver* observer); | 398 void RemoveObserver(RenderWidgetHostViewBaseObserver* observer); |
399 | 399 |
400 // Exposed for testing. | |
401 virtual bool IsChildFrameForTesting() const; | |
402 virtual cc::SurfaceId SurfaceIdForTesting() const; | |
403 | |
404 protected: | |
405 // Interface class only, do not construct. | |
406 RenderWidgetHostViewBase(); | |
407 | |
408 void NotifyObserversAboutShutdown(); | |
409 | |
410 // Returns a reference to the current instance of TextInputManager. The | 400 // Returns a reference to the current instance of TextInputManager. The |
411 // reference is obtained from RenderWidgetHostDelegate. The first time a non- | 401 // reference is obtained from RenderWidgetHostDelegate. The first time a non- |
412 // null reference is obtained, its value is cached in |text_input_manager_| | 402 // null reference is obtained, its value is cached in |text_input_manager_| |
413 // and this view is registered with it. The RWHV will unregister from the | 403 // and this view is registered with it. The RWHV will unregister from the |
414 // TextInputManager if it is destroyed or if the TextInputManager itself is | 404 // TextInputManager if it is destroyed or if the TextInputManager itself is |
415 // destroyed. The unregistration of the RWHV from TextInputManager is | 405 // destroyed. The unregistration of the RWHV from TextInputManager is |
416 // necessary and must be done by explicitly calling | 406 // necessary and must be done by explicitly calling |
417 // TextInputManager::Unregister. | 407 // TextInputManager::Unregister. |
418 // It is safer to use this method rather than directly dereferencing | 408 // It is safer to use this method rather than directly dereferencing |
419 // |text_input_manager_|. | 409 // |text_input_manager_|. |
420 TextInputManager* GetTextInputManager(); | 410 TextInputManager* GetTextInputManager(); |
421 | 411 |
| 412 // Exposed for testing. |
| 413 virtual bool IsChildFrameForTesting() const; |
| 414 virtual cc::SurfaceId SurfaceIdForTesting() const; |
| 415 |
| 416 protected: |
| 417 // Interface class only, do not construct. |
| 418 RenderWidgetHostViewBase(); |
| 419 |
| 420 void NotifyObserversAboutShutdown(); |
| 421 |
422 // Whether this view is a popup and what kind of popup it is (select, | 422 // Whether this view is a popup and what kind of popup it is (select, |
423 // autofill...). | 423 // autofill...). |
424 blink::WebPopupType popup_type_; | 424 blink::WebPopupType popup_type_; |
425 | 425 |
426 // The background color of the web content. | 426 // The background color of the web content. |
427 SkColor background_color_; | 427 SkColor background_color_; |
428 | 428 |
429 // While the mouse is locked, the cursor is hidden from the user. Mouse events | 429 // While the mouse is locked, the cursor is hidden from the user. Mouse events |
430 // are still generated. However, the position they report is the last known | 430 // are still generated. However, the position they report is the last known |
431 // mouse position just as mouse lock was entered; the movement they report | 431 // mouse position just as mouse lock was entered; the movement they report |
(...skipping 19 matching lines...) Expand all Loading... |
451 // The current selection range relative to the start of the web page. | 451 // The current selection range relative to the start of the web page. |
452 gfx::Range selection_range_; | 452 gfx::Range selection_range_; |
453 #endif | 453 #endif |
454 | 454 |
455 // The scale factor of the display the renderer is currently on. | 455 // The scale factor of the display the renderer is currently on. |
456 float current_device_scale_factor_; | 456 float current_device_scale_factor_; |
457 | 457 |
458 // The orientation of the display the renderer is currently on. | 458 // The orientation of the display the renderer is currently on. |
459 display::Display::Rotation current_display_rotation_; | 459 display::Display::Rotation current_display_rotation_; |
460 | 460 |
461 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the | |
462 // renderer. | |
463 bool pinch_zoom_enabled_; | |
464 | |
465 // A reference to current TextInputManager instance this RWHV is registered | 461 // A reference to current TextInputManager instance this RWHV is registered |
466 // with. This is initially nullptr until the first time the view calls | 462 // with. This is initially nullptr until the first time the view calls |
467 // GetTextInputManager(). It also becomes nullptr when TextInputManager is | 463 // GetTextInputManager(). It also becomes nullptr when TextInputManager is |
468 // destroyed before the RWHV is destroyed. | 464 // destroyed before the RWHV is destroyed. |
469 TextInputManager* text_input_manager_; | 465 TextInputManager* text_input_manager_; |
470 | 466 |
471 private: | 467 private: |
472 void FlushInput(); | 468 void FlushInput(); |
473 | 469 |
474 gfx::Rect current_display_area_; | 470 gfx::Rect current_display_area_; |
475 | 471 |
476 uint32_t renderer_frame_number_; | 472 uint32_t renderer_frame_number_; |
477 | 473 |
478 base::OneShotTimer flush_input_timer_; | 474 base::OneShotTimer flush_input_timer_; |
479 | 475 |
480 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; | 476 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; |
481 | 477 |
482 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; | 478 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; |
483 | 479 |
484 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); | 480 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |
485 }; | 481 }; |
486 | 482 |
487 } // namespace content | 483 } // namespace content |
488 | 484 |
489 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 485 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
OLD | NEW |