Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / test / data / extensions / platform_apps / leave_fullscreen / main.js
blob95940b1c3f67c163a0088d040af1dc6863aaaf7d
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 chrome.app.runtime.onLaunched.addListener(function() {
6   chrome.app.window.create('main.html', {}, function(win) {
7     // The following key events handler should have no effect because the
8     // application does not have the 'overrideEscFullscreen' permission.
9     win.contentWindow.document.addEventListener('keydown', function(e) {
10       e.preventDefault();
11     });
12     win.contentWindow.document.addEventListener('keyup', function(e) {
13       e.preventDefault();
14     });
16     chrome.test.sendMessage('Launched', function(reply) {
17       win.contentWindow.document.addEventListener('keydown', function(e) {
18         if (e.keyCode != 90) // 'z'
19           return;
21         chrome.test.sendMessage('KeyReceived');
22       });
24       switch (reply) {
25         case 'window':
26           win.fullscreen();
27           break;
28         case 'dom':
29           win.contentWindow.document.addEventListener('keydown', function() {
30             win.contentWindow.document.removeEventListener('keydown',
31                                                            arguments.callee);
32             win.contentWindow.document.body.webkitRequestFullscreen();
33           });
34           break;
35       }
36     });
37   });
38 });