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

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

Issue 22876014: Make RenderFrame{Host} objects routable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bleck Created 7 years, 3 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 #include "content/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 g_created_callbacks = LAZY_INSTANCE_INITIALIZER; 109 g_created_callbacks = LAZY_INSTANCE_INITIALIZER;
110 110
111 } // namespace 111 } // namespace
112 112
113 /////////////////////////////////////////////////////////////////////////////// 113 ///////////////////////////////////////////////////////////////////////////////
114 // RenderViewHost, public: 114 // RenderViewHost, public:
115 115
116 // static 116 // static
117 RenderViewHost* RenderViewHost::FromID(int render_process_id, 117 RenderViewHost* RenderViewHost::FromID(int render_process_id,
118 int render_view_id) { 118 int render_view_id) {
119 RenderWidgetHost* widget = 119 return RenderViewHostImpl::FromID(render_process_id, render_view_id);
120 RenderWidgetHost::FromID(render_process_id, render_view_id);
121 if (!widget || !widget->IsRenderView())
122 return NULL;
123 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(widget));
124 } 120 }
125 121
126 // static 122 // static
127 RenderViewHost* RenderViewHost::From(RenderWidgetHost* rwh) { 123 RenderViewHost* RenderViewHost::From(RenderWidgetHost* rwh) {
128 DCHECK(rwh->IsRenderView()); 124 DCHECK(rwh->IsRenderView());
129 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(rwh)); 125 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(rwh));
130 } 126 }
131 127
132 // static 128 // static
133 void RenderViewHost::FilterURL(const RenderProcessHost* process, 129 void RenderViewHost::FilterURL(const RenderProcessHost* process,
134 bool empty_allowed, 130 bool empty_allowed,
135 GURL* url) { 131 GURL* url) {
136 RenderViewHostImpl::FilterURL(ChildProcessSecurityPolicyImpl::GetInstance(), 132 RenderViewHostImpl::FilterURL(ChildProcessSecurityPolicyImpl::GetInstance(),
137 process, empty_allowed, url); 133 process, empty_allowed, url);
138 } 134 }
139 135
140 /////////////////////////////////////////////////////////////////////////////// 136 ///////////////////////////////////////////////////////////////////////////////
141 // RenderViewHostImpl, public: 137 // RenderViewHostImpl, public:
142 138
143 // static 139 // static
144 RenderViewHostImpl* RenderViewHostImpl::FromID(int render_process_id, 140 RenderViewHostImpl* RenderViewHostImpl::FromID(int render_process_id,
145 int render_view_id) { 141 int render_view_id) {
146 return static_cast<RenderViewHostImpl*>( 142 RenderWidgetHost* widget =
147 RenderViewHost::FromID(render_process_id, render_view_id)); 143 RenderWidgetHost::FromID(render_process_id, render_view_id);
144 if (!widget || !widget->IsRenderView())
145 return NULL;
146 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(widget));
148 } 147 }
149 148
150 RenderViewHostImpl::RenderViewHostImpl( 149 RenderViewHostImpl::RenderViewHostImpl(
151 SiteInstance* instance, 150 SiteInstance* instance,
152 RenderViewHostDelegate* delegate, 151 RenderViewHostDelegate* delegate,
153 RenderWidgetHostDelegate* widget_delegate, 152 RenderWidgetHostDelegate* widget_delegate,
154 int routing_id, 153 int routing_id,
155 int main_frame_routing_id, 154 int main_frame_routing_id,
156 bool swapped_out, 155 bool swapped_out,
157 bool hidden) 156 bool hidden)
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 if (!msg_is_ok) { 1014 if (!msg_is_ok) {
1016 // The message had a handler, but its de-serialization failed. 1015 // The message had a handler, but its de-serialization failed.
1017 // Kill the renderer. 1016 // Kill the renderer.
1018 RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); 1017 RecordAction(UserMetricsAction("BadMessageTerminate_RVH"));
1019 GetProcess()->ReceivedBadMessage(); 1018 GetProcess()->ReceivedBadMessage();
1020 } 1019 }
1021 1020
1022 return handled; 1021 return handled;
1023 } 1022 }
1024 1023
1024 void RenderViewHostImpl::Init() {
1025 RenderWidgetHostImpl::Init();
1026 main_render_frame_host()->Init();
1027 }
1028
1025 void RenderViewHostImpl::Shutdown() { 1029 void RenderViewHostImpl::Shutdown() {
1026 // If we are being run modally (see RunModal), then we need to cleanup. 1030 // If we are being run modally (see RunModal), then we need to cleanup.
1027 if (run_modal_reply_msg_) { 1031 if (run_modal_reply_msg_) {
1028 Send(run_modal_reply_msg_); 1032 Send(run_modal_reply_msg_);
1029 run_modal_reply_msg_ = NULL; 1033 run_modal_reply_msg_ = NULL;
1030 RenderViewHostImpl* opener = 1034 RenderViewHostImpl* opener =
1031 RenderViewHostImpl::FromID(GetProcess()->GetID(), run_modal_opener_id_); 1035 RenderViewHostImpl::FromID(GetProcess()->GetID(), run_modal_opener_id_);
1032 if (opener) { 1036 if (opener) {
1033 opener->StartHangMonitorTimeout(TimeDelta::FromMilliseconds( 1037 opener->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(
1034 hung_renderer_delay_ms_)); 1038 hung_renderer_delay_ms_));
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 params.item_height, 2028 params.item_height,
2025 params.item_font_size, 2029 params.item_font_size,
2026 params.selected_item, 2030 params.selected_item,
2027 params.popup_items, 2031 params.popup_items,
2028 params.right_aligned, 2032 params.right_aligned,
2029 params.allow_multiple_selection); 2033 params.allow_multiple_selection);
2030 } 2034 }
2031 } 2035 }
2032 #endif 2036 #endif
2033 2037
2038 RenderFrameHostImpl* RenderViewHostImpl::main_render_frame_host() const {
2039 DCHECK_EQ(GetProcess(), main_render_frame_host_->GetProcess());
2040 return main_render_frame_host_.get();
2041 }
2042
2034 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) { 2043 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) {
2035 // We update the number of RenderViews in a SiteInstance when the 2044 // We update the number of RenderViews in a SiteInstance when the
2036 // swapped out status of this RenderView gets flipped. 2045 // swapped out status of this RenderView gets flipped.
2037 if (is_swapped_out_ && !is_swapped_out) 2046 if (is_swapped_out_ && !is_swapped_out)
2038 instance_->increment_active_view_count(); 2047 instance_->increment_active_view_count();
2039 else if (!is_swapped_out_ && is_swapped_out) 2048 else if (!is_swapped_out_ && is_swapped_out)
2040 instance_->decrement_active_view_count(); 2049 instance_->decrement_active_view_count();
2041 2050
2042 is_swapped_out_ = is_swapped_out; 2051 is_swapped_out_ = is_swapped_out;
2043 2052
(...skipping 13 matching lines...) Expand all
2057 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); 2066 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles();
2058 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); 2067 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin();
2059 file != file_paths.end(); ++file) { 2068 file != file_paths.end(); ++file) {
2060 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) 2069 if (!policy->CanReadFile(GetProcess()->GetID(), *file))
2061 return false; 2070 return false;
2062 } 2071 }
2063 return true; 2072 return true;
2064 } 2073 }
2065 2074
2066 } // namespace content 2075 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/browser/renderer_host/render_view_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698