From ef9162785c55957324e72f737bb9b6b2406053dd Mon Sep 17 00:00:00 2001
From: "jam@chromium.org"
 <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 8 Jul 2009 21:40:55 +0000
Subject: Add the page url to plugin crashes to aid debugging. Review URL:
 http://codereview.chromium.org/155238

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20191 0039d316-1c4b-4281-b951-d872f2087c98
---
 chrome/renderer/webplugin_delegate_proxy.cc | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

(limited to 'chrome/renderer/webplugin_delegate_proxy.cc')

diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index ad70db1..e7650a7 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -19,6 +19,7 @@
 #include "base/gfx/size.h"
 #include "base/gfx/native_widget_types.h"
 #include "chrome/app/chrome_dll_resource.h"
+#include "chrome/common/child_process_logging.h"
 #include "chrome/common/plugin_messages.h"
 #include "chrome/common/render_messages.h"
 #include "chrome/plugin/npobject_proxy.h"
@@ -26,7 +27,6 @@
 #include "chrome/plugin/npobject_util.h"
 #include "chrome/renderer/render_thread.h"
 #include "chrome/renderer/render_view.h"
-#include "googleurl/src/gurl.h"
 #include "grit/generated_resources.h"
 #include "net/base/mime_util.h"
 #include "printing/native_metafile.h"
@@ -170,7 +170,8 @@ WebPluginDelegateProxy::WebPluginDelegateProxy(const std::string& mime_type,
       window_script_object_(NULL),
       sad_plugin_(NULL),
       invalidate_pending_(false),
-      transparent_(false) {
+      transparent_(false),
+      page_url_(render_view_->webview()->GetMainFrame()->GetURL()) {
 }
 
 WebPluginDelegateProxy::~WebPluginDelegateProxy() {
@@ -245,6 +246,7 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn,
   PluginMsg_Init_Params params;
   params.containing_window = render_view_->host_window();
   params.url = url;
+  params.page_url = page_url_;
   for (int i = 0; i < argc; ++i) {
     params.arg_names.push_back(argn[i]);
     params.arg_values.push_back(argv[i]);
@@ -329,6 +331,8 @@ void WebPluginDelegateProxy::InstallMissingPlugin() {
 }
 
 void WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) {
+  child_process_logging::ScopedActiveURLSetter url_setter(page_url_);
+
   IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateProxy, msg)
     IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindow, OnSetWindow)
 #if defined(OS_LINUX)
@@ -608,7 +612,7 @@ NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() {
 
   npobject_ = NPObjectProxy::Create(
       channel_host_.get(), route_id, npobject_ptr,
-      render_view_->modal_dialog_event());
+      render_view_->modal_dialog_event(), page_url_);
 
   return NPN_RetainObject(npobject_);
 }
@@ -698,7 +702,7 @@ void WebPluginDelegateProxy::OnGetWindowScriptNPObject(
   // otherwise when the channel is closed.
   NPObjectStub* stub = new NPObjectStub(
       npobject, channel_host_.get(), route_id,
-      render_view_->modal_dialog_event());
+      render_view_->modal_dialog_event(), page_url_);
   window_script_object_ = stub;
   window_script_object_->set_proxy(this);
   *success = true;
@@ -718,7 +722,7 @@ void WebPluginDelegateProxy::OnGetPluginElement(
   // otherwise when the channel is closed.
   new NPObjectStub(
       npobject, channel_host_.get(), route_id,
-      render_view_->modal_dialog_event());
+      render_view_->modal_dialog_event(), page_url_);
   *success = true;
   *npobject_ptr = reinterpret_cast<intptr_t>(npobject);
 }
@@ -809,7 +813,8 @@ void WebPluginDelegateProxy::OnGetDragData(const NPVariant_Param& object,
 
   for (size_t i = 0; i < arraysize(results); ++i) {
     values->push_back(NPVariant_Param());
-    CreateNPVariantParam(results[i], NULL, &values->back(), false, NULL);
+    CreateNPVariantParam(
+        results[i], NULL, &values->back(), false, NULL, page_url_);
   }
 
   *success = true;
-- 
cgit v1.1