| 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 #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 Loading... |
| 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), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 184 accessibility_other_callback_(base::Bind(&base::DoNothing)), | 185 accessibility_other_callback_(base::Bind(&base::DoNothing)), |
| 185 sudden_termination_allowed_(false), | 186 sudden_termination_allowed_(false), |
| 186 session_storage_namespace_( | 187 session_storage_namespace_( |
| 187 static_cast<SessionStorageNamespaceImpl*>(session_storage)), | 188 static_cast<SessionStorageNamespaceImpl*>(session_storage)), |
| 188 save_accessibility_tree_for_testing_(false), | 189 save_accessibility_tree_for_testing_(false), |
| 189 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { | 190 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { |
| 190 DCHECK(session_storage_namespace_); | 191 DCHECK(session_storage_namespace_); |
| 191 DCHECK(instance_); | 192 DCHECK(instance_); |
| 192 CHECK(delegate_); // http://crbug.com/82827 | 193 CHECK(delegate_); // http://crbug.com/82827 |
| 193 | 194 |
| 195 if (main_frame_routing_id == MSG_ROUTING_NONE) |
| 196 main_frame_routing_id = GetProcess()->GetNextRoutingID(); |
| 197 |
| 198 main_render_frame_host_.reset( |
| 199 new RenderFrameHostImpl(this, main_frame_routing_id, is_swapped_out_)); |
| 200 |
| 194 GetProcess()->EnableSendQueue(); | 201 GetProcess()->EnableSendQueue(); |
| 195 | 202 |
| 196 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 203 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
| 197 g_created_callbacks.Get().at(i).Run(this); | 204 g_created_callbacks.Get().at(i).Run(this); |
| 198 | 205 |
| 199 #if defined(OS_ANDROID) | 206 #if defined(OS_ANDROID) |
| 200 media_player_manager_ = media::MediaPlayerManager::Create(this); | 207 media_player_manager_ = media::MediaPlayerManager::Create(this); |
| 201 #endif | 208 #endif |
| 202 } | 209 } |
| 203 | 210 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // page ID it might be asked to render. | 253 // page ID it might be asked to render. |
| 247 int32 next_page_id = 1; | 254 int32 next_page_id = 1; |
| 248 if (max_page_id > -1) | 255 if (max_page_id > -1) |
| 249 next_page_id = max_page_id + 1; | 256 next_page_id = max_page_id + 1; |
| 250 | 257 |
| 251 ViewMsg_New_Params params; | 258 ViewMsg_New_Params params; |
| 252 params.renderer_preferences = | 259 params.renderer_preferences = |
| 253 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); | 260 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); |
| 254 params.web_preferences = delegate_->GetWebkitPrefs(); | 261 params.web_preferences = delegate_->GetWebkitPrefs(); |
| 255 params.view_id = GetRoutingID(); | 262 params.view_id = GetRoutingID(); |
| 263 params.main_frame_routing_id = main_render_frame_host_->routing_id(); |
| 256 params.surface_id = surface_id(); | 264 params.surface_id = surface_id(); |
| 257 params.session_storage_namespace_id = session_storage_namespace_->id(); | 265 params.session_storage_namespace_id = session_storage_namespace_->id(); |
| 258 params.frame_name = frame_name; | 266 params.frame_name = frame_name; |
| 259 // Ensure the RenderView sets its opener correctly. | 267 // Ensure the RenderView sets its opener correctly. |
| 260 params.opener_route_id = opener_route_id; | 268 params.opener_route_id = opener_route_id; |
| 261 params.swapped_out = is_swapped_out_; | 269 params.swapped_out = is_swapped_out_; |
| 262 params.next_page_id = next_page_id; | 270 params.next_page_id = next_page_id; |
| 263 GetWebScreenInfo(¶ms.screen_info); | 271 GetWebScreenInfo(¶ms.screen_info); |
| 264 params.accessibility_mode = accessibility_mode(); | 272 params.accessibility_mode = accessibility_mode(); |
| 265 params.allow_partial_swap = !GetProcess()->IsGuest(); | 273 params.allow_partial_swap = !GetProcess()->IsGuest(); |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 | 1036 |
| 1029 RenderWidgetHostImpl::Shutdown(); | 1037 RenderWidgetHostImpl::Shutdown(); |
| 1030 } | 1038 } |
| 1031 | 1039 |
| 1032 bool RenderViewHostImpl::IsRenderView() const { | 1040 bool RenderViewHostImpl::IsRenderView() const { |
| 1033 return true; | 1041 return true; |
| 1034 } | 1042 } |
| 1035 | 1043 |
| 1036 void RenderViewHostImpl::CreateNewWindow( | 1044 void RenderViewHostImpl::CreateNewWindow( |
| 1037 int route_id, | 1045 int route_id, |
| 1046 int main_frame_route_id, |
| 1038 const ViewHostMsg_CreateWindow_Params& params, | 1047 const ViewHostMsg_CreateWindow_Params& params, |
| 1039 SessionStorageNamespace* session_storage_namespace) { | 1048 SessionStorageNamespace* session_storage_namespace) { |
| 1040 ViewHostMsg_CreateWindow_Params validated_params(params); | 1049 ViewHostMsg_CreateWindow_Params validated_params(params); |
| 1041 ChildProcessSecurityPolicyImpl* policy = | 1050 ChildProcessSecurityPolicyImpl* policy = |
| 1042 ChildProcessSecurityPolicyImpl::GetInstance(); | 1051 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 1043 FilterURL(policy, GetProcess(), false, &validated_params.target_url); | 1052 FilterURL(policy, GetProcess(), false, &validated_params.target_url); |
| 1044 FilterURL(policy, GetProcess(), false, &validated_params.opener_url); | 1053 FilterURL(policy, GetProcess(), false, &validated_params.opener_url); |
| 1045 FilterURL(policy, GetProcess(), true, | 1054 FilterURL(policy, GetProcess(), true, |
| 1046 &validated_params.opener_security_origin); | 1055 &validated_params.opener_security_origin); |
| 1047 | 1056 |
| 1048 delegate_->CreateNewWindow(route_id, validated_params, | 1057 delegate_->CreateNewWindow(route_id, main_frame_route_id, |
| 1049 session_storage_namespace); | 1058 validated_params, session_storage_namespace); |
| 1050 } | 1059 } |
| 1051 | 1060 |
| 1052 void RenderViewHostImpl::CreateNewWidget(int route_id, | 1061 void RenderViewHostImpl::CreateNewWidget(int route_id, |
| 1053 WebKit::WebPopupType popup_type) { | 1062 WebKit::WebPopupType popup_type) { |
| 1054 delegate_->CreateNewWidget(route_id, popup_type); | 1063 delegate_->CreateNewWidget(route_id, popup_type); |
| 1055 } | 1064 } |
| 1056 | 1065 |
| 1057 void RenderViewHostImpl::CreateNewFullscreenWidget(int route_id) { | 1066 void RenderViewHostImpl::CreateNewFullscreenWidget(int route_id) { |
| 1058 delegate_->CreateNewFullscreenWidget(route_id); | 1067 delegate_->CreateNewFullscreenWidget(route_id); |
| 1059 } | 1068 } |
| (...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2080 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); | 2089 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); |
| 2081 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); | 2090 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); |
| 2082 file != file_paths.end(); ++file) { | 2091 file != file_paths.end(); ++file) { |
| 2083 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) | 2092 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) |
| 2084 return false; | 2093 return false; |
| 2085 } | 2094 } |
| 2086 return true; | 2095 return true; |
| 2087 } | 2096 } |
| 2088 | 2097 |
| 2089 } // namespace content | 2098 } // namespace content |
| OLD | NEW |