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

Side by Side Diff: src/trusted/plugin/srpc/browser_interface.h

Issue 2981011: Move plugin/srpc contents to the more appropriately named plugin/common.... (Closed) Base URL: http://nativeclient.googlecode.com/svn/trunk/src/native_client/
Patch Set: '' Created 10 years, 5 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
« no previous file with comments | « src/trusted/plugin/socket_address.cc ('k') | src/trusted/plugin/srpc/browser_interface.cc » ('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 /*
2 * Copyright 2008 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file.
5 */
6
7
8 // Portable interface for browser interaction
9
10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_BROWSER_INTERFACE_H_
11 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_BROWSER_INTERFACE_H_
12
13 #include <stdio.h>
14 #include <map>
15
16 #include "native_client/src/include/nacl_macros.h"
17 #include "native_client/src/include/nacl_string.h"
18 #include "native_client/src/include/portability.h"
19 #include "native_client/src/shared/npruntime/nacl_npapi.h"
20 #include "native_client/src/trusted/plugin/api_defines.h"
21
22 namespace nacl {
23
24 class NPModule;
25
26 } // namespace
27
28 namespace plugin {
29
30 class ScriptableHandle;
31 class PortableHandle;
32
33 // BrowserInterface represents the interface to the browser from
34 // the plugin, independent of whether it is the ActiveX or NPAPI instance.
35 // I.e., when the plugin needs to request an alert, it uses these interfaces.
36 class BrowserInterface {
37 public:
38 virtual ~BrowserInterface() { }
39
40 // Functions for communication with the browser.
41
42 // Convert a string to an identifier.
43 virtual uintptr_t StringToIdentifier(const nacl::string& str) = 0;
44 // Convert an identifier to a string.
45 virtual nacl::string IdentifierToString(uintptr_t ident) = 0;
46
47 // Pops up an alert box. Returns false if that failed for any reason.
48 virtual bool Alert(InstanceIdentifier instance_id,
49 const nacl::string& text) = 0;
50
51 // Evaluate a JavaScript string in the browser.
52 virtual bool EvalString(InstanceIdentifier plugin_identifier,
53 const nacl::string& str) = 0;
54
55 // Gets the origin of the current page. Origin is scheme://domain.
56 virtual bool GetOrigin(InstanceIdentifier instance_id,
57 nacl::string* origin) = 0;
58
59 // Creates a browser scriptable handle for a given portable handle.
60 // If handle is NULL, returns NULL.
61 virtual ScriptableHandle* NewScriptableHandle(PortableHandle* handle) = 0;
62
63 // Filename-based version of the function below that takes a char* and size.
64 static bool MightBeElfExecutable(const nacl::string& filename,
65 nacl::string* error);
66
67 // Returns true iff the first |size| bytes of |e_ident_bytes| appear to be
68 // a valid ELF file; returns an informative error message otherwise.
69 // The check for valid ELF executable is only done looking at the e_ident
70 // bytes. Fuller checking is done by the service_runtime.
71 static bool MightBeElfExecutable(const char* e_ident_bytes,
72 size_t size,
73 nacl::string* error);
74
75 static const char* kNoError;
76 };
77
78 } // namespace plugin
79
80 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_BROWSER_INTERFACE_H_
OLDNEW
« no previous file with comments | « src/trusted/plugin/socket_address.cc ('k') | src/trusted/plugin/srpc/browser_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698