OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 {chrome.app.window.AppWindow} */ | 5 /** @type {chrome.app.window.AppWindow} */ |
6 var mainWindow = null; | 6 var mainWindow = null; |
7 | 7 |
8 /** | 8 /** |
9 * The main window cannot delete its context menu entries on close because it | 9 * The main window cannot delete its context menu entries on close because it |
10 * is being torn down at that point and doesn't have access to the necessary | 10 * is being torn down at that point and doesn't have access to the necessary |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 /** @param {chrome.app.window.AppWindow} appWindow */ | 49 /** @param {chrome.app.window.AppWindow} appWindow */ |
50 function onCreate(appWindow) { | 50 function onCreate(appWindow) { |
51 // Set the global window. | 51 // Set the global window. |
52 mainWindow = appWindow; | 52 mainWindow = appWindow; |
53 | 53 |
54 // Clean up the windows sub-menu when the application quits. | 54 // Clean up the windows sub-menu when the application quits. |
55 appWindow.onClosed.addListener(onClosed); | 55 appWindow.onClosed.addListener(onClosed); |
56 }; | 56 }; |
57 | 57 |
58 chrome.app.window.create('main.html', windowAttributes, onCreate); | 58 // TODO(garykac) Add code to switch between dev and prod shared modules. |
| 59 chrome.app.window.create( |
| 60 '_modules/koejkfhmphamcgafjmkellhnekdkopod/main.html', |
| 61 windowAttributes, onCreate); |
59 }; | 62 }; |
60 | 63 |
61 /** @param {Event} event */ | 64 /** @param {Event} event */ |
62 function onWindowMessage(event) { | 65 function onWindowMessage(event) { |
63 var method = /** @type {string} */ (event.data['method']); | 66 var method = /** @type {string} */ (event.data['method']); |
64 var id = /** @type {string} */ (event.data['id']); | 67 var id = /** @type {string} */ (event.data['id']); |
65 switch (method) { | 68 switch (method) { |
66 case 'addContextMenuId': | 69 case 'addContextMenuId': |
67 contextMenuIds[id] = true; | 70 contextMenuIds[id] = true; |
68 break; | 71 break; |
69 case 'removeContextMenuId': | 72 case 'removeContextMenuId': |
70 delete contextMenuIds[id]; | 73 delete contextMenuIds[id]; |
71 break; | 74 break; |
72 } | 75 } |
73 }; | 76 }; |
74 | 77 |
75 chrome.app.runtime.onLaunched.addListener(createWindow); | 78 chrome.app.runtime.onLaunched.addListener(createWindow); |
76 window.addEventListener('message', onWindowMessage, false); | 79 window.addEventListener('message', onWindowMessage, false); |
OLD | NEW |