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

Side by Side Diff: visual_studio/NativeClientVSAddIn/TestingProjects/BlankValidSolution/NaClProject/main.cpp

Issue 10831030: NaCl settings and completed install scripts. (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 8 years, 4 months 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 /// This project is for use with the testing framework
6 /// of the Visual Studio Add-in.
7 /// Note that the PPAPI and NaCl configurations do not exist. These are added
8 /// during testing time so that the most up-to-date settings are used.
9
10 #include <string>
11
12 #include "ppapi/cpp/instance.h"
13 #include "ppapi/cpp/module.h"
14 #include "ppapi/cpp/var.h"
15
16 class NaClProjectInstance : public pp::Instance {
17 public:
18 /// The constructor creates the plugin-side instance.
19 /// @param[in] instance the handle to the browser-side plugin instance.
20 explicit NaClProjectInstance(PP_Instance instance)
21 : pp::Instance(instance) {
22 }
23
24 virtual ~NaClProjectInstance() {
25 }
26
27 virtual bool Init(uint32_t /*argc*/, const char* /*argn*/[],
28 const char* /*argv*/[]) {
29 // Start chain of message relaying.
30 PostMessage(pp::Var("relay1"));
31 return true;
32 }
33
34 private:
35 virtual void HandleMessage(const pp::Var& var_message) {
36 // Simply relay back to javascript the message we just received.
37 if (!var_message.is_string())
38 return;
39 std::string msg = var_message.AsString();
40 PostMessage(pp::Var(msg));
41 }
42 };
43
44 /// The Module class. The browser calls the CreateInstance() method to create
45 /// an instance of your NaCl module on the web page. The browser creates a new
46 /// instance for each <embed> tag with type="application/x-nacl".
47 class NaClProjectModule : public pp::Module {
48 public:
49 NaClProjectModule() : pp::Module() {}
50 virtual ~NaClProjectModule() {}
51
52 /// Create and return a FileIoInstance object.
53 /// @param[in] instance The browser-side instance.
54 /// @return the plugin-side instance.
55 virtual pp::Instance* CreateInstance(PP_Instance instance) {
56 return new NaClProjectInstance(instance);
57 }
58 };
59
60 namespace pp {
61 Module* CreateModule() {
62 return new NaClProjectModule();
63 }
64 } // namespace pp
65
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698