OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 // Notification that the user has made some kind of input that could | 488 // Notification that the user has made some kind of input that could |
489 // perform an action. The gestures that count are 1) any mouse down | 489 // perform an action. The gestures that count are 1) any mouse down |
490 // event and 2) enter or space key presses. | 490 // event and 2) enter or space key presses. |
491 virtual void OnUserGesture() {} | 491 virtual void OnUserGesture() {} |
492 | 492 |
493 // Callbacks for notification when the renderer becomes unresponsive to user | 493 // Callbacks for notification when the renderer becomes unresponsive to user |
494 // input events, and subsequently responsive again. | 494 // input events, and subsequently responsive again. |
495 virtual void NotifyRendererUnresponsive() {} | 495 virtual void NotifyRendererUnresponsive() {} |
496 virtual void NotifyRendererResponsive() {} | 496 virtual void NotifyRendererResponsive() {} |
497 | 497 |
| 498 // Called when auto-size resulted in the render size changing. |
| 499 virtual void OnRenderSizeChanged(const gfx::Size& size) {} |
| 500 |
498 // --------------------------------------------------------------------------- | 501 // --------------------------------------------------------------------------- |
499 | 502 |
500 // RenderViewHost overrides this method to impose further restrictions on when | 503 // RenderViewHost overrides this method to impose further restrictions on when |
501 // to allow mouse lock. | 504 // to allow mouse lock. |
502 // Once the request is approved or rejected, GotResponseToLockMouseRequest() | 505 // Once the request is approved or rejected, GotResponseToLockMouseRequest() |
503 // will be called. | 506 // will be called. |
504 virtual void RequestToLockMouse(); | 507 virtual void RequestToLockMouse(); |
505 | 508 |
506 void RejectMouseLockOrUnlockIfNecessary(); | 509 void RejectMouseLockOrUnlockIfNecessary(); |
507 bool IsMouseLocked() const; | 510 bool IsMouseLocked() const; |
508 | 511 |
509 // RenderViewHost overrides this method to report when in fullscreen mode. | 512 // RenderViewHost overrides this method to report when in fullscreen mode. |
510 virtual bool IsFullscreen() const; | 513 virtual bool IsFullscreen() const; |
511 | 514 |
| 515 // Indicates if the render widget host should track the render widget's size |
| 516 // as opposed to visa versa. |
| 517 void setShouldAutoSize(bool enable); |
| 518 |
512 protected: | 519 protected: |
513 // true if a renderer has once been valid. We use this flag to display a sad | 520 // true if a renderer has once been valid. We use this flag to display a sad |
514 // tab only when we lose our renderer and not if a paint occurs during | 521 // tab only when we lose our renderer and not if a paint occurs during |
515 // initialization. | 522 // initialization. |
516 bool renderer_initialized_; | 523 bool renderer_initialized_; |
517 | 524 |
518 private: | 525 private: |
519 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, Resize); | 526 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, Resize); |
520 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, ResizeThenCrash); | 527 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, ResizeThenCrash); |
521 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, HiddenPaint); | 528 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostTest, HiddenPaint); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 // hand is updated when the resize message is sent. This is very similar to | 673 // hand is updated when the resize message is sent. This is very similar to |
667 // |resize_ack_pending_|, but the latter is not set if the new size has width | 674 // |resize_ack_pending_|, but the latter is not set if the new size has width |
668 // or height zero, which is why we need this too. | 675 // or height zero, which is why we need this too. |
669 gfx::Size in_flight_size_; | 676 gfx::Size in_flight_size_; |
670 | 677 |
671 // The reserved area we last sent to the renderer. |current_reserved_rect_| | 678 // The reserved area we last sent to the renderer. |current_reserved_rect_| |
672 // is only updated once the resize message has been ack'd. This on the other | 679 // is only updated once the resize message has been ack'd. This on the other |
673 // hand is updated when the resize message is sent. | 680 // hand is updated when the resize message is sent. |
674 gfx::Rect in_flight_reserved_rect_; | 681 gfx::Rect in_flight_reserved_rect_; |
675 | 682 |
| 683 // True if the render widget host should track the render widget's size as |
| 684 // opposed to visa versa. |
| 685 bool should_auto_size_; |
| 686 |
676 // True if a mouse move event was sent to the render view and we are waiting | 687 // True if a mouse move event was sent to the render view and we are waiting |
677 // for a corresponding ViewHostMsg_HandleInputEvent_ACK message. | 688 // for a corresponding ViewHostMsg_HandleInputEvent_ACK message. |
678 bool mouse_move_pending_; | 689 bool mouse_move_pending_; |
679 | 690 |
680 // The next mouse move event to send (only non-null while mouse_move_pending_ | 691 // The next mouse move event to send (only non-null while mouse_move_pending_ |
681 // is true). | 692 // is true). |
682 scoped_ptr<WebKit::WebMouseEvent> next_mouse_move_; | 693 scoped_ptr<WebKit::WebMouseEvent> next_mouse_move_; |
683 | 694 |
684 // (Similar to |mouse_move_pending_|.) True if a mouse wheel event was sent | 695 // (Similar to |mouse_move_pending_|.) True if a mouse wheel event was sent |
685 // and we are waiting for a corresponding ack. | 696 // and we are waiting for a corresponding ack. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 gfx::Point last_scroll_offset_; | 791 gfx::Point last_scroll_offset_; |
781 | 792 |
782 bool pending_mouse_lock_request_; | 793 bool pending_mouse_lock_request_; |
783 | 794 |
784 base::WeakPtrFactory<RenderWidgetHost> weak_factory_; | 795 base::WeakPtrFactory<RenderWidgetHost> weak_factory_; |
785 | 796 |
786 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); | 797 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); |
787 }; | 798 }; |
788 | 799 |
789 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ | 800 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
OLD | NEW |