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_VIEW_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "net/base/load_states.h" | 25 #include "net/base/load_states.h" |
26 #include "third_party/WebKit/public/web/WebAXEnums.h" | 26 #include "third_party/WebKit/public/web/WebAXEnums.h" |
27 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 27 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
28 #include "third_party/WebKit/public/web/WebPopupType.h" | 28 #include "third_party/WebKit/public/web/WebPopupType.h" |
29 #include "third_party/WebKit/public/web/WebTextDirection.h" | 29 #include "third_party/WebKit/public/web/WebTextDirection.h" |
30 #include "third_party/skia/include/core/SkColor.h" | 30 #include "third_party/skia/include/core/SkColor.h" |
31 #include "ui/accessibility/ax_node_data.h" | 31 #include "ui/accessibility/ax_node_data.h" |
32 #include "ui/base/window_open_disposition.h" | 32 #include "ui/base/window_open_disposition.h" |
33 | 33 |
34 class SkBitmap; | 34 class SkBitmap; |
35 class ViewMsg_Navigate; | 35 class FrameMsg_Navigate; |
36 struct AccessibilityHostMsg_EventParams; | 36 struct AccessibilityHostMsg_EventParams; |
37 struct AccessibilityHostMsg_LocationChangeParams; | 37 struct AccessibilityHostMsg_LocationChangeParams; |
38 struct MediaPlayerAction; | 38 struct MediaPlayerAction; |
39 struct ViewHostMsg_CreateWindow_Params; | 39 struct ViewHostMsg_CreateWindow_Params; |
40 struct ViewHostMsg_OpenURL_Params; | 40 struct ViewHostMsg_OpenURL_Params; |
41 struct ViewHostMsg_SelectionBounds_Params; | 41 struct ViewHostMsg_SelectionBounds_Params; |
42 struct ViewHostMsg_ShowPopup_Params; | 42 struct ViewHostMsg_ShowPopup_Params; |
43 struct ViewMsg_Navigate_Params; | 43 struct FrameMsg_Navigate_Params; |
44 struct ViewMsg_PostMessage_Params; | 44 struct ViewMsg_PostMessage_Params; |
45 | 45 |
46 namespace base { | 46 namespace base { |
47 class ListValue; | 47 class ListValue; |
48 } | 48 } |
49 | 49 |
50 namespace gfx { | 50 namespace gfx { |
51 class Range; | 51 class Range; |
52 } | 52 } |
53 | 53 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // Returns the content specific prefs for this RenderViewHost. | 270 // Returns the content specific prefs for this RenderViewHost. |
271 WebPreferences GetWebkitPrefs(const GURL& url); | 271 WebPreferences GetWebkitPrefs(const GURL& url); |
272 | 272 |
273 // Sends the given navigation message. Use this rather than sending it | 273 // Sends the given navigation message. Use this rather than sending it |
274 // yourself since this does the internal bookkeeping described below. This | 274 // yourself since this does the internal bookkeeping described below. This |
275 // function takes ownership of the provided message pointer. | 275 // function takes ownership of the provided message pointer. |
276 // | 276 // |
277 // If a cross-site request is in progress, we may be suspended while waiting | 277 // If a cross-site request is in progress, we may be suspended while waiting |
278 // for the onbeforeunload handler, so this function might buffer the message | 278 // for the onbeforeunload handler, so this function might buffer the message |
279 // rather than sending it. | 279 // rather than sending it. |
280 void Navigate(const ViewMsg_Navigate_Params& message); | 280 // TODO(nasko): Remove this method once all callers are converted to use |
| 281 // RenderFrameHostImpl. |
| 282 void Navigate(const FrameMsg_Navigate_Params& message); |
281 | 283 |
282 // Load the specified URL, this is a shortcut for Navigate(). | 284 // Load the specified URL, this is a shortcut for Navigate(). |
| 285 // TODO(nasko): Remove this method once all callers are converted to use |
| 286 // RenderFrameHostImpl. |
283 void NavigateToURL(const GURL& url); | 287 void NavigateToURL(const GURL& url); |
284 | 288 |
285 // Returns whether navigation messages are currently suspended for this | 289 // Returns whether navigation messages are currently suspended for this |
286 // RenderViewHost. Only true during a cross-site navigation, while waiting | 290 // RenderViewHost. Only true during a cross-site navigation, while waiting |
287 // for the onbeforeunload handler. | 291 // for the onbeforeunload handler. |
288 bool are_navigations_suspended() const { return navigations_suspended_; } | 292 bool are_navigations_suspended() const { return navigations_suspended_; } |
289 | 293 |
290 // Suspends (or unsuspends) any navigation messages from being sent from this | 294 // Suspends (or unsuspends) any navigation messages from being sent from this |
291 // RenderViewHost. This is called when a pending RenderViewHost is created | 295 // RenderViewHost. This is called when a pending RenderViewHost is created |
292 // for a cross-site navigation, because we must suspend any navigations until | 296 // for a cross-site navigation, because we must suspend any navigations until |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 bool waiting_for_drag_context_response_; | 661 bool waiting_for_drag_context_response_; |
658 | 662 |
659 // A bitwise OR of bindings types that have been enabled for this RenderView. | 663 // A bitwise OR of bindings types that have been enabled for this RenderView. |
660 // See BindingsPolicy for details. | 664 // See BindingsPolicy for details. |
661 int enabled_bindings_; | 665 int enabled_bindings_; |
662 | 666 |
663 // Whether we should buffer outgoing Navigate messages rather than sending | 667 // Whether we should buffer outgoing Navigate messages rather than sending |
664 // them. This will be true when a RenderViewHost is created for a cross-site | 668 // them. This will be true when a RenderViewHost is created for a cross-site |
665 // request, until we hear back from the onbeforeunload handler of the old | 669 // request, until we hear back from the onbeforeunload handler of the old |
666 // RenderViewHost. | 670 // RenderViewHost. |
| 671 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
667 bool navigations_suspended_; | 672 bool navigations_suspended_; |
668 | 673 |
669 // We only buffer the params for a suspended navigation while we have a | 674 // We only buffer the params for a suspended navigation while we have a |
670 // pending RVH for a WebContentsImpl. There will only ever be one suspended | 675 // pending RVH for a WebContentsImpl. There will only ever be one suspended |
671 // navigation, because WebContentsImpl will destroy the pending RVH and create | 676 // navigation, because WebContentsImpl will destroy the pending RVH and create |
672 // a new one if a second navigation occurs. | 677 // a new one if a second navigation occurs. |
673 scoped_ptr<ViewMsg_Navigate_Params> suspended_nav_params_; | 678 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
| 679 scoped_ptr<FrameMsg_Navigate_Params> suspended_nav_params_; |
674 | 680 |
675 // Whether the initial empty page of this view has been accessed by another | 681 // Whether the initial empty page of this view has been accessed by another |
676 // page, making it unsafe to show the pending URL. Usually false unless | 682 // page, making it unsafe to show the pending URL. Usually false unless |
677 // another window tries to modify the blank page. Always false after the | 683 // another window tries to modify the blank page. Always false after the |
678 // first commit. | 684 // first commit. |
679 bool has_accessed_initial_document_; | 685 bool has_accessed_initial_document_; |
680 | 686 |
681 // The current state of this RVH. | 687 // The current state of this RVH. |
| 688 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
682 RenderViewHostImplState rvh_state_; | 689 RenderViewHostImplState rvh_state_; |
683 | 690 |
684 // Routing ID for the main frame's RenderFrameHost. | 691 // Routing ID for the main frame's RenderFrameHost. |
685 int main_frame_routing_id_; | 692 int main_frame_routing_id_; |
686 | 693 |
687 // Set to true when there is a pending ViewMsg_ShouldClose message. This | 694 // Set to true when there is a pending ViewMsg_ShouldClose message. This |
688 // ensures we don't spam the renderer with multiple beforeunload requests. | 695 // ensures we don't spam the renderer with multiple beforeunload requests. |
689 // When either this value or IsWaitingForUnloadACK is true, the value of | 696 // When either this value or IsWaitingForUnloadACK is true, the value of |
690 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a | 697 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a |
691 // cross-site transition or a tab close attempt. | 698 // cross-site transition or a tab close attempt. |
692 // TODO(clamy): Remove this boolean and add one more state to the state | 699 // TODO(clamy): Remove this boolean and add one more state to the state |
693 // machine. | 700 // machine. |
| 701 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
694 bool is_waiting_for_beforeunload_ack_; | 702 bool is_waiting_for_beforeunload_ack_; |
695 | 703 |
696 // Valid only when is_waiting_for_beforeunload_ack_ or | 704 // Valid only when is_waiting_for_beforeunload_ack_ or |
697 // IsWaitingForUnloadACK is true. This tells us if the unload request | 705 // IsWaitingForUnloadACK is true. This tells us if the unload request |
698 // is for closing the entire tab ( = false), or only this RenderViewHost in | 706 // is for closing the entire tab ( = false), or only this RenderViewHost in |
699 // the case of a cross-site transition ( = true). | 707 // the case of a cross-site transition ( = true). |
| 708 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
700 bool unload_ack_is_for_cross_site_transition_; | 709 bool unload_ack_is_for_cross_site_transition_; |
701 | 710 |
702 bool are_javascript_messages_suppressed_; | 711 bool are_javascript_messages_suppressed_; |
703 | 712 |
704 // The mapping of pending javascript calls created by | 713 // The mapping of pending javascript calls created by |
705 // ExecuteJavascriptInWebFrameCallbackResult and their corresponding | 714 // ExecuteJavascriptInWebFrameCallbackResult and their corresponding |
706 // callbacks. | 715 // callbacks. |
707 std::map<int, JavascriptResultCallback> javascript_callbacks_; | 716 std::map<int, JavascriptResultCallback> javascript_callbacks_; |
708 | 717 |
709 // Accessibility callback for testing. | 718 // Accessibility callback for testing. |
710 base::Callback<void(ui::AXEvent)> accessibility_testing_callback_; | 719 base::Callback<void(ui::AXEvent)> accessibility_testing_callback_; |
711 | 720 |
712 // The most recently received accessibility tree - for testing only. | 721 // The most recently received accessibility tree - for testing only. |
713 scoped_ptr<ui::AXTree> ax_tree_; | 722 scoped_ptr<ui::AXTree> ax_tree_; |
714 | 723 |
715 // True if the render view can be shut down suddenly. | 724 // True if the render view can be shut down suddenly. |
716 bool sudden_termination_allowed_; | 725 bool sudden_termination_allowed_; |
717 | 726 |
718 // The termination status of the last render view that terminated. | 727 // The termination status of the last render view that terminated. |
719 base::TerminationStatus render_view_termination_status_; | 728 base::TerminationStatus render_view_termination_status_; |
720 | 729 |
721 // When the last ShouldClose message was sent. | 730 // When the last ShouldClose message was sent. |
| 731 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
722 base::TimeTicks send_should_close_start_time_; | 732 base::TimeTicks send_should_close_start_time_; |
723 | 733 |
724 // Set to true if we requested the on screen keyboard to be displayed. | 734 // Set to true if we requested the on screen keyboard to be displayed. |
725 bool virtual_keyboard_requested_; | 735 bool virtual_keyboard_requested_; |
726 | 736 |
727 #if defined(OS_ANDROID) | 737 #if defined(OS_ANDROID) |
728 // Manages all the android mediaplayer objects and handling IPCs for video. | 738 // Manages all the android mediaplayer objects and handling IPCs for video. |
729 scoped_ptr<BrowserMediaPlayerManager> media_player_manager_; | 739 scoped_ptr<BrowserMediaPlayerManager> media_player_manager_; |
730 #endif | 740 #endif |
731 | 741 |
732 // Used to swap out or shutdown this RVH when the unload event is taking too | 742 // Used to swap out or shutdown this RVH when the unload event is taking too |
733 // long to execute, depending on the number of active views in the | 743 // long to execute, depending on the number of active views in the |
734 // SiteInstance. | 744 // SiteInstance. |
| 745 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
735 scoped_ptr<TimeoutMonitor> unload_event_monitor_timeout_; | 746 scoped_ptr<TimeoutMonitor> unload_event_monitor_timeout_; |
736 | 747 |
737 // Called after receiving the SwapOutACK when the RVH is in state pending | 748 // Called after receiving the SwapOutACK when the RVH is in state pending |
738 // shutdown. Also called if the unload timer times out. | 749 // shutdown. Also called if the unload timer times out. |
| 750 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. |
739 base::Closure pending_shutdown_on_swap_out_; | 751 base::Closure pending_shutdown_on_swap_out_; |
740 | 752 |
741 base::WeakPtrFactory<RenderViewHostImpl> weak_factory_; | 753 base::WeakPtrFactory<RenderViewHostImpl> weak_factory_; |
742 | 754 |
743 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); | 755 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); |
744 }; | 756 }; |
745 | 757 |
746 #if defined(COMPILER_MSVC) | 758 #if defined(COMPILER_MSVC) |
747 #pragma warning(pop) | 759 #pragma warning(pop) |
748 #endif | 760 #endif |
749 | 761 |
750 } // namespace content | 762 } // namespace content |
751 | 763 |
752 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 764 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
OLD | NEW |