Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(693)

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.h

Issue 148083013: Move browser initiated navigation from RenderViewHost to RenderFrameHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another one bites the dust. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // Returns the content specific prefs for this RenderViewHost. 269 // Returns the content specific prefs for this RenderViewHost.
270 WebPreferences GetWebkitPrefs(const GURL& url); 270 WebPreferences GetWebkitPrefs(const GURL& url);
271 271
272 // Sends the given navigation message. Use this rather than sending it 272 // Sends the given navigation message. Use this rather than sending it
273 // yourself since this does the internal bookkeeping described below. This 273 // yourself since this does the internal bookkeeping described below. This
274 // function takes ownership of the provided message pointer. 274 // function takes ownership of the provided message pointer.
275 // 275 //
276 // If a cross-site request is in progress, we may be suspended while waiting 276 // If a cross-site request is in progress, we may be suspended while waiting
277 // for the onbeforeunload handler, so this function might buffer the message 277 // for the onbeforeunload handler, so this function might buffer the message
278 // rather than sending it. 278 // rather than sending it.
279 void Navigate(const ViewMsg_Navigate_Params& message); 279 // TODO(nasko): Remove this method once all callers are converted to use
280 // RenderFrameHostImpl.
281 void Navigate(const FrameMsg_Navigate_Params& message);
280 282
281 // Load the specified URL, this is a shortcut for Navigate(). 283 // Load the specified URL, this is a shortcut for Navigate().
284 // TODO(nasko): Remove this method once all callers are converted to use
285 // RenderFrameHostImpl.
282 void NavigateToURL(const GURL& url); 286 void NavigateToURL(const GURL& url);
283 287
284 // Returns whether navigation messages are currently suspended for this 288 // Returns whether navigation messages are currently suspended for this
285 // RenderViewHost. Only true during a cross-site navigation, while waiting 289 // RenderViewHost. Only true during a cross-site navigation, while waiting
286 // for the onbeforeunload handler. 290 // for the onbeforeunload handler.
287 bool are_navigations_suspended() const { return navigations_suspended_; } 291 bool are_navigations_suspended() const { return navigations_suspended_; }
288 292
289 // Suspends (or unsuspends) any navigation messages from being sent from this 293 // Suspends (or unsuspends) any navigation messages from being sent from this
290 // RenderViewHost. This is called when a pending RenderViewHost is created 294 // RenderViewHost. This is called when a pending RenderViewHost is created
291 // for a cross-site navigation, because we must suspend any navigations until 295 // for a cross-site navigation, because we must suspend any navigations until
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 bool waiting_for_drag_context_response_; 670 bool waiting_for_drag_context_response_;
667 671
668 // A bitwise OR of bindings types that have been enabled for this RenderView. 672 // A bitwise OR of bindings types that have been enabled for this RenderView.
669 // See BindingsPolicy for details. 673 // See BindingsPolicy for details.
670 int enabled_bindings_; 674 int enabled_bindings_;
671 675
672 // Whether we should buffer outgoing Navigate messages rather than sending 676 // Whether we should buffer outgoing Navigate messages rather than sending
673 // them. This will be true when a RenderViewHost is created for a cross-site 677 // them. This will be true when a RenderViewHost is created for a cross-site
674 // request, until we hear back from the onbeforeunload handler of the old 678 // request, until we hear back from the onbeforeunload handler of the old
675 // RenderViewHost. 679 // RenderViewHost.
680 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
676 bool navigations_suspended_; 681 bool navigations_suspended_;
677 682
678 // We only buffer the params for a suspended navigation while we have a 683 // We only buffer the params for a suspended navigation while we have a
679 // pending RVH for a WebContentsImpl. There will only ever be one suspended 684 // pending RVH for a WebContentsImpl. There will only ever be one suspended
680 // navigation, because WebContentsImpl will destroy the pending RVH and create 685 // navigation, because WebContentsImpl will destroy the pending RVH and create
681 // a new one if a second navigation occurs. 686 // a new one if a second navigation occurs.
682 scoped_ptr<ViewMsg_Navigate_Params> suspended_nav_params_; 687 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
688 scoped_ptr<FrameMsg_Navigate_Params> suspended_nav_params_;
683 689
684 // Whether the initial empty page of this view has been accessed by another 690 // Whether the initial empty page of this view has been accessed by another
685 // page, making it unsafe to show the pending URL. Usually false unless 691 // page, making it unsafe to show the pending URL. Usually false unless
686 // another window tries to modify the blank page. Always false after the 692 // another window tries to modify the blank page. Always false after the
687 // first commit. 693 // first commit.
688 bool has_accessed_initial_document_; 694 bool has_accessed_initial_document_;
689 695
690 // The current state of this RVH. 696 // The current state of this RVH.
697 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
691 RenderViewHostImplState rvh_state_; 698 RenderViewHostImplState rvh_state_;
692 699
693 // The frame id of the main (top level) frame. This value is set on the 700 // The frame id of the main (top level) frame. This value is set on the
694 // initial navigation of a RenderView and reset when the RenderView's 701 // initial navigation of a RenderView and reset when the RenderView's
695 // process is terminated (in RenderProcessGone). 702 // process is terminated (in RenderProcessGone).
696 // TODO(creis): Remove this when we switch to routing IDs for frames. 703 // TODO(creis): Remove this when we switch to routing IDs for frames.
697 int64 main_frame_id_; 704 int64 main_frame_id_;
698 705
699 // Routing ID for the main frame's RenderFrameHost. 706 // Routing ID for the main frame's RenderFrameHost.
700 int main_frame_routing_id_; 707 int main_frame_routing_id_;
701 708
702 // If we were asked to RunModal, then this will hold the reply_msg that we 709 // If we were asked to RunModal, then this will hold the reply_msg that we
703 // must return to the renderer to unblock it. 710 // must return to the renderer to unblock it.
704 IPC::Message* run_modal_reply_msg_; 711 IPC::Message* run_modal_reply_msg_;
705 // This will hold the routing id of the RenderView that opened us. 712 // This will hold the routing id of the RenderView that opened us.
706 int run_modal_opener_id_; 713 int run_modal_opener_id_;
707 714
708 // Set to true when there is a pending ViewMsg_ShouldClose message. This 715 // Set to true when there is a pending ViewMsg_ShouldClose message. This
709 // ensures we don't spam the renderer with multiple beforeunload requests. 716 // ensures we don't spam the renderer with multiple beforeunload requests.
710 // When either this value or IsWaitingForUnloadACK is true, the value of 717 // When either this value or IsWaitingForUnloadACK is true, the value of
711 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a 718 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a
712 // cross-site transition or a tab close attempt. 719 // cross-site transition or a tab close attempt.
713 // TODO(clamy): Remove this boolean and add one more state to the state 720 // TODO(clamy): Remove this boolean and add one more state to the state
714 // machine. 721 // machine.
722 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
715 bool is_waiting_for_beforeunload_ack_; 723 bool is_waiting_for_beforeunload_ack_;
716 724
717 // Valid only when is_waiting_for_beforeunload_ack_ or 725 // Valid only when is_waiting_for_beforeunload_ack_ or
718 // IsWaitingForUnloadACK is true. This tells us if the unload request 726 // IsWaitingForUnloadACK is true. This tells us if the unload request
719 // is for closing the entire tab ( = false), or only this RenderViewHost in 727 // is for closing the entire tab ( = false), or only this RenderViewHost in
720 // the case of a cross-site transition ( = true). 728 // the case of a cross-site transition ( = true).
729 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
721 bool unload_ack_is_for_cross_site_transition_; 730 bool unload_ack_is_for_cross_site_transition_;
722 731
723 bool are_javascript_messages_suppressed_; 732 bool are_javascript_messages_suppressed_;
724 733
725 // The mapping of pending javascript calls created by 734 // The mapping of pending javascript calls created by
726 // ExecuteJavascriptInWebFrameCallbackResult and their corresponding 735 // ExecuteJavascriptInWebFrameCallbackResult and their corresponding
727 // callbacks. 736 // callbacks.
728 std::map<int, JavascriptResultCallback> javascript_callbacks_; 737 std::map<int, JavascriptResultCallback> javascript_callbacks_;
729 738
730 // Accessibility callback for testing. 739 // Accessibility callback for testing.
731 base::Callback<void(ui::AXEvent)> accessibility_testing_callback_; 740 base::Callback<void(ui::AXEvent)> accessibility_testing_callback_;
732 741
733 // The most recently received accessibility tree - for testing only. 742 // The most recently received accessibility tree - for testing only.
734 scoped_ptr<ui::AXTree> ax_tree_; 743 scoped_ptr<ui::AXTree> ax_tree_;
735 744
736 // True if the render view can be shut down suddenly. 745 // True if the render view can be shut down suddenly.
737 bool sudden_termination_allowed_; 746 bool sudden_termination_allowed_;
738 747
739 // The termination status of the last render view that terminated. 748 // The termination status of the last render view that terminated.
740 base::TerminationStatus render_view_termination_status_; 749 base::TerminationStatus render_view_termination_status_;
741 750
742 // When the last ShouldClose message was sent. 751 // When the last ShouldClose message was sent.
752 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
743 base::TimeTicks send_should_close_start_time_; 753 base::TimeTicks send_should_close_start_time_;
744 754
745 // Set to true if we requested the on screen keyboard to be displayed. 755 // Set to true if we requested the on screen keyboard to be displayed.
746 bool virtual_keyboard_requested_; 756 bool virtual_keyboard_requested_;
747 757
748 #if defined(OS_ANDROID) 758 #if defined(OS_ANDROID)
749 // Manages all the android mediaplayer objects and handling IPCs for video. 759 // Manages all the android mediaplayer objects and handling IPCs for video.
750 scoped_ptr<BrowserMediaPlayerManager> media_player_manager_; 760 scoped_ptr<BrowserMediaPlayerManager> media_player_manager_;
751 #endif 761 #endif
752 762
753 // Used to swap out or shutdown this RVH when the unload event is taking too 763 // Used to swap out or shutdown this RVH when the unload event is taking too
754 // long to execute, depending on the number of active views in the 764 // long to execute, depending on the number of active views in the
755 // SiteInstance. 765 // SiteInstance.
766 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
756 scoped_ptr<TimeoutMonitor> unload_event_monitor_timeout_; 767 scoped_ptr<TimeoutMonitor> unload_event_monitor_timeout_;
757 768
758 // Called after receiving the SwapOutACK when the RVH is in state pending 769 // Called after receiving the SwapOutACK when the RVH is in state pending
759 // shutdown. Also called if the unload timer times out. 770 // shutdown. Also called if the unload timer times out.
771 // TODO(nasko): Move to RenderFrameHost, as this is per-frame state.
760 base::Closure pending_shutdown_on_swap_out_; 772 base::Closure pending_shutdown_on_swap_out_;
761 773
762 base::WeakPtrFactory<RenderViewHostImpl> weak_factory_; 774 base::WeakPtrFactory<RenderViewHostImpl> weak_factory_;
763 775
764 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl); 776 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImpl);
765 }; 777 };
766 778
767 #if defined(COMPILER_MSVC) 779 #if defined(COMPILER_MSVC)
768 #pragma warning(pop) 780 #pragma warning(pop)
769 #endif 781 #endif
770 782
771 } // namespace content 783 } // namespace content
772 784
773 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_ 785 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698