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

Unified Diff: native_client_sdk/src/examples/hello_world_newlib/hello_world.html

Issue 10539082: Add DSC files for the various examples. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/src/examples/hello_world_newlib/hello_world.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/examples/hello_world_newlib/hello_world.html
===================================================================
--- native_client_sdk/src/examples/hello_world_newlib/hello_world.html (revision 141601)
+++ native_client_sdk/src/examples/hello_world_newlib/hello_world.html (working copy)
@@ -1,4 +1,5 @@
-<!DOCTYPE html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<!--
Copyright (c) 2012 The Chromium Authors. All rights reserved.
@@ -6,14 +7,39 @@
found in the LICENSE file.
-->
<head>
+ <meta http-equiv="Pragma" content="no-cache" />
+ <meta http-equiv="Expires" content="-1" />
<title>Hello, World!</title>
<script type="text/javascript">
- helloWorldModule = null; // Global application object.
- statusText = 'NO-STATUS';
+ naclModule = null; // Global application object.
+ statusText = 'NO-STATUSES';
- // Indicate success when the NaCl module has loaded.
+ function ExtractSearchParameter(name, def_value) {
+ var nameIndex = window.location.search.indexOf(name + "=");
+ if (nameIndex != -1) {
+ var value = location.search.substring(nameIndex + name.length + 1);
+ var endIndex = value.indexOf("&");
+ if (endIndex != -1)
+ value = value.substring(0, endIndex);
+ return value;
+ }
+ return def_value;
+ }
+
+ function createNaClModule(name, tool, width, height) {
+ var listenerDiv = document.getElementById('listener');
+ var naclModule = document.createElement('embed');
+ naclModule.setAttribute('name', 'nacl_module');
+ naclModule.setAttribute('id', 'file_io');
+ naclModule.setAttribute('width', width);
+ naclModule.setAttribute('height',height);
+ naclModule.setAttribute('src', tool + '/' + name + '.nmf');
+ naclModule.setAttribute('type', 'application/x-nacl');
+ listenerDiv.appendChild(naclModule);
+ }
+ // Indicate success when the NaCl module has loaded.
function moduleDidLoad() {
- helloWorldModule = document.getElementById('hello_world');
+ naclModule = document.getElementById('nacl_module');
updateStatus('SUCCESS');
}
@@ -26,14 +52,17 @@
// status message indicating that the module is still loading. Otherwise,
// do not change the status message.
function pageDidLoad() {
- if (helloWorldModule == null) {
- updateStatus('LOADING...');
+ updateStatus('Page loaded.');
+ if (naclModule == null) {
+ tool = ExtractSearchParameter('tool', 'newlib');
+ updateStatus('Creating embed: ' + tool)
+ createNaClModule('hello_world', tool, 200, 200)
} else {
// It's possible that the Native Client module onload event fired
// before the page's onload event. In this case, the status message
// will reflect 'SUCCESS', but won't be displayed. This call will
// display the current message.
- updateStatus();
+ updateStatus('Waiting.');
}
}
@@ -76,12 +105,6 @@
listener.addEventListener('load', moduleDidLoad, true);
listener.addEventListener('message', handleMessage, true);
</script>
-
- <embed name="nacl_module"
- id="hello_world"
- width=200 height=200
- src="hello_world.nmf"
- type="application/x-nacl" />
</div>
</body>
</html>
« no previous file with comments | « native_client_sdk/src/examples/hello_world_newlib/hello_world.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698