aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/nacl/SampleApp/index.html
diff options
context:
space:
mode:
authorGravatar borenet@google.com <borenet@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-06 12:50:00 +0000
committerGravatar borenet@google.com <borenet@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-06 12:50:00 +0000
commit6a98b8c0b5ffe1a23902cdf7e692f702b703eaeb (patch)
tree7c5b356f6fa4fb71876465f372eedc3d3ee25801 /platform_tools/nacl/SampleApp/index.html
parentf073b3332d7c9f7dba6bcf7eb93708593a90036c (diff)
Copy NaCl directory into trunk/platform_tools, adjust paths
(SkipBuildbotRuns) R=djsollen@google.com Review URL: https://codereview.chromium.org/14771017 git-svn-id: http://skia.googlecode.com/svn/trunk@9008 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'platform_tools/nacl/SampleApp/index.html')
-rw-r--r--platform_tools/nacl/SampleApp/index.html71
1 files changed, 71 insertions, 0 deletions
diff --git a/platform_tools/nacl/SampleApp/index.html b/platform_tools/nacl/SampleApp/index.html
new file mode 100644
index 0000000000..cbdeefe029
--- /dev/null
+++ b/platform_tools/nacl/SampleApp/index.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+ <!--
+ Copyright 2013 Google Inc.
+
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+ -->
+<head>
+
+ <title>Skia Sample App</title>
+
+ <script type="text/javascript">
+ "use strict";
+
+ var SkiaModule = null; // Global application object.
+
+ // Force a re-draw of the given element.
+ function refresh(elem) {
+ var old_display_style = elem.style.display;
+ elem.style.display = "none";
+ elem.style.display = old_display_style;
+ }
+
+ // When the module loads, begin running the application.
+ function moduleDidLoad() {
+ SkiaModule = document.getElementById("skia_nacl");
+ run();
+ }
+
+ function handleMessage(message_event) {
+ var skdebugf_cmd = "SkDebugf:";
+ if (message_event.data.indexOf(skdebugf_cmd) == 0) {
+ var msg_contents = message_event.data.slice(skdebugf_cmd.length)
+ console.log("Skia: " + msg_contents);
+ } else {
+ alert(message_event.data);
+ }
+ }
+
+ // Run the application.
+ function run() {
+ if (SkiaModule) {
+ var cmd = "init";
+ SkiaModule.postMessage(cmd);
+ } else {
+ alert("The Skia module has not properly loaded...");
+ }
+ }
+ </script>
+</head>
+<body>
+
+<h1>Skia Sample App</h1>
+<p>
+ <div id="listener">
+ <script type="text/javascript">
+ var listener = document.getElementById('listener');
+ listener.addEventListener('load', moduleDidLoad, true);
+ listener.addEventListener('message', handleMessage, true);
+ </script>
+
+ <embed name="nacl_module"
+ id="skia_nacl"
+ width=0 height=0
+ src="SampleApp.nmf"
+ type="application/x-nacl" />
+ </div>
+</p>
+</body>
+</html>