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

Side by Side Diff: webkit/plugins/ppapi/ppb_hello_impl.cc

Issue 8414054: Hello Pepper API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month 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
« no previous file with comments | « webkit/plugins/ppapi/ppb_hello_impl.h ('k') | webkit/plugins/ppapi/resource_creation_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webkit/plugins/ppapi/ppb_hello_impl.h"
6
7 #include <stdio.h>
8
9 #include "base/logging.h"
10 #include "ppapi/c/pp_errors.h"
11 #include "ppapi/shared_impl/resource.h"
12 #include "ppapi/thunk/enter.h"
13 #include "ppapi/thunk/ppb_hello_api.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
19 #include "webkit/plugins/ppapi/common.h"
20 #include "webkit/plugins/ppapi/plugin_delegate.h"
21 #include "webkit/plugins/ppapi/plugin_module.h"
22 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
23 #include "webkit/plugins/ppapi/ppb_hello_impl.h"
24 #include "webkit/plugins/ppapi/resource_helper.h"
25
26 using ppapi::HostResource;
27 using ppapi::thunk::PPB_Hello_API;
28 using WebKit::WebFrame;
29 using WebKit::WebString;
30
31 namespace webkit {
32 namespace ppapi {
33
34 PPB_Hello_Impl::PPB_Hello_Impl(PP_Instance instance)
35 : Resource(instance) {
36 LOG(ERROR) << "PPB_Hello_Impl";
37 }
38
39 PPB_Hello_Impl::~PPB_Hello_Impl() {
40 LOG(ERROR) << "~PPB_Hello_Impl";
41 }
42
43 PP_Resource PPB_Hello_Impl::Create(PP_Instance instance) {
44 LOG(ERROR) << "Create";
45 return (new PPB_Hello_Impl(instance))->GetReference();
46 }
47
48 PPB_Hello_API* PPB_Hello_Impl::AsPPB_Hello_API() {
49 LOG(ERROR) << "AsPPB_Hello_API";
50 return this;
51 }
52
53 int32 PPB_Hello_Impl::SayHello() {
54 LOG(ERROR) << "SayHello";
55
56 PluginInstance* plugin_instance =
57 ResourceHelper::GetPluginInstance(this);
58 LOG(ERROR) << "plugin: " << plugin_instance;
59 WebFrame* frame = plugin_instance->container()->element().document().frame();
60 LOG(ERROR) << "frame: " << frame;
61 LOG(ERROR) << " name: " << frame->name().utf8().data();
62 LOG(ERROR) << "set frame name to hello";
63 frame->setName(WebString::fromUTF8("hello"));
64 LOG(ERROR) << "get frame name again";
65 LOG(ERROR) << " name: " << frame->name().utf8().data();
66
67 LOG(ERROR) << "call shared impl";
68 return HelloImpl::SayHello();
69 }
70
71 void PPB_Hello_Impl::WhoAreYou(char* name, uint32_t size,
72 pp::CompletionCallback callback) {
73 LOG(ERROR) << "WhoAreYou";
74 LOG(ERROR) << "call shared impl";
75 HelloImpl::WhoAreYou(name, size, callback);
76 snprintf(name, size, __FILE__);
77 }
78
79 } // namespace ppapi
80 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_hello_impl.h ('k') | webkit/plugins/ppapi/resource_creation_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698