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

Side by Side Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 42054: Stop using renderer specific host ids in ResourceDispatcher. This allows it ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_view_host.h" 5 #include "chrome/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/gfx/native_widget_types.h" 10 #include "base/gfx/native_widget_types.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 RenderViewHost::~RenderViewHost() { 114 RenderViewHost::~RenderViewHost() {
115 OnDebugDisconnect(); 115 OnDebugDisconnect();
116 116
117 #ifdef CHROME_PERSONALIZATION 117 #ifdef CHROME_PERSONALIZATION
118 Personalization::CleanupHostPersonalization(personalization_); 118 Personalization::CleanupHostPersonalization(personalization_);
119 personalization_ = NULL; 119 personalization_ = NULL;
120 #endif 120 #endif
121 121
122 // Be sure to clean up any leftover state from cross-site requests. 122 // Be sure to clean up any leftover state from cross-site requests.
123 Singleton<CrossSiteRequestManager>()->SetHasPendingCrossSiteRequest( 123 Singleton<CrossSiteRequestManager>()->SetHasPendingCrossSiteRequest(
124 process()->host_id(), routing_id(), false); 124 process()->pid(), routing_id(), false);
125 125
126 NotificationService::current()->Notify( 126 NotificationService::current()->Notify(
127 NotificationType::RENDER_VIEW_HOST_DELETED, 127 NotificationType::RENDER_VIEW_HOST_DELETED,
128 Source<RenderViewHost>(this), 128 Source<RenderViewHost>(this),
129 NotificationService::NoDetails()); 129 NotificationService::NoDetails());
130 } 130 }
131 131
132 bool RenderViewHost::CreateRenderView() { 132 bool RenderViewHost::CreateRenderView() {
133 DCHECK(!IsRenderViewLive()) << "Creating view twice"; 133 DCHECK(!IsRenderViewLive()) << "Creating view twice";
134 134
135 // The process may (if we're sharing a process with another host that already 135 // The process may (if we're sharing a process with another host that already
136 // initialized it) or may not (we have our own process or the old process 136 // initialized it) or may not (we have our own process or the old process
137 // crashed) have been initialized. Calling Init multiple times will be 137 // crashed) have been initialized. Calling Init multiple times will be
138 // ignored, so this is safe. 138 // ignored, so this is safe.
139 if (!process()->Init()) 139 if (!process()->Init())
140 return false; 140 return false;
141 DCHECK(process()->channel()); 141 DCHECK(process()->channel());
142 DCHECK(process()->profile()); 142 DCHECK(process()->profile());
143 143
144 if (enabled_bindings_ & BindingsPolicy::DOM_UI) {
145 RendererSecurityPolicy::GetInstance()->GrantDOMUIBindings(
146 process()->pid());
147 }
148
144 renderer_initialized_ = true; 149 renderer_initialized_ = true;
145 150
146 #if defined(OS_WIN) 151 #if defined(OS_WIN)
147 HANDLE modal_dialog_event_handle; 152 HANDLE modal_dialog_event_handle;
148 HANDLE renderer_process_handle = process()->process().handle(); 153 HANDLE renderer_process_handle = process()->process().handle();
149 if (renderer_process_handle == NULL) 154 if (renderer_process_handle == NULL)
150 renderer_process_handle = GetCurrentProcess(); 155 renderer_process_handle = GetCurrentProcess();
151 156
152 BOOL result = DuplicateHandle(GetCurrentProcess(), 157 BOOL result = DuplicateHandle(GetCurrentProcess(),
153 modal_dialog_event_->handle(), 158 modal_dialog_event_->handle(),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 RenderWidgetHost::Init(); 199 RenderWidgetHost::Init();
195 renderer_initialized_ = true; 200 renderer_initialized_ = true;
196 } 201 }
197 202
198 void RenderViewHost::NavigateToEntry(const NavigationEntry& entry, 203 void RenderViewHost::NavigateToEntry(const NavigationEntry& entry,
199 bool is_reload) { 204 bool is_reload) {
200 ViewMsg_Navigate_Params params; 205 ViewMsg_Navigate_Params params;
201 MakeNavigateParams(entry, is_reload, &params); 206 MakeNavigateParams(entry, is_reload, &params);
202 207
203 RendererSecurityPolicy::GetInstance()->GrantRequestURL( 208 RendererSecurityPolicy::GetInstance()->GrantRequestURL(
204 process()->host_id(), params.url); 209 process()->pid(), params.url);
205 210
206 DoNavigate(new ViewMsg_Navigate(routing_id(), params)); 211 DoNavigate(new ViewMsg_Navigate(routing_id(), params));
207 } 212 }
208 213
209 void RenderViewHost::NavigateToURL(const GURL& url) { 214 void RenderViewHost::NavigateToURL(const GURL& url) {
210 ViewMsg_Navigate_Params params; 215 ViewMsg_Navigate_Params params;
211 params.page_id = -1; 216 params.page_id = -1;
212 params.url = url; 217 params.url = url;
213 params.transition = PageTransition::LINK; 218 params.transition = PageTransition::LINK;
214 params.reload = false; 219 params.reload = false;
215 220
216 RendererSecurityPolicy::GetInstance()->GrantRequestURL( 221 RendererSecurityPolicy::GetInstance()->GrantRequestURL(
217 process()->host_id(), params.url); 222 process()->pid(), params.url);
218 223
219 DoNavigate(new ViewMsg_Navigate(routing_id(), params)); 224 DoNavigate(new ViewMsg_Navigate(routing_id(), params));
220 } 225 }
221 226
222 void RenderViewHost::DoNavigate(ViewMsg_Navigate* nav_message) { 227 void RenderViewHost::DoNavigate(ViewMsg_Navigate* nav_message) {
223 // Only send the message if we aren't suspended at the start of a cross-site 228 // Only send the message if we aren't suspended at the start of a cross-site
224 // request. 229 // request.
225 if (navigations_suspended_) { 230 if (navigations_suspended_) {
226 // Shouldn't be possible to have a second navigation while suspended, since 231 // Shouldn't be possible to have a second navigation while suspended, since
227 // navigations will only be suspended during a cross-site request. If a 232 // navigations will only be suspended during a cross-site request. If a
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (!is_waiting_for_unload_ack_) { 274 if (!is_waiting_for_unload_ack_) {
270 // Start the hang monitor in case the renderer hangs in the beforeunload 275 // Start the hang monitor in case the renderer hangs in the beforeunload
271 // handler. 276 // handler.
272 is_waiting_for_unload_ack_ = true; 277 is_waiting_for_unload_ack_ = true;
273 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); 278 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
274 Send(new ViewMsg_ShouldClose(routing_id())); 279 Send(new ViewMsg_ShouldClose(routing_id()));
275 } 280 }
276 } 281 }
277 282
278 void RenderViewHost::FirePageUnload() { 283 void RenderViewHost::FirePageUnload() {
279 ClosePage(site_instance()->process_host_id(), 284 ClosePage(process()->pid(), routing_id());
280 routing_id());
281 } 285 }
282 286
283 // static 287 // static
284 void RenderViewHost::ClosePageIgnoringUnloadEvents(int render_process_host_id, 288 void RenderViewHost::ClosePageIgnoringUnloadEvents(int render_process_host_id,
285 int request_id) { 289 int request_id) {
286 RenderViewHost* rvh = RenderViewHost::FromID(render_process_host_id, 290 RenderViewHost* rvh = RenderViewHost::FromID(render_process_host_id,
287 request_id); 291 request_id);
288 if (!rvh) 292 if (!rvh)
289 return; 293 return;
290 294
(...skipping 19 matching lines...) Expand all
310 // the page. We must notify the ResourceDispatcherHost on the IO thread, 314 // the page. We must notify the ResourceDispatcherHost on the IO thread,
311 // which we will do through the RenderProcessHost's widget helper. 315 // which we will do through the RenderProcessHost's widget helper.
312 process()->CrossSiteClosePageACK(new_render_process_host_id, 316 process()->CrossSiteClosePageACK(new_render_process_host_id,
313 new_request_id); 317 new_request_id);
314 } 318 }
315 } 319 }
316 320
317 void RenderViewHost::SetHasPendingCrossSiteRequest(bool has_pending_request, 321 void RenderViewHost::SetHasPendingCrossSiteRequest(bool has_pending_request,
318 int request_id) { 322 int request_id) {
319 Singleton<CrossSiteRequestManager>()->SetHasPendingCrossSiteRequest( 323 Singleton<CrossSiteRequestManager>()->SetHasPendingCrossSiteRequest(
320 process()->host_id(), routing_id(), has_pending_request); 324 process()->pid(), routing_id(), has_pending_request);
321 pending_request_id_ = request_id; 325 pending_request_id_ = request_id;
322 } 326 }
323 327
324 int RenderViewHost::GetPendingRequestId() { 328 int RenderViewHost::GetPendingRequestId() {
325 return pending_request_id_; 329 return pending_request_id_;
326 } 330 }
327 331
328 void RenderViewHost::OnCrossSiteResponse(int new_render_process_host_id, 332 void RenderViewHost::OnCrossSiteResponse(int new_render_process_host_id,
329 int new_request_id) { 333 int new_request_id) {
330 delegate_->OnCrossSiteResponse(new_render_process_host_id, new_request_id); 334 delegate_->OnCrossSiteResponse(new_render_process_host_id, new_request_id);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 384
381 void RenderViewHost::FillPasswordForm( 385 void RenderViewHost::FillPasswordForm(
382 const PasswordFormDomManager::FillData& form_data) { 386 const PasswordFormDomManager::FillData& form_data) {
383 Send(new ViewMsg_FillPasswordForm(routing_id(), form_data)); 387 Send(new ViewMsg_FillPasswordForm(routing_id(), form_data));
384 } 388 }
385 389
386 void RenderViewHost::DragTargetDragEnter(const WebDropData& drop_data, 390 void RenderViewHost::DragTargetDragEnter(const WebDropData& drop_data,
387 const gfx::Point& client_pt, const gfx::Point& screen_pt) { 391 const gfx::Point& client_pt, const gfx::Point& screen_pt) {
388 // Grant the renderer the ability to load the drop_data. 392 // Grant the renderer the ability to load the drop_data.
389 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance(); 393 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance();
390 policy->GrantRequestURL(process()->host_id(), drop_data.url); 394 policy->GrantRequestURL(process()->pid(), drop_data.url);
391 for (std::vector<std::wstring>::const_iterator 395 for (std::vector<std::wstring>::const_iterator
392 iter(drop_data.filenames.begin()); 396 iter(drop_data.filenames.begin());
393 iter != drop_data.filenames.end(); ++iter) { 397 iter != drop_data.filenames.end(); ++iter) {
394 policy->GrantRequestURL(process()->host_id(), 398 policy->GrantRequestURL(process()->pid(), net::FilePathToFileURL(*iter));
395 net::FilePathToFileURL(*iter)); 399 policy->GrantUploadFile(process()->pid(), *iter);
396 policy->GrantUploadFile(process()->host_id(), *iter);
397 } 400 }
398 Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt, 401 Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt,
399 screen_pt)); 402 screen_pt));
400 } 403 }
401 404
402 void RenderViewHost::DragTargetDragOver( 405 void RenderViewHost::DragTargetDragOver(
403 const gfx::Point& client_pt, const gfx::Point& screen_pt) { 406 const gfx::Point& client_pt, const gfx::Point& screen_pt) {
404 Send(new ViewMsg_DragTargetDragOver(routing_id(), client_pt, screen_pt)); 407 Send(new ViewMsg_DragTargetDragOver(routing_id(), client_pt, screen_pt));
405 } 408 }
406 409
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 540
538 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval); 541 ViewHostMsg_ShowModalHTMLDialog::WriteReplyParams(reply_msg, json_retval);
539 Send(reply_msg); 542 Send(reply_msg);
540 } 543 }
541 544
542 void RenderViewHost::CopyImageAt(int x, int y) { 545 void RenderViewHost::CopyImageAt(int x, int y) {
543 Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); 546 Send(new ViewMsg_CopyImageAt(routing_id(), x, y));
544 } 547 }
545 548
546 void RenderViewHost::InspectElementAt(int x, int y) { 549 void RenderViewHost::InspectElementAt(int x, int y) {
547 RendererSecurityPolicy::GetInstance()->GrantInspectElement( 550 RendererSecurityPolicy::GetInstance()->GrantInspectElement(process()->pid());
548 process()->host_id());
549 Send(new ViewMsg_InspectElement(routing_id(), x, y)); 551 Send(new ViewMsg_InspectElement(routing_id(), x, y));
550 } 552 }
551 553
552 void RenderViewHost::ShowJavaScriptConsole() { 554 void RenderViewHost::ShowJavaScriptConsole() {
553 RendererSecurityPolicy::GetInstance()->GrantInspectElement( 555 RendererSecurityPolicy::GetInstance()->GrantInspectElement(process()->pid());
554 process()->host_id());
555 556
556 Send(new ViewMsg_ShowJavaScriptConsole(routing_id())); 557 Send(new ViewMsg_ShowJavaScriptConsole(routing_id()));
557 } 558 }
558 559
559 void RenderViewHost::DragSourceEndedAt( 560 void RenderViewHost::DragSourceEndedAt(
560 int client_x, int client_y, int screen_x, int screen_y) { 561 int client_x, int client_y, int screen_x, int screen_y) {
561 Send(new ViewMsg_DragSourceEndedOrMoved( 562 Send(new ViewMsg_DragSourceEndedOrMoved(
562 routing_id(), client_x, client_y, screen_x, screen_y, true)); 563 routing_id(), client_x, client_y, screen_x, screen_y, true));
563 } 564 }
564 565
(...skipping 13 matching lines...) Expand all
578 } 579 }
579 580
580 void RenderViewHost::AllowExternalHostBindings() { 581 void RenderViewHost::AllowExternalHostBindings() {
581 DCHECK(!renderer_initialized_); 582 DCHECK(!renderer_initialized_);
582 enabled_bindings_ |= BindingsPolicy::EXTERNAL_HOST; 583 enabled_bindings_ |= BindingsPolicy::EXTERNAL_HOST;
583 } 584 }
584 585
585 void RenderViewHost::AllowDOMUIBindings() { 586 void RenderViewHost::AllowDOMUIBindings() {
586 DCHECK(!renderer_initialized_); 587 DCHECK(!renderer_initialized_);
587 enabled_bindings_ |= BindingsPolicy::DOM_UI; 588 enabled_bindings_ |= BindingsPolicy::DOM_UI;
588 RendererSecurityPolicy::GetInstance()->GrantDOMUIBindings(
589 process()->host_id());
590 } 589 }
591 590
592 void RenderViewHost::AllowExtensionBindings() { 591 void RenderViewHost::AllowExtensionBindings() {
593 DCHECK(!renderer_initialized_); 592 DCHECK(!renderer_initialized_);
594 enabled_bindings_ |= BindingsPolicy::EXTENSION; 593 enabled_bindings_ |= BindingsPolicy::EXTENSION;
595 } 594 }
596 595
597 void RenderViewHost::SetDOMUIProperty(const std::string& name, 596 void RenderViewHost::SetDOMUIProperty(const std::string& name,
598 const std::string& value) { 597 const std::string& value) {
599 DCHECK(BindingsPolicy::is_dom_ui_enabled(enabled_bindings_)); 598 DCHECK(BindingsPolicy::is_dom_ui_enabled(enabled_bindings_));
(...skipping 22 matching lines...) Expand all
622 621
623 void RenderViewHost::UpdateWebPreferences(const WebPreferences& prefs) { 622 void RenderViewHost::UpdateWebPreferences(const WebPreferences& prefs) {
624 Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs)); 623 Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs));
625 } 624 }
626 625
627 void RenderViewHost::InstallMissingPlugin() { 626 void RenderViewHost::InstallMissingPlugin() {
628 Send(new ViewMsg_InstallMissingPlugin(routing_id())); 627 Send(new ViewMsg_InstallMissingPlugin(routing_id()));
629 } 628 }
630 629
631 void RenderViewHost::FileSelected(const std::wstring& path) { 630 void RenderViewHost::FileSelected(const std::wstring& path) {
632 RendererSecurityPolicy::GetInstance()->GrantUploadFile(process()->host_id(), 631 RendererSecurityPolicy::GetInstance()->GrantUploadFile(process()->pid(),
633 path); 632 path);
634 std::vector<std::wstring> files; 633 std::vector<std::wstring> files;
635 files.push_back(path); 634 files.push_back(path);
636 Send(new ViewMsg_RunFileChooserResponse(routing_id(), files)); 635 Send(new ViewMsg_RunFileChooserResponse(routing_id(), files));
637 } 636 }
638 637
639 void RenderViewHost::MultiFilesSelected( 638 void RenderViewHost::MultiFilesSelected(
640 const std::vector<std::wstring>& files) { 639 const std::vector<std::wstring>& files) {
641 for (std::vector<std::wstring>::const_iterator file = files.begin(); 640 for (std::vector<std::wstring>::const_iterator file = files.begin();
642 file != files.end(); ++file) { 641 file != files.end(); ++file) {
643 RendererSecurityPolicy::GetInstance()->GrantUploadFile( 642 RendererSecurityPolicy::GetInstance()->GrantUploadFile(
644 process()->host_id(), *file); 643 process()->pid(), *file);
645 } 644 }
646 Send(new ViewMsg_RunFileChooserResponse(routing_id(), files)); 645 Send(new ViewMsg_RunFileChooserResponse(routing_id(), files));
647 } 646 }
648 647
649 void RenderViewHost::LoadStateChanged(const GURL& url, 648 void RenderViewHost::LoadStateChanged(const GURL& url,
650 net::LoadState load_state) { 649 net::LoadState load_state) {
651 delegate_->LoadStateChanged(url, load_state); 650 delegate_->LoadStateChanged(url, load_state);
652 } 651 }
653 652
654 bool RenderViewHost::CanTerminate() const { 653 bool RenderViewHost::CanTerminate() const {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 // action. 856 // action.
858 void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) { 857 void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) {
859 // Read the parameters out of the IPC message directly to avoid making another 858 // Read the parameters out of the IPC message directly to avoid making another
860 // copy when we filter the URLs. 859 // copy when we filter the URLs.
861 void* iter = NULL; 860 void* iter = NULL;
862 ViewHostMsg_FrameNavigate_Params validated_params; 861 ViewHostMsg_FrameNavigate_Params validated_params;
863 if (!IPC::ParamTraits<ViewHostMsg_FrameNavigate_Params>:: 862 if (!IPC::ParamTraits<ViewHostMsg_FrameNavigate_Params>::
864 Read(&msg, &iter, &validated_params)) 863 Read(&msg, &iter, &validated_params))
865 return; 864 return;
866 865
867 const int renderer_id = process()->host_id(); 866 const int renderer_id = process()->pid();
868 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance(); 867 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance();
869 // Without this check, an evil renderer can trick the browser into creating 868 // Without this check, an evil renderer can trick the browser into creating
870 // a navigation entry for a banned URL. If the user clicks the back button 869 // a navigation entry for a banned URL. If the user clicks the back button
871 // followed by the forward button (or clicks reload, or round-trips through 870 // followed by the forward button (or clicks reload, or round-trips through
872 // session restore, etc), we'll think that the browser commanded the 871 // session restore, etc), we'll think that the browser commanded the
873 // renderer to load the URL and grant the renderer the privileges to request 872 // renderer to load the URL and grant the renderer the privileges to request
874 // the URL. To prevent this attack, we block the renderer from inserting 873 // the URL. To prevent this attack, we block the renderer from inserting
875 // banned URLs into the navigation controller in the first place. 874 // banned URLs into the navigation controller in the first place.
876 FilterURL(policy, renderer_id, &validated_params.url); 875 FilterURL(policy, renderer_id, &validated_params.url);
877 FilterURL(policy, renderer_id, &validated_params.referrer); 876 FilterURL(policy, renderer_id, &validated_params.referrer);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 void RenderViewHost::OnMsgDidLoadResourceFromMemoryCache( 945 void RenderViewHost::OnMsgDidLoadResourceFromMemoryCache(
947 const GURL& url, 946 const GURL& url,
948 const std::string& security_info) { 947 const std::string& security_info) {
949 delegate_->DidLoadResourceFromMemoryCache(url, security_info); 948 delegate_->DidLoadResourceFromMemoryCache(url, security_info);
950 } 949 }
951 950
952 void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(bool is_main_frame, 951 void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(bool is_main_frame,
953 const GURL& url) { 952 const GURL& url) {
954 GURL validated_url(url); 953 GURL validated_url(url);
955 FilterURL(RendererSecurityPolicy::GetInstance(), 954 FilterURL(RendererSecurityPolicy::GetInstance(),
956 process()->host_id(), &validated_url); 955 process()->pid(), &validated_url);
957 956
958 delegate_->DidStartProvisionalLoadForFrame(this, is_main_frame, 957 delegate_->DidStartProvisionalLoadForFrame(this, is_main_frame,
959 validated_url); 958 validated_url);
960 } 959 }
961 960
962 void RenderViewHost::OnMsgDidFailProvisionalLoadWithError( 961 void RenderViewHost::OnMsgDidFailProvisionalLoadWithError(
963 bool is_main_frame, 962 bool is_main_frame,
964 int error_code, 963 int error_code,
965 const GURL& url, 964 const GURL& url,
966 bool showing_repost_interstitial) { 965 bool showing_repost_interstitial) {
967 GURL validated_url(url); 966 GURL validated_url(url);
968 FilterURL(RendererSecurityPolicy::GetInstance(), 967 FilterURL(RendererSecurityPolicy::GetInstance(),
969 process()->host_id(), &validated_url); 968 process()->pid(), &validated_url);
970 969
971 delegate_->DidFailProvisionalLoadWithError(this, is_main_frame, 970 delegate_->DidFailProvisionalLoadWithError(this, is_main_frame,
972 error_code, validated_url, 971 error_code, validated_url,
973 showing_repost_interstitial); 972 showing_repost_interstitial);
974 } 973 }
975 974
976 void RenderViewHost::OnMsgFindReply(int request_id, 975 void RenderViewHost::OnMsgFindReply(int request_id,
977 int number_of_matches, 976 int number_of_matches,
978 const gfx::Rect& selection_rect, 977 const gfx::Rect& selection_rect,
979 int active_match_ordinal, 978 int active_match_ordinal,
(...skipping 24 matching lines...) Expand all
1004 } 1003 }
1005 1004
1006 void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) { 1005 void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) {
1007 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); 1006 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
1008 if (!view) 1007 if (!view)
1009 return; 1008 return;
1010 1009
1011 // Validate the URLs in |params|. If the renderer can't request the URLs 1010 // Validate the URLs in |params|. If the renderer can't request the URLs
1012 // directly, don't show them in the context menu. 1011 // directly, don't show them in the context menu.
1013 ContextMenuParams validated_params(params); 1012 ContextMenuParams validated_params(params);
1014 const int renderer_id = process()->host_id(); 1013 const int renderer_id = process()->pid();
1015 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance(); 1014 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance();
1016 1015
1017 FilterURL(policy, renderer_id, &validated_params.link_url); 1016 FilterURL(policy, renderer_id, &validated_params.link_url);
1018 FilterURL(policy, renderer_id, &validated_params.image_url); 1017 FilterURL(policy, renderer_id, &validated_params.image_url);
1019 FilterURL(policy, renderer_id, &validated_params.page_url); 1018 FilterURL(policy, renderer_id, &validated_params.page_url);
1020 FilterURL(policy, renderer_id, &validated_params.frame_url); 1019 FilterURL(policy, renderer_id, &validated_params.frame_url);
1021 1020
1022 view->ShowContextMenu(validated_params); 1021 view->ShowContextMenu(validated_params);
1023 } 1022 }
1024 1023
1025 void RenderViewHost::OnMsgOpenURL(const GURL& url, 1024 void RenderViewHost::OnMsgOpenURL(const GURL& url,
1026 const GURL& referrer, 1025 const GURL& referrer,
1027 WindowOpenDisposition disposition) { 1026 WindowOpenDisposition disposition) {
1028 GURL validated_url(url); 1027 GURL validated_url(url);
1029 FilterURL(RendererSecurityPolicy::GetInstance(), 1028 FilterURL(RendererSecurityPolicy::GetInstance(),
1030 process()->host_id(), &validated_url); 1029 process()->pid(), &validated_url);
1031 1030
1032 delegate_->RequestOpenURL(validated_url, referrer, disposition); 1031 delegate_->RequestOpenURL(validated_url, referrer, disposition);
1033 } 1032 }
1034 1033
1035 void RenderViewHost::OnMsgDomOperationResponse( 1034 void RenderViewHost::OnMsgDomOperationResponse(
1036 const std::string& json_string, int automation_id) { 1035 const std::string& json_string, int automation_id) {
1037 delegate_->DomOperationResponse(json_string, automation_id); 1036 delegate_->DomOperationResponse(json_string, automation_id);
1038 } 1037 }
1039 1038
1040 void RenderViewHost::OnMsgDOMUISend( 1039 void RenderViewHost::OnMsgDOMUISend(
1041 const std::string& message, const std::string& content) { 1040 const std::string& message, const std::string& content) {
1042 if (!RendererSecurityPolicy::GetInstance()-> 1041 if (!RendererSecurityPolicy::GetInstance()->
1043 HasDOMUIBindings(process()->host_id())) { 1042 HasDOMUIBindings(process()->pid())) {
1044 NOTREACHED() << "Blocked unauthorized use of DOMUIBindings."; 1043 NOTREACHED() << "Blocked unauthorized use of DOMUIBindings.";
1045 return; 1044 return;
1046 } 1045 }
1047 delegate_->ProcessDOMUIMessage(message, content); 1046 delegate_->ProcessDOMUIMessage(message, content);
1048 } 1047 }
1049 1048
1050 void RenderViewHost::OnMsgForwardMessageToExternalHost( 1049 void RenderViewHost::OnMsgForwardMessageToExternalHost(
1051 const std::string& message, const std::string& origin, 1050 const std::string& message, const std::string& origin,
1052 const std::string& target) { 1051 const std::string& target) {
1053 delegate_->ProcessExternalHostMessage(message, origin, target); 1052 delegate_->ProcessExternalHostMessage(message, origin, target);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg)); 1336 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg));
1338 } 1337 }
1339 #endif 1338 #endif
1340 1339
1341 void RenderViewHost::ForwardMessageFromExternalHost(const std::string& message, 1340 void RenderViewHost::ForwardMessageFromExternalHost(const std::string& message,
1342 const std::string& origin, 1341 const std::string& origin,
1343 const std::string& target) { 1342 const std::string& target) {
1344 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), message, origin, 1343 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), message, origin,
1345 target)); 1344 target));
1346 } 1345 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_process_host.cc ('k') | chrome/browser/renderer_host/render_widget_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698