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

Side by Side Diff: experimental/flocking_geese/scripting/scripting_bridge.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client 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 #ifndef SCRIPTING_BRIDGE_H_
6 #define SCRIPTING_BRIDGE_H_
7
8 #include <map>
9 #include <string>
10 #include <tr1/memory>
11 #include <vector>
12
13 #include "scripting/callback.h"
14
15 namespace scripting {
16
17 class MethodCallbackExecutor;
18
19 // This class handles the interface between the browser and the NaCl module.
20 // There is a single point of entry from the browser: postMessage(). The
21 // string passed to postMessage() has this format:
22 // 'function_name arg_name0:arg_0 arg_name1:arg1 ...'
23 // The arguments have undetermined type; they are placed in a map of argument
24 // names and values. Values are all strings, it is up to the target code to
25 // do any type coercion.
26 // Methods called by the scripting bridge must have a signature like this:
27 // void Method(const ScriptingBridge& bridge,
28 // const ParameterDictionary&);
29 // TODO(dspringer): port this to the real postMessage when it's ready.
30 class ScriptingBridge {
31 public:
32 // Shared pointer type used in the method map.
33 typedef std::tr1::shared_ptr<MethodCallbackExecutor>
34 SharedMethodCallbackExecutor;
35
36 virtual ~ScriptingBridge() {}
37
38 // Causes |method_name| to be published as a method that can be called via
39 // postMessage() from the browser. Associates this method with |method|.
40 bool AddMethodNamed(const std::string& method_name,
41 SharedMethodCallbackExecutor method);
42
43 bool InvokeMethod(const std::string& method);
44
45 private:
46 typedef std::map<std::string, SharedMethodCallbackExecutor> MethodDictionary;
47
48 MethodDictionary method_dictionary_;
49 };
50
51 } // namespace scripting
52 #endif // SCRIPTING_BRIDGE_H_
OLDNEW
« no previous file with comments | « experimental/flocking_geese/scripting/callback.h ('k') | experimental/flocking_geese/scripting/scripting_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698