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 FrameMsg_Navigate; | 35 class ViewMsg_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 FrameMsg_Navigate_Params; | 43 struct ViewMsg_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 // TODO(nasko): Remove this method once all callers are converted to use | 280 void Navigate(const ViewMsg_Navigate_Params& message); |
281 // RenderFrameHostImpl. | |
282 void Navigate(const FrameMsg_Navigate_Params& message); | |
283 | 281 |
284 // Load the specified URL, this is a shortcut for Navigate(). | 282 // 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. | |
287 void NavigateToURL(const GURL& url); | 283 void NavigateToURL(const GURL& url); |
288 | 284 |
289 // Returns whether navigation messages are currently suspended for this | 285 // Returns whether navigation messages are currently suspended for this |
290 // RenderViewHost. Only true during a cross-site navigation, while waiting | 286 // RenderViewHost. Only true during a cross-site navigation, while waiting |
291 // for the onbeforeunload handler. | 287 // for the onbeforeunload handler. |
292 bool are_navigations_suspended() const { return navigations_suspended_; } | 288 bool are_navigations_suspended() const { return navigations_suspended_; } |
293 | 289 |
294 // Suspends (or unsuspends) any navigation messages from being sent from this | 290 // Suspends (or unsuspends) any navigation messages from being sent from this |
295 // RenderViewHost. This is called when a pending RenderViewHost is created | 291 // RenderViewHost. This is called when a pending RenderViewHost is created |
296 // for a cross-site navigation, because we must suspend any navigations until | 292 // 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... |
661 bool waiting_for_drag_context_response_; | 657 bool waiting_for_drag_context_response_; |
662 | 658 |
663 // A bitwise OR of bindings types that have been enabled for this RenderView. | 659 // A bitwise OR of bindings types that have been enabled for this RenderView. |
664 // See BindingsPolicy for details. | 660 // See BindingsPolicy for details. |
665 int enabled_bindings_; | 661 int enabled_bindings_; |
666 | 662 |
667 // Whether we should buffer outgoing Navigate messages rather than sending | 663 // Whether we should buffer outgoing Navigate messages rather than sending |
668 // them. This will be true when a RenderViewHost is created for a cross-site | 664 // them. This will be true when a RenderViewHost is created for a cross-site |
669 // request, until we hear back from the onbeforeunload handler of the old | 665 // request, until we hear back from the onbeforeunload handler of the old |
670 // RenderViewHost. | 666 // RenderViewHost. |
671 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | |
672 bool navigations_suspended_; | 667 bool navigations_suspended_; |
673 | 668 |
674 // We only buffer the params for a suspended navigation while we have a | 669 // We only buffer the params for a suspended navigation while we have a |
675 // pending RVH for a WebContentsImpl. There will only ever be one suspended | 670 // pending RVH for a WebContentsImpl. There will only ever be one suspended |
676 // navigation, because WebContentsImpl will destroy the pending RVH and create | 671 // navigation, because WebContentsImpl will destroy the pending RVH and create |
677 // a new one if a second navigation occurs. | 672 // a new one if a second navigation occurs. |
678 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | 673 scoped_ptr<ViewMsg_Navigate_Params> suspended_nav_params_; |
679 scoped_ptr<FrameMsg_Navigate_Params> suspended_nav_params_; | |
680 | 674 |
681 // Whether the initial empty page of this view has been accessed by another | 675 // Whether the initial empty page of this view has been accessed by another |
682 // page, making it unsafe to show the pending URL. Usually false unless | 676 // page, making it unsafe to show the pending URL. Usually false unless |
683 // another window tries to modify the blank page. Always false after the | 677 // another window tries to modify the blank page. Always false after the |
684 // first commit. | 678 // first commit. |
685 bool has_accessed_initial_document_; | 679 bool has_accessed_initial_document_; |
686 | 680 |
687 // The current state of this RVH. | 681 // The current state of this RVH. |
688 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | |
689 RenderViewHostImplState rvh_state_; | 682 RenderViewHostImplState rvh_state_; |
690 | 683 |
691 // Routing ID for the main frame's RenderFrameHost. | 684 // Routing ID for the main frame's RenderFrameHost. |
692 int main_frame_routing_id_; | 685 int main_frame_routing_id_; |
693 | 686 |
694 // Set to true when there is a pending ViewMsg_ShouldClose message. This | 687 // Set to true when there is a pending ViewMsg_ShouldClose message. This |
695 // ensures we don't spam the renderer with multiple beforeunload requests. | 688 // ensures we don't spam the renderer with multiple beforeunload requests. |
696 // When either this value or IsWaitingForUnloadACK is true, the value of | 689 // When either this value or IsWaitingForUnloadACK is true, the value of |
697 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a | 690 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a |
698 // cross-site transition or a tab close attempt. | 691 // cross-site transition or a tab close attempt. |
699 // TODO(clamy): Remove this boolean and add one more state to the state | 692 // TODO(clamy): Remove this boolean and add one more state to the state |
700 // machine. | 693 // machine. |
701 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | |
702 bool is_waiting_for_beforeunload_ack_; | 694 bool is_waiting_for_beforeunload_ack_; |
703 | 695 |
704 // Valid only when is_waiting_for_beforeunload_ack_ or | 696 // Valid only when is_waiting_for_beforeunload_ack_ or |
705 // IsWaitingForUnloadACK is true. This tells us if the unload request | 697 // IsWaitingForUnloadACK is true. This tells us if the unload request |
706 // is for closing the entire tab ( = false), or only this RenderViewHost in | 698 // is for closing the entire tab ( = false), or only this RenderViewHost in |
707 // the case of a cross-site transition ( = true). | 699 // the case of a cross-site transition ( = true). |
708 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | |
709 bool unload_ack_is_for_cross_site_transition_; | 700 bool unload_ack_is_for_cross_site_transition_; |
710 | 701 |
711 bool are_javascript_messages_suppressed_; | 702 bool are_javascript_messages_suppressed_; |
712 | 703 |
713 // The mapping of pending javascript calls created by | 704 // The mapping of pending javascript calls created by |
714 // ExecuteJavascriptInWebFrameCallbackResult and their corresponding | 705 // ExecuteJavascriptInWebFrameCallbackResult and their corresponding |
715 // callbacks. | 706 // callbacks. |
716 std::map<int, JavascriptResultCallback> javascript_callbacks_; | 707 std::map<int, JavascriptResultCallback> javascript_callbacks_; |
717 | 708 |
718 // Accessibility callback for testing. | 709 // Accessibility callback for testing. |
719 base::Callback<void(ui::AXEvent)> accessibility_testing_callback_; | 710 base::Callback<void(ui::AXEvent)> accessibility_testing_callback_; |
720 | 711 |
721 // The most recently received accessibility tree - for testing only. | 712 // The most recently received accessibility tree - for testing only. |
722 scoped_ptr<ui::AXTree> ax_tree_; | 713 scoped_ptr<ui::AXTree> ax_tree_; |
723 | 714 |
724 // True if the render view can be shut down suddenly. | 715 // True if the render view can be shut down suddenly. |
725 bool sudden_termination_allowed_; | 716 bool sudden_termination_allowed_; |
726 | 717 |
727 // The termination status of the last render view that terminated. | 718 // The termination status of the last render view that terminated. |
728 base::TerminationStatus render_view_termination_status_; | 719 base::TerminationStatus render_view_termination_status_; |
729 | 720 |
730 // When the last ShouldClose message was sent. | 721 // When the last ShouldClose message was sent. |
731 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | |
732 base::TimeTicks send_should_close_start_time_; | 722 base::TimeTicks send_should_close_start_time_; |
733 | 723 |
734 // Set to true if we requested the on screen keyboard to be displayed. | 724 // Set to true if we requested the on screen keyboard to be displayed. |
735 bool virtual_keyboard_requested_; | 725 bool virtual_keyboard_requested_; |
736 | 726 |
737 #if defined(OS_ANDROID) | 727 #if defined(OS_ANDROID) |
738 // Manages all the android mediaplayer objects and handling IPCs for video. | 728 // Manages all the android mediaplayer objects and handling IPCs for video. |
739 scoped_ptr<BrowserMediaPlayerManager> media_player_manager_; | 729 scoped_ptr<BrowserMediaPlayerManager> media_player_manager_; |
740 #endif | 730 #endif |
741 | 731 |
742 // Used to swap out or shutdown this RVH when the unload event is taking too | 732 // Used to swap out or shutdown this RVH when the unload event is taking too |
743 // long to execute, depending on the number of active views in the | 733 // long to execute, depending on the number of active views in the |
744 // SiteInstance. | 734 // SiteInstance. |
745 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | |
746 scoped_ptr<TimeoutMonitor> unload_event_monitor_timeout_; | 735 scoped_ptr<TimeoutMonitor> unload_event_monitor_timeout_; |
747 | 736 |
748 // Called after receiving the SwapOutACK when the RVH is in state pending | 737 // Called after receiving the SwapOutACK when the RVH is in state pending |
749 // shutdown. Also called if the unload timer times out. | 738 // shutdown. Also called if the unload timer times out. |
750 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state. | |
751 base::Closure pending_shutdown_on_swap_out_; | 739 base::Closure pending_shutdown_on_swap_out_; |
752 | 740 |
753 base::WeakPtrFactory<RenderViewHostImpl> weak_factory_; | 741 base::WeakPtrFactory<RenderViewHostImpl> weak_factory_; |
754 | 742 |
755 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); | 743 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); |
756 }; | 744 }; |
757 | 745 |
758 #if defined(COMPILER_MSVC) | 746 #if defined(COMPILER_MSVC) |
759 #pragma warning(pop) | 747 #pragma warning(pop) |
760 #endif | 748 #endif |
761 | 749 |
762 } // namespace content | 750 } // namespace content |
763 | 751 |
764 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ | 752 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ |
OLD | NEW |