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

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

Issue 16032007: Create RenderFrame/RenderFrameHost for the main frame of a page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added basic renderer and browser test for existence. Created 7 years, 6 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 int render_view_id) { 152 int render_view_id) {
153 return static_cast<RenderViewHostImpl*>( 153 return static_cast<RenderViewHostImpl*>(
154 RenderViewHost::FromID(render_process_id, render_view_id)); 154 RenderViewHost::FromID(render_process_id, render_view_id));
155 } 155 }
156 156
157 RenderViewHostImpl::RenderViewHostImpl( 157 RenderViewHostImpl::RenderViewHostImpl(
158 SiteInstance* instance, 158 SiteInstance* instance,
159 RenderViewHostDelegate* delegate, 159 RenderViewHostDelegate* delegate,
160 RenderWidgetHostDelegate* widget_delegate, 160 RenderWidgetHostDelegate* widget_delegate,
161 int routing_id, 161 int routing_id,
162 int main_frame_routing_id,
162 bool swapped_out, 163 bool swapped_out,
163 SessionStorageNamespace* session_storage) 164 SessionStorageNamespace* session_storage)
164 : RenderWidgetHostImpl(widget_delegate, instance->GetProcess(), routing_id), 165 : RenderWidgetHostImpl(widget_delegate, instance->GetProcess(), routing_id),
165 delegate_(delegate), 166 delegate_(delegate),
166 instance_(static_cast<SiteInstanceImpl*>(instance)), 167 instance_(static_cast<SiteInstanceImpl*>(instance)),
167 waiting_for_drag_context_response_(false), 168 waiting_for_drag_context_response_(false),
168 enabled_bindings_(0), 169 enabled_bindings_(0),
169 pending_request_id_(-1), 170 pending_request_id_(-1),
170 navigations_suspended_(false), 171 navigations_suspended_(false),
171 suspended_nav_params_(NULL), 172 suspended_nav_params_(NULL),
172 is_swapped_out_(swapped_out), 173 is_swapped_out_(swapped_out),
173 is_subframe_(false), 174 is_subframe_(false),
174 main_frame_id_(-1), 175 main_frame_id_(-1),
176 main_frame_routing_id_(main_frame_routing_id),
175 run_modal_reply_msg_(NULL), 177 run_modal_reply_msg_(NULL),
176 run_modal_opener_id_(MSG_ROUTING_NONE), 178 run_modal_opener_id_(MSG_ROUTING_NONE),
177 is_waiting_for_beforeunload_ack_(false), 179 is_waiting_for_beforeunload_ack_(false),
178 is_waiting_for_unload_ack_(false), 180 is_waiting_for_unload_ack_(false),
179 has_timed_out_on_unload_(false), 181 has_timed_out_on_unload_(false),
180 unload_ack_is_for_cross_site_transition_(false), 182 unload_ack_is_for_cross_site_transition_(false),
181 are_javascript_messages_suppressed_(false), 183 are_javascript_messages_suppressed_(false),
182 accessibility_layout_callback_(base::Bind(&base::DoNothing)), 184 accessibility_layout_callback_(base::Bind(&base::DoNothing)),
183 accessibility_load_callback_(base::Bind(&base::DoNothing)), 185 accessibility_load_callback_(base::Bind(&base::DoNothing)),
184 accessibility_other_callback_(base::Bind(&base::DoNothing)), 186 accessibility_other_callback_(base::Bind(&base::DoNothing)),
185 sudden_termination_allowed_(false), 187 sudden_termination_allowed_(false),
186 session_storage_namespace_( 188 session_storage_namespace_(
187 static_cast<SessionStorageNamespaceImpl*>(session_storage)), 189 static_cast<SessionStorageNamespaceImpl*>(session_storage)),
188 save_accessibility_tree_for_testing_(false), 190 save_accessibility_tree_for_testing_(false),
189 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { 191 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) {
190 DCHECK(session_storage_namespace_); 192 DCHECK(session_storage_namespace_);
191 DCHECK(instance_); 193 DCHECK(instance_);
192 CHECK(delegate_); // http://crbug.com/82827 194 CHECK(delegate_); // http://crbug.com/82827
193 195
196 if (main_frame_routing_id_ == MSG_ROUTING_NONE) {
197 main_frame_routing_id_ = GetProcess()->GetNextRoutingID();
198 }
199 main_render_frame_host_.reset(
200 new RenderFrameHostImpl(this, main_frame_routing_id_, is_swapped_out_));
201
194 GetProcess()->EnableSendQueue(); 202 GetProcess()->EnableSendQueue();
195 203
196 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) 204 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
197 g_created_callbacks.Get().at(i).Run(this); 205 g_created_callbacks.Get().at(i).Run(this);
198 206
199 #if defined(OS_ANDROID) 207 #if defined(OS_ANDROID)
200 media_player_manager_ = media::MediaPlayerManager::Create(this); 208 media_player_manager_ = media::MediaPlayerManager::Create(this);
201 #endif 209 #endif
202 } 210 }
203 211
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // page ID it might be asked to render. 254 // page ID it might be asked to render.
247 int32 next_page_id = 1; 255 int32 next_page_id = 1;
248 if (max_page_id > -1) 256 if (max_page_id > -1)
249 next_page_id = max_page_id + 1; 257 next_page_id = max_page_id + 1;
250 258
251 ViewMsg_New_Params params; 259 ViewMsg_New_Params params;
252 params.renderer_preferences = 260 params.renderer_preferences =
253 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); 261 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext());
254 params.web_preferences = delegate_->GetWebkitPrefs(); 262 params.web_preferences = delegate_->GetWebkitPrefs();
255 params.view_id = GetRoutingID(); 263 params.view_id = GetRoutingID();
264 params.main_frame_routing_id = main_frame_routing_id_;
256 params.surface_id = surface_id(); 265 params.surface_id = surface_id();
257 params.session_storage_namespace_id = session_storage_namespace_->id(); 266 params.session_storage_namespace_id = session_storage_namespace_->id();
258 params.frame_name = frame_name; 267 params.frame_name = frame_name;
259 // Ensure the RenderView sets its opener correctly. 268 // Ensure the RenderView sets its opener correctly.
260 params.opener_route_id = opener_route_id; 269 params.opener_route_id = opener_route_id;
261 params.swapped_out = is_swapped_out_; 270 params.swapped_out = is_swapped_out_;
262 params.next_page_id = next_page_id; 271 params.next_page_id = next_page_id;
263 GetWebScreenInfo(&params.screen_info); 272 GetWebScreenInfo(&params.screen_info);
264 params.accessibility_mode = accessibility_mode(); 273 params.accessibility_mode = accessibility_mode();
265 params.allow_partial_swap = !GetProcess()->IsGuest(); 274 params.allow_partial_swap = !GetProcess()->IsGuest();
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 1037
1029 RenderWidgetHostImpl::Shutdown(); 1038 RenderWidgetHostImpl::Shutdown();
1030 } 1039 }
1031 1040
1032 bool RenderViewHostImpl::IsRenderView() const { 1041 bool RenderViewHostImpl::IsRenderView() const {
1033 return true; 1042 return true;
1034 } 1043 }
1035 1044
1036 void RenderViewHostImpl::CreateNewWindow( 1045 void RenderViewHostImpl::CreateNewWindow(
1037 int route_id, 1046 int route_id,
1047 int main_frame_route_id,
1038 const ViewHostMsg_CreateWindow_Params& params, 1048 const ViewHostMsg_CreateWindow_Params& params,
1039 SessionStorageNamespace* session_storage_namespace) { 1049 SessionStorageNamespace* session_storage_namespace) {
1040 ViewHostMsg_CreateWindow_Params validated_params(params); 1050 ViewHostMsg_CreateWindow_Params validated_params(params);
1041 ChildProcessSecurityPolicyImpl* policy = 1051 ChildProcessSecurityPolicyImpl* policy =
1042 ChildProcessSecurityPolicyImpl::GetInstance(); 1052 ChildProcessSecurityPolicyImpl::GetInstance();
1043 FilterURL(policy, GetProcess(), false, &validated_params.target_url); 1053 FilterURL(policy, GetProcess(), false, &validated_params.target_url);
1044 FilterURL(policy, GetProcess(), false, &validated_params.opener_url); 1054 FilterURL(policy, GetProcess(), false, &validated_params.opener_url);
1045 FilterURL(policy, GetProcess(), true, 1055 FilterURL(policy, GetProcess(), true,
1046 &validated_params.opener_security_origin); 1056 &validated_params.opener_security_origin);
1047 1057
1048 delegate_->CreateNewWindow(route_id, validated_params, 1058 delegate_->CreateNewWindow(route_id, main_frame_route_id,
1049 session_storage_namespace); 1059 validated_params, session_storage_namespace);
1050 } 1060 }
1051 1061
1052 void RenderViewHostImpl::CreateNewWidget(int route_id, 1062 void RenderViewHostImpl::CreateNewWidget(int route_id,
1053 WebKit::WebPopupType popup_type) { 1063 WebKit::WebPopupType popup_type) {
1054 delegate_->CreateNewWidget(route_id, popup_type); 1064 delegate_->CreateNewWidget(route_id, popup_type);
1055 } 1065 }
1056 1066
1057 void RenderViewHostImpl::CreateNewFullscreenWidget(int route_id) { 1067 void RenderViewHostImpl::CreateNewFullscreenWidget(int route_id) {
1058 delegate_->CreateNewFullscreenWidget(route_id); 1068 delegate_->CreateNewFullscreenWidget(route_id);
1059 } 1069 }
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); 2090 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles();
2081 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); 2091 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin();
2082 file != file_paths.end(); ++file) { 2092 file != file_paths.end(); ++file) {
2083 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) 2093 if (!policy->CanReadFile(GetProcess()->GetID(), *file))
2084 return false; 2094 return false;
2085 } 2095 }
2086 return true; 2096 return true;
2087 } 2097 }
2088 2098
2089 } // namespace content 2099 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698