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

Unified Diff: chrome/common/extensions/docs/examples/apps/background-simple/index.js

Issue 9289057: Changing manifest to v2 extension samples (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding zip files after rebasing with master Created 8 years, 11 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/apps/background-simple/index.js
diff --git a/chrome/common/extensions/docs/examples/apps/background-simple/index.js b/chrome/common/extensions/docs/examples/apps/background-simple/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..970810cec84d9773a48b36f54db004f6d4cd82d0
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/apps/background-simple/index.js
@@ -0,0 +1,28 @@
+// 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.
+
+// Check for support
+if (window.chrome && window.chrome.app && window.chrome.app.isInstalled) {
+ document.getElementById('supported').className = '';
+} else {
+ document.getElementById('unsupported').className = '';
+}
+var bgWinUrl = "background.html#yay";
+var bgWinName = "bgNotifier";
+
+function openBackgroundWindow() {
+ window.open(bgWinUrl, bgWinName, "background");
+}
+
+function closeBackgroundWindow() {
+ var w = window.open(bgWinUrl, bgWinName, "background");
+ w.close();
+}
+
+document.addEventListener('DOMContentLoaded', function() {
+ document.querySelector('#openBackgroundWindow').addEventListener(
+ 'click', openBackgroundWindow);
+ document.querySelector('#closeBackgroundWindow').addEventListener(
+ 'click', closeBackgroundWindow);
+});

Powered by Google App Engine
This is Rietveld 408576698