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

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

Issue 10541180: Cleanup build system (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
Index: native_client_sdk/src/examples/hello_world_newlib/hello_world.html
===================================================================
--- native_client_sdk/src/examples/hello_world_newlib/hello_world.html (revision 142181)
+++ native_client_sdk/src/examples/hello_world_newlib/hello_world.html (working copy)
@@ -1,109 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
- Copyright (c) 2012 The Chromium Authors. All rights reserved.
- Use of this source code is governed by a BSD-style license that can be
- 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">
- naclModule = null; // Global application object.
- statusText = 'NO-STATUSES';
-
- 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() {
- naclModule = document.getElementById('nacl_module');
- updateStatus('SUCCESS');
- }
-
- // Handle a message coming from the NaCl module.
- function handleMessage(message_event) {
- alert(message_event.data);
- }
-
- // If the page loads before the Native Client module loads, then set the
- // status message indicating that the module is still loading. Otherwise,
- // do not change the status message.
- function pageDidLoad() {
- 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('Waiting.');
- }
- }
-
- // Set the global status message. If the element with id 'statusField'
- // exists, then set its HTML to the status message as well.
- // opt_message The message test. If this is null or undefined, then
- // attempt to set the element with id 'statusField' to the value of
- // |statusText|.
- function updateStatus(opt_message) {
- if (opt_message)
- statusText = opt_message;
- var statusField = document.getElementById('statusField');
- if (statusField) {
- statusField.innerHTML = statusText;
- }
- }
- </script>
-</head>
-<body onload="pageDidLoad()">
-
-<h1>Native Client Simple Module</h1>
-<h2>Status: <code id="statusField">NO-STATUS</code></h2>
- <!-- The <EMBED> element is wrapped inside a <DIV>, which has both a 'load'
- and a 'message' event listener attached. This wrapping method is used
- instead of attaching the event listeners directly to the <EMBED> element to
- ensure that the listeners are active before the NaCl module 'load' event
- fires. This also allows you to use PPB_Messaging.PostMessage() (in C) or
- pp::Instance.PostMessage() (in C++) from within the initialization code in
- your NaCl module.
-
- The src points to a manifest file, which provides the Native Client plug-in
- a mapping between architecture and NaCl Executable (NEXE).
-
- We use a non-zero sized embed to give Chrome space to place the bad plug-in
- graphic, if there is a problem.
- -->
- <div id="listener">
- <script type="text/javascript">
- var listener = document.getElementById('listener')
- listener.addEventListener('load', moduleDidLoad, true);
- listener.addEventListener('message', handleMessage, true);
- </script>
- </div>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698