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

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

Issue 3119028: Use console.log to report NaCl errors in Chrome instead of alerts (Closed) Base URL: http://nativeclient.googlecode.com/svn/trunk/src/native_client/
Patch Set: '' Created 10 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
1 /* 1 /*
2 * Copyright 2008 The Native Client Authors. All rights reserved. 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 3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file. 4 * be found in the LICENSE file.
5 */ 5 */
6 6
7 7
8 // Portable interface for browser interaction 8 // Portable interface for browser interaction
9 9
10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_BROWSER_INTERFACE_H_ 10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_BROWSER_INTERFACE_H_
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Convert a string to an identifier. 42 // Convert a string to an identifier.
43 virtual uintptr_t StringToIdentifier(const nacl::string& str) = 0; 43 virtual uintptr_t StringToIdentifier(const nacl::string& str) = 0;
44 // Convert an identifier to a string. 44 // Convert an identifier to a string.
45 virtual nacl::string IdentifierToString(uintptr_t ident) = 0; 45 virtual nacl::string IdentifierToString(uintptr_t ident) = 0;
46 46
47 // Pops up an alert box. Returns false if that failed for any reason. 47 // Pops up an alert box. Returns false if that failed for any reason.
48 virtual bool Alert(InstanceIdentifier instance_id, 48 virtual bool Alert(InstanceIdentifier instance_id,
49 const nacl::string& text) = 0; 49 const nacl::string& text) = 0;
50 50
51 // Evaluate a JavaScript string in the browser. 51 // Evaluate a JavaScript string in the browser.
52 virtual bool EvalString(InstanceIdentifier plugin_identifier, 52 virtual bool EvalString(InstanceIdentifier instance_id,
53 const nacl::string& str) = 0; 53 const nacl::string& str) = 0;
54 54
55 // Gets the full URL of the current page. 55 // Gets the full URL of the current page.
56 virtual bool GetFullURL(InstanceIdentifier instance_id, 56 virtual bool GetFullURL(InstanceIdentifier instance_id,
57 nacl::string* full_url) = 0; 57 nacl::string* full_url) = 0;
58 58
59 // Write to the JavaScript console. Currently works in Chrome only, generates
60 // an alert in other browsers.
61 virtual bool AddToConsole(InstanceIdentifier instance_id,
62 const nacl::string& text) = 0;
63
59 // Gets the origin of the current page. Origin is scheme://domain. 64 // Gets the origin of the current page. Origin is scheme://domain.
60 bool GetOrigin(InstanceIdentifier instance_id, 65 bool GetOrigin(InstanceIdentifier instance_id,
61 nacl::string* origin); 66 nacl::string* origin);
62 67
63 // Creates a browser scriptable handle for a given portable handle. 68 // Creates a browser scriptable handle for a given portable handle.
64 // If handle is NULL, returns NULL. 69 // If handle is NULL, returns NULL.
65 virtual ScriptableHandle* NewScriptableHandle(PortableHandle* handle) = 0; 70 virtual ScriptableHandle* NewScriptableHandle(PortableHandle* handle) = 0;
66 71
67 // Filename-based version of the function below that takes a char* and size. 72 // Filename-based version of the function below that takes a char* and size.
68 static bool MightBeElfExecutable(const nacl::string& filename, 73 static bool MightBeElfExecutable(const nacl::string& filename,
69 nacl::string* error); 74 nacl::string* error);
70 75
71 // Returns true iff the first |size| bytes of |e_ident_bytes| appear to be 76 // Returns true iff the first |size| bytes of |e_ident_bytes| appear to be
72 // a valid ELF file; returns an informative error message otherwise. 77 // a valid ELF file; returns an informative error message otherwise.
73 // The check for valid ELF executable is only done looking at the e_ident 78 // The check for valid ELF executable is only done looking at the e_ident
74 // bytes. Fuller checking is done by the service_runtime. 79 // bytes. Fuller checking is done by the service_runtime.
75 static bool MightBeElfExecutable(const char* e_ident_bytes, 80 static bool MightBeElfExecutable(const char* e_ident_bytes,
76 size_t size, 81 size_t size,
77 nacl::string* error); 82 nacl::string* error);
78 83
79 static const char* kNoError; 84 static const char* kNoError;
80 static const char* kUnknownURL; 85 static const char* kUnknownURL;
81 }; 86 };
82 87
83 } // namespace plugin 88 } // namespace plugin
84 89
85 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_BROWSER_INTERFACE_H_ 90 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_BROWSER_INTERFACE_H_
OLDNEW
« no previous file with comments | « no previous file | src/trusted/plugin/npapi/browser_impl_npapi.h » ('j') | src/trusted/plugin/npapi/browser_impl_npapi.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698