Index: webkit/plugins/ppapi/ppb_hello_impl.cc |
diff --git a/webkit/plugins/ppapi/ppb_hello_impl.cc b/webkit/plugins/ppapi/ppb_hello_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..19fc3f89014117671fb94c4533a209ae4ae1ecd6 |
--- /dev/null |
+++ b/webkit/plugins/ppapi/ppb_hello_impl.cc |
@@ -0,0 +1,80 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "webkit/plugins/ppapi/ppb_hello_impl.h" |
+ |
+#include <stdio.h> |
+ |
+#include "base/logging.h" |
+#include "ppapi/c/pp_errors.h" |
+#include "ppapi/shared_impl/resource.h" |
+#include "ppapi/thunk/enter.h" |
+#include "ppapi/thunk/ppb_hello_api.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
+#include "webkit/plugins/ppapi/common.h" |
+#include "webkit/plugins/ppapi/plugin_delegate.h" |
+#include "webkit/plugins/ppapi/plugin_module.h" |
+#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
+#include "webkit/plugins/ppapi/ppb_hello_impl.h" |
+#include "webkit/plugins/ppapi/resource_helper.h" |
+ |
+using ppapi::HostResource; |
+using ppapi::thunk::PPB_Hello_API; |
+using WebKit::WebFrame; |
+using WebKit::WebString; |
+ |
+namespace webkit { |
+namespace ppapi { |
+ |
+PPB_Hello_Impl::PPB_Hello_Impl(PP_Instance instance) |
+ : Resource(instance) { |
+ LOG(ERROR) << "PPB_Hello_Impl"; |
+} |
+ |
+PPB_Hello_Impl::~PPB_Hello_Impl() { |
+ LOG(ERROR) << "~PPB_Hello_Impl"; |
+} |
+ |
+PP_Resource PPB_Hello_Impl::Create(PP_Instance instance) { |
+ LOG(ERROR) << "Create"; |
+ return (new PPB_Hello_Impl(instance))->GetReference(); |
+} |
+ |
+PPB_Hello_API* PPB_Hello_Impl::AsPPB_Hello_API() { |
+ LOG(ERROR) << "AsPPB_Hello_API"; |
+ return this; |
+} |
+ |
+int32 PPB_Hello_Impl::SayHello() { |
+ LOG(ERROR) << "SayHello"; |
+ |
+ PluginInstance* plugin_instance = |
+ ResourceHelper::GetPluginInstance(this); |
+ LOG(ERROR) << "plugin: " << plugin_instance; |
+ WebFrame* frame = plugin_instance->container()->element().document().frame(); |
+ LOG(ERROR) << "frame: " << frame; |
+ LOG(ERROR) << " name: " << frame->name().utf8().data(); |
+ LOG(ERROR) << "set frame name to hello"; |
+ frame->setName(WebString::fromUTF8("hello")); |
+ LOG(ERROR) << "get frame name again"; |
+ LOG(ERROR) << " name: " << frame->name().utf8().data(); |
+ |
+ LOG(ERROR) << "call shared impl"; |
+ return HelloImpl::SayHello(); |
+} |
+ |
+void PPB_Hello_Impl::WhoAreYou(char* name, uint32_t size, |
+ pp::CompletionCallback callback) { |
+ LOG(ERROR) << "WhoAreYou"; |
+ LOG(ERROR) << "call shared impl"; |
+ HelloImpl::WhoAreYou(name, size, callback); |
+ snprintf(name, size, __FILE__); |
+} |
+ |
+} // namespace ppapi |
+} // namespace webkit |