Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / renderer / pepper / npapi_glue.cc
index 8489c4d..990d330 100644 (file)
@@ -20,7 +20,7 @@
 #include "third_party/WebKit/public/web/WebBindings.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebElement.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "v8/include/v8.h"
 
@@ -30,7 +30,7 @@ using ppapi::StringVar;
 using ppapi::Var;
 using blink::WebArrayBuffer;
 using blink::WebBindings;
-using blink::WebFrame;
+using blink::WebLocalFrame;
 using blink::WebPluginContainer;
 
 namespace content {
@@ -65,7 +65,6 @@ PP_Var NPObjectToPPVarImpl(PepperPluginInstanceImpl* instance,
   return object_var->GetPPVar();
 }
 
-
 }  // namespace
 
 // Utilities -------------------------------------------------------------------
@@ -179,7 +178,7 @@ PP_Var NPObjectToPPVar(PepperPluginInstanceImpl* instance, NPObject* object) {
   // the DOM (but the PluginInstance is not destroyed yet).
   if (!container)
     return PP_MakeUndefined();
-  WebFrame* frame = container->element().document().frame();
+  WebLocalFrame* frame = container->element().document().frame();
   if (!frame)
     return PP_MakeUndefined();
 
@@ -211,8 +210,7 @@ PPResultAndExceptionToNPResult::PPResultAndExceptionToNPResult(
       np_result_(np_result),
       exception_(PP_MakeUndefined()),
       success_(false),
-      checked_exception_(false) {
-}
+      checked_exception_(false) {}
 
 PPResultAndExceptionToNPResult::~PPResultAndExceptionToNPResult() {
   // The user should have called SetResult or CheckExceptionForNoResult
@@ -228,7 +226,7 @@ PPResultAndExceptionToNPResult::~PPResultAndExceptionToNPResult() {
 // the JS engine. It will update the success flag and return it.
 bool PPResultAndExceptionToNPResult::SetResult(PP_Var result) {
   DCHECK(!checked_exception_);  // Don't call more than once.
-  DCHECK(np_result_);  // Should be expecting a result.
+  DCHECK(np_result_);           // Should be expecting a result.
 
   checked_exception_ = true;
 
@@ -256,7 +254,7 @@ bool PPResultAndExceptionToNPResult::SetResult(PP_Var result) {
 // The success flag will be returned.
 bool PPResultAndExceptionToNPResult::CheckExceptionForNoResult() {
   DCHECK(!checked_exception_);  // Don't call more than once.
-  DCHECK(!np_result_);  // Can't have a result when doing this.
+  DCHECK(!np_result_);          // Can't have a result when doing this.
 
   checked_exception_ = true;
 
@@ -306,8 +304,7 @@ PPVarArrayFromNPVariantArray::~PPVarArrayFromNPVariantArray() {
 
 PPVarFromNPObject::PPVarFromNPObject(PepperPluginInstanceImpl* instance,
                                      NPObject* object)
-    : var_(NPObjectToPPVar(instance, object)) {
-}
+    : var_(NPObjectToPPVar(instance, object)) {}
 
 PPVarFromNPObject::~PPVarFromNPObject() {
   PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(var_);
@@ -340,14 +337,14 @@ TryCatch::TryCatch(PP_Var* exception)
   WebBindings::pushExceptionHandler(&TryCatch::Catch, this);
 }
 
-TryCatch::~TryCatch() {
-  WebBindings::popExceptionHandler();
-}
+TryCatch::~TryCatch() { WebBindings::popExceptionHandler(); }
 
 void TryCatch::SetException(const char* message) {
   if (!has_exception()) {
     has_exception_ = true;
     if (exception_) {
+      if (!message)
+        message = "Unknown exception.";
       *exception_ = ppapi::StringVar::StringToPPVar(message, strlen(message));
     }
   }