Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 chrome.app.runtime.onLaunched.addListener(function() { | 5 var panelWindow; |
| 6 chrome.test.sendMessage("Launched"); | 6 var nonShelfWindow; |
| 7 // Create a panel window first | 7 var shelfWindow; |
| 8 chrome.app.window.create( | 8 |
| 9 'main.html', { type: "panel" }, | 9 function processNextCommand() { |
| 10 function (win) { | 10 chrome.test.sendMessage("ready", function(response) { |
| 11 // Set the panel window icon | 11 if (response == 'Exit') { |
| 12 win.setIcon("icon64.png") | 12 return; |
| 13 } | |
| 14 if (response == 'createPanelWindow') { | |
| 15 chrome.app.window.create('main.html', { type: "panel" }, function (win) { | |
| 16 panelWindow = win; | |
| 17 }); | |
| 18 } | |
| 19 if (response == 'setPanelWindowIcon') { | |
| 20 panelWindow.setIcon("icon64.png") | |
| 21 } | |
| 22 if (response == 'createNonShelfWindow') { | |
| 13 // Create the shell window; it should use the app icon, and not affect | 23 // Create the shell window; it should use the app icon, and not affect |
| 14 // the panel icon. | 24 // the panel icon. |
| 15 chrome.app.window.create( | 25 chrome.app.window.create( |
| 16 'main.html', { type: "shell" }, | 26 'main.html', { id: "win", |
| 27 type: "shell" }, | |
| 17 function (win) { | 28 function (win) { |
| 18 // Create the shell window which is shown in shelf; it should use | 29 nonShelfWindow = win; |
|
Devlin
2017/05/31 22:00:01
two-space indentation in functions
khmel
2017/06/01 16:56:52
Done.
| |
| 19 // another custom app icon. | |
| 20 chrome.app.window.create( | |
| 21 'main.html', { id: "win_with_icon", | |
| 22 type: "shell", | |
| 23 icon: "icon48.png", | |
| 24 showInShelf: true }, | |
| 25 function (win) { | |
| 26 chrome.test.sendMessage("Completed"); | |
| 27 }); | |
| 28 }); | 30 }); |
| 29 }); | 31 } |
| 32 if (response == 'createShelfWindow') { | |
| 33 // Create the shell window which is shown in shelf; it should use | |
| 34 // another custom app icon. | |
| 35 chrome.app.window.create( | |
| 36 'main.html', { id: "win_with_icon", | |
| 37 type: "shell", | |
| 38 showInShelf: true }, | |
| 39 function (win) { | |
| 40 shelfWindow = win; | |
| 41 }); | |
| 42 } | |
| 43 if (response == 'setShelfWindowIcon') { | |
| 44 shelfWindow.setIcon("icon32.png") | |
|
Devlin
2017/05/31 22:00:01
single-quotes in js
khmel
2017/06/01 16:56:52
Done.
| |
| 45 } | |
| 46 processNextCommand(); | |
| 47 }); | |
| 48 }; | |
| 49 | |
| 50 | |
| 51 chrome.app.runtime.onLaunched.addListener(function() { | |
| 52 chrome.test.sendMessage("Launched"); | |
| 53 processNextCommand(); | |
| 30 }); | 54 }); |
| 55 | |
| OLD | NEW |