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

Unified Diff: chrome/common/extensions/docs/examples/howto/sandbox/sandbox.html

Issue 10810054: Describing the `sandbox` workflow for extension developers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/examples/howto/sandbox/sandbox.html
diff --git a/chrome/common/extensions/docs/examples/howto/sandbox/sandbox.html b/chrome/common/extensions/docs/examples/howto/sandbox/sandbox.html
new file mode 100644
index 0000000000000000000000000000000000000000..0f7451807a463f0b4c0443a960a6b06baf024e5d
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/howto/sandbox/sandbox.html
@@ -0,0 +1,42 @@
+<!--
+ - 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.
+ -->
+<!doctype html>
+<html>
+ <head>
+ <script src="handlebars-1.0.0.beta.6.js"></script>
+ </head>
+ <body>
+ <script id="hello-world-template" type="text/x-handlebars-template">
+ <div class="entry">
+ <h1>Hello, {{thing}}!</h1>
+ </div>
+ </script>
+ <script>
+ var templates = [];
+ var source = document.getElementById('hello-world-template').innerHTML;
+ templates['hello'] = Handlebars.compile(source);
+
+ // Set up message event handler:
+ window.addEventListener('message', function(event) {
+ var command = event.data.command;
+ var name = event.data.name || 'hello';
+ switch(command) {
+ case 'render':
+ event.source.postMessage({
+ name: name,
+ html: templates[name](event.data.context)
+ }, event.origin);
+ break;
+
+ case 'new':
Mihai Parparita -not on Chrome 2012/07/25 03:00:57 This doesn't seem to be used.
+ templates[event.data.name] = Handlebars.compile(event.data.source);
+ event.source.postMessage({name: name, success: true}, event.origin);
+ break;
+ }
+ });
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698