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