OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 * Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 3 * Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
4 * source code is governed by a BSD-style license that can be found in the | 4 * source code is governed by a BSD-style license that can be found in the |
5 * LICENSE file. | 5 * LICENSE file. |
6 --> | 6 --> |
7 <html> | 7 <html> |
8 <head> | 8 <head> |
9 <title> Simple Background App </title> | 9 <title>Simple Background App</title> |
10 <style> | 10 <style> |
11 .hidden { display: none; } | 11 .hidden { display: none; } |
12 #unsupported { color: #d00; } | 12 #unsupported { color: #d00; } |
13 </style> | 13 </style> |
14 </head> | 14 </head> |
15 <body> | 15 <body> |
16 <h1> Simple Background App </h1> | 16 <h1>Simple Background App</h1> |
17 <p id="supported" class="hidden"> | 17 <p id="supported" class="hidden"> |
18 <button onclick="openBackgroundWindow()">Open background window</button> | 18 <button id="openBackgroundWindow">Open background window</button> |
19 <button onclick="closeBackgroundWindow()">Close background window</button> | 19 <button id="closeBackgroundWindow">Close background window</button> |
20 </p> | 20 </p> |
21 <p id="unsupported" class="hidden"> | 21 <p id="unsupported" class="hidden"> |
22 You are not using Chrome or have not installed the application for this | 22 You are not using Chrome or have not installed the application for this |
23 page. | 23 page. |
24 </p> | 24 </p> |
25 <script> | 25 <script src="index.js"></script> |
26 // Check for support | |
27 if (window.chrome && window.chrome.app && window.chrome.app.isInstalled) { | |
28 document.getElementById('supported').className = ''; | |
29 } else { | |
30 document.getElementById('unsupported').className = ''; | |
31 } | |
32 var bgWinUrl = "background.html#yay"; | |
33 var bgWinName = "bgNotifier"; | |
34 | |
35 function openBackgroundWindow() { | |
36 window.open(bgWinUrl, bgWinName, "background"); | |
37 } | |
38 function closeBackgroundWindow() { | |
39 var w = window.open(bgWinUrl, bgWinName, "background"); | |
40 w.close(); | |
41 } | |
42 </script> | |
43 <p> | 26 <p> |
44 This app displays a notification | 27 This app displays a notification |
45 whenever its background window is created. | 28 whenever its background window is created. |
46 Background windows and this app are described in the | 29 Background windows and this app are described in the |
47 <a href="http://code.google.com/chrome/apps/docs/developers_guide.html">ap
ps documentation</a>. | 30 <a href="http://code.google.com/chrome/apps/docs/developers_guide.html">ap
ps documentation</a>. |
48 </p> | 31 </p> |
49 <p> | 32 <p> |
50 The generic source code is available for | 33 The generic source code is available for |
51 <a href="http://code.google.com/chrome/extensions/trunk/examples/apps/back
ground-simple.zip">download</a>. | 34 <a href="http://code.google.com/chrome/extensions/trunk/examples/apps/back
ground-simple.zip">download</a>. |
52 The | 35 The |
53 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/ext
ensions/docs/examples/apps/background-simple/README?content-type=text/plain">REA
DME</a> | 36 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/ext
ensions/docs/examples/apps/background-simple/README?content-type=text/plain">REA
DME</a> |
54 tells you how to modify the code. | 37 tells you how to modify the code. |
55 </p> | 38 </p> |
56 <p> | 39 <p> |
57 If you just want to run a version of this app that's already on the web, | 40 If you just want to run a version of this app that's already on the web, |
58 here's how: | 41 here's how: |
59 </p> | 42 </p> |
60 <ol> | 43 <ol> |
61 <li> | 44 <li> |
62 <a href="http://background-simple.appspot.com/app.crx">Install the app</
a> | 45 <a href="http://background-simple.appspot.com/app.crx">Install the app</
a> |
63 from background-simple.appspot.com. | 46 from background-simple.appspot.com. |
64 </li> | 47 </li> |
65 <li> | 48 <li> |
66 Launch Simple Background App from the New Tab page. | 49 Launch Simple Background App from the New Tab page. |
67 </li> | 50 </li> |
68 </ol> | 51 </ol> |
69 </body> | 52 </body> |
70 </html> | 53 </html> |
OLD | NEW |