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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // Instructs the view to not drop the surface even when the view is hidden. | 409 // Instructs the view to not drop the surface even when the view is hidden. |
410 virtual void LockCompositingSurface() = 0; | 410 virtual void LockCompositingSurface() = 0; |
411 virtual void UnlockCompositingSurface() = 0; | 411 virtual void UnlockCompositingSurface() = 0; |
412 | 412 |
413 // Add and remove observers for lifetime event notifications. The order in | 413 // Add and remove observers for lifetime event notifications. The order in |
414 // which notifications are sent to observers is undefined. Clients must be | 414 // which notifications are sent to observers is undefined. Clients must be |
415 // sure to remove the observer before they go away. | 415 // sure to remove the observer before they go away. |
416 void AddObserver(RenderWidgetHostViewBaseObserver* observer); | 416 void AddObserver(RenderWidgetHostViewBaseObserver* observer); |
417 void RemoveObserver(RenderWidgetHostViewBaseObserver* observer); | 417 void RemoveObserver(RenderWidgetHostViewBaseObserver* observer); |
418 | 418 |
419 // Exposed for testing. | |
420 virtual bool IsChildFrameForTesting() const; | |
421 virtual cc::SurfaceId SurfaceIdForTesting() const; | |
422 | |
423 protected: | |
424 // Interface class only, do not construct. | |
425 RenderWidgetHostViewBase(); | |
426 | |
427 void NotifyObserversAboutShutdown(); | |
428 | |
429 // Returns a reference to the current instance of TextInputManager. The | 419 // Returns a reference to the current instance of TextInputManager. The |
430 // reference is obtained from RenderWidgetHostDelegate. The first time a non- | 420 // reference is obtained from RenderWidgetHostDelegate. The first time a non- |
431 // null reference is obtained, its value is cached in |text_input_manager_| | 421 // null reference is obtained, its value is cached in |text_input_manager_| |
432 // and this view is registered with it. The RWHV will unregister from the | 422 // and this view is registered with it. The RWHV will unregister from the |
433 // TextInputManager if it is destroyed or if the TextInputManager itself is | 423 // TextInputManager if it is destroyed or if the TextInputManager itself is |
434 // destroyed. The unregistration of the RWHV from TextInputManager is | 424 // destroyed. The unregistration of the RWHV from TextInputManager is |
435 // necessary and must be done by explicitly calling | 425 // necessary and must be done by explicitly calling |
436 // TextInputManager::Unregister. | 426 // TextInputManager::Unregister. |
437 // It is safer to use this method rather than directly dereferencing | 427 // It is safer to use this method rather than directly dereferencing |
438 // |text_input_manager_|. | 428 // |text_input_manager_|. |
439 TextInputManager* GetTextInputManager(); | 429 TextInputManager* GetTextInputManager(); |
440 | 430 |
| 431 bool is_fullscreen() { return is_fullscreen_; } |
| 432 |
| 433 // Exposed for testing. |
| 434 virtual bool IsChildFrameForTesting() const; |
| 435 virtual cc::SurfaceId SurfaceIdForTesting() const; |
| 436 |
| 437 protected: |
| 438 // Interface class only, do not construct. |
| 439 RenderWidgetHostViewBase(); |
| 440 |
| 441 void NotifyObserversAboutShutdown(); |
| 442 |
| 443 // Is this a fullscreen view? |
| 444 bool is_fullscreen_; |
| 445 |
441 // Whether this view is a popup and what kind of popup it is (select, | 446 // Whether this view is a popup and what kind of popup it is (select, |
442 // autofill...). | 447 // autofill...). |
443 blink::WebPopupType popup_type_; | 448 blink::WebPopupType popup_type_; |
444 | 449 |
445 // The background color of the web content. | 450 // The background color of the web content. |
446 SkColor background_color_; | 451 SkColor background_color_; |
447 | 452 |
448 // While the mouse is locked, the cursor is hidden from the user. Mouse events | 453 // While the mouse is locked, the cursor is hidden from the user. Mouse events |
449 // are still generated. However, the position they report is the last known | 454 // are still generated. However, the position they report is the last known |
450 // mouse position just as mouse lock was entered; the movement they report | 455 // mouse position just as mouse lock was entered; the movement they report |
(...skipping 19 matching lines...) Expand all Loading... |
470 // The current selection range relative to the start of the web page. | 475 // The current selection range relative to the start of the web page. |
471 gfx::Range selection_range_; | 476 gfx::Range selection_range_; |
472 #endif | 477 #endif |
473 | 478 |
474 // The scale factor of the display the renderer is currently on. | 479 // The scale factor of the display the renderer is currently on. |
475 float current_device_scale_factor_; | 480 float current_device_scale_factor_; |
476 | 481 |
477 // The orientation of the display the renderer is currently on. | 482 // The orientation of the display the renderer is currently on. |
478 display::Display::Rotation current_display_rotation_; | 483 display::Display::Rotation current_display_rotation_; |
479 | 484 |
480 // Whether pinch-to-zoom should be enabled and pinch events forwarded to the | |
481 // renderer. | |
482 bool pinch_zoom_enabled_; | |
483 | |
484 // A reference to current TextInputManager instance this RWHV is registered | 485 // A reference to current TextInputManager instance this RWHV is registered |
485 // with. This is initially nullptr until the first time the view calls | 486 // with. This is initially nullptr until the first time the view calls |
486 // GetTextInputManager(). It also becomes nullptr when TextInputManager is | 487 // GetTextInputManager(). It also becomes nullptr when TextInputManager is |
487 // destroyed before the RWHV is destroyed. | 488 // destroyed before the RWHV is destroyed. |
488 TextInputManager* text_input_manager_; | 489 TextInputManager* text_input_manager_; |
489 | 490 |
490 private: | 491 private: |
491 void FlushInput(); | 492 void FlushInput(); |
492 | 493 |
493 gfx::Rect current_display_area_; | 494 gfx::Rect current_display_area_; |
494 | 495 |
495 uint32_t renderer_frame_number_; | 496 uint32_t renderer_frame_number_; |
496 | 497 |
497 base::OneShotTimer flush_input_timer_; | 498 base::OneShotTimer flush_input_timer_; |
498 | 499 |
499 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; | 500 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; |
500 | 501 |
501 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; | 502 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; |
502 | 503 |
503 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); | 504 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |
504 }; | 505 }; |
505 | 506 |
506 } // namespace content | 507 } // namespace content |
507 | 508 |
508 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 509 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
OLD | NEW |