| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** @type {string} */ | 5 /** @type {string} */ |
| 6 var kNewWindowId = 'new-window'; | 6 var kNewWindowId = 'new-window'; |
| 7 | 7 |
| 8 function createWindow() { | 8 function createWindow() { |
| 9 chrome.app.window.create('main.html', { | 9 chrome.app.window.create('main.html', { |
| 10 'width': 800, | 10 'width': 800, |
| 11 'height': 600 | 11 'height': 600, |
| 12 'frame': 'none' |
| 12 }); | 13 }); |
| 13 }; | 14 }; |
| 14 | 15 |
| 15 /** @param {OnClickData} info */ | 16 /** @param {OnClickData} info */ |
| 16 function onContextMenu(info) { | 17 function onContextMenu(info) { |
| 17 if (info.menuItemId == kNewWindowId) { | 18 if (info.menuItemId == kNewWindowId) { |
| 18 createWindow(); | 19 createWindow(); |
| 19 } | 20 } |
| 20 }; | 21 }; |
| 21 | 22 |
| 22 function initializeContextMenu() { | 23 function initializeContextMenu() { |
| 23 chrome.contextMenus.create({ | 24 chrome.contextMenus.create({ |
| 24 id: kNewWindowId, | 25 id: kNewWindowId, |
| 25 contexts: ['launcher'], | 26 contexts: ['launcher'], |
| 26 title: chrome.i18n.getMessage(/*i18n-content*/'NEW_WINDOW') | 27 title: chrome.i18n.getMessage(/*i18n-content*/'NEW_WINDOW') |
| 27 }); | 28 }); |
| 28 } | 29 } |
| 29 | 30 |
| 30 chrome.app.runtime.onLaunched.addListener(createWindow); | 31 chrome.app.runtime.onLaunched.addListener(createWindow); |
| 31 chrome.contextMenus.onClicked.addListener(onContextMenu); | 32 chrome.contextMenus.onClicked.addListener(onContextMenu); |
| 32 initializeContextMenu(); | 33 initializeContextMenu(); |
| OLD | NEW |