Upstream version 11.39.250.0
[platform/framework/web/crosswalk.git] / src / content / renderer / npapi / webplugin_delegate_proxy.cc
index 9ed8276..d04429b 100644 (file)
@@ -4,18 +4,12 @@
 
 #include "content/renderer/npapi/webplugin_delegate_proxy.h"
 
-#if defined(TOOLKIT_GTK)
-#include <gtk/gtk.h>
-#elif defined(USE_X11)
-#include <cairo/cairo.h>
-#endif
-
 #include <algorithm>
 
 #include "base/auto_reset.h"
 #include "base/basictypes.h"
 #include "base/command_line.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
@@ -319,7 +313,7 @@ bool WebPluginDelegateProxy::Initialize(
       // shouldn't happen, since if we got here the plugin should exist) or the
       // plugin crashed on initialization.
       if (!info_.path.empty()) {
-        render_view_->main_render_frame()->PluginCrashed(
+        render_view_->GetMainRenderFrame()->PluginCrashed(
             info_.path, base::kNullProcessId);
         LOG(ERROR) << "Plug-in crashed on start";
 
@@ -492,8 +486,8 @@ void WebPluginDelegateProxy::OnChannelError() {
     }
     plugin_->Invalidate();
   }
-  if (!channel_host_->expecting_shutdown()) {
-    render_view_->main_render_frame()->PluginCrashed(
+  if (channel_host_.get() && !channel_host_->expecting_shutdown()) {
+    render_view_->GetMainRenderFrame()->PluginCrashed(
         info_.path, channel_host_->peer_pid());
   }
 
@@ -531,6 +525,9 @@ static void CopyTransportDIBHandleForMessage(
 
 void WebPluginDelegateProxy::SendUpdateGeometry(
     bool bitmaps_changed) {
+  if (!channel_host_.get())
+    return;
+
   PluginMsg_UpdateGeometry_Param param;
   param.window_rect = plugin_rect_;
   param.clip_rect = clip_rect_;
@@ -654,7 +651,7 @@ bool WebPluginDelegateProxy::CreateSharedBitmap(
   if (!memory->get())
     return false;
 #endif
-#if defined(OS_POSIX) && !defined(TOOLKIT_GTK) && !defined(OS_ANDROID)
+#if defined(OS_POSIX) && !defined(OS_ANDROID)
   TransportDIB::Handle handle;
   IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(size, false, &handle);
   if (!RenderThreadImpl::current()->Send(msg))
@@ -736,6 +733,9 @@ NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() {
   if (npobject_)
     return WebBindings::retainObject(npobject_);
 
+  if (!channel_host_.get())
+    return NULL;
+
   int route_id = MSG_ROUTING_NONE;
   Send(new PluginMsg_GetPluginScriptableObject(instance_id_, &route_id));
   if (route_id == MSG_ROUTING_NONE)
@@ -775,7 +775,7 @@ void WebPluginDelegateProxy::SetFocus(bool focused) {
 bool WebPluginDelegateProxy::HandleInputEvent(
     const WebInputEvent& event,
     WebCursor::CursorInfo* cursor_info) {
-  bool handled;
+  bool handled = false;
   WebCursor cursor;
   // A windowless plugin can enter a modal loop in the context of a
   // NPP_HandleEvent call, in which case we need to pump messages to