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 var ItemsList = apps_dev_tool.ItemsList; | 5 var ItemsList = apps_dev_tool.ItemsList; |
6 | 6 |
7 // The list of all apps & extensions. | 7 // The list of all apps & extensions. |
8 var completeList = []; | 8 var completeList = []; |
9 | 9 |
10 // The list of all apps. | 10 // The list of all apps. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 AppsDevTool.prototype = { | 110 AppsDevTool.prototype = { |
111 __proto__: HTMLDivElement.prototype, | 111 __proto__: HTMLDivElement.prototype, |
112 | 112 |
113 /** | 113 /** |
114 * Perform initial setup. | 114 * Perform initial setup. |
115 */ | 115 */ |
116 initialize: function() { | 116 initialize: function() { |
117 // Set up the three buttons (load unpacked, pack and update). | 117 // Set up the three buttons (load unpacked, pack and update). |
118 $('load-unpacked').addEventListener('click', | 118 $('load-unpacked').addEventListener('click', |
119 this.handleLoadUnpackedItem_.bind(this)); | 119 this.handleLoadUnpackedItem_.bind(this)); |
120 $('pack-item').addEventListener('click', | |
121 this.handlePackItem_.bind(this)); | |
120 $('update-items-now').addEventListener('click', | 122 $('update-items-now').addEventListener('click', |
121 this.handleUpdateItemNow_.bind(this)); | 123 this.handleUpdateItemNow_.bind(this)); |
122 | 124 |
125 var packItemOverlay = apps_dev_tool.PackItemOverlay.getInstance(); | |
126 packItemOverlay.initializePage(); | |
Dan Beam
2013/02/14 21:10:40
nit:
apps_dev_tool.PackItemOverlay.getInstance()
Gaurav
2013/02/15 17:54:24
Done.
| |
123 }, | 127 }, |
124 | 128 |
125 /** | 129 /** Handles the Load Unpacked Extension button. |
126 * Handles the Load Unpacked Extension button. | 130 * @param {Event} e Change event. |
127 * @param {!Event} e Change event. | |
128 * @private | 131 * @private |
129 */ | 132 */ |
130 handleLoadUnpackedItem_: function(e) { | 133 handleLoadUnpackedItem_: function(e) { |
131 chrome.developerPrivate.loadUnpacked(function(success) { | 134 chrome.developerPrivate.loadUnpacked(function(success) { |
132 loadItemsInfo(); | 135 loadItemsInfo(); |
133 }); | 136 }); |
134 }, | 137 }, |
135 | 138 |
139 /** Handles the Pack Extension button. | |
140 * @param {Event} e Change event. | |
141 * @private | |
142 */ | |
143 handlePackItem_: function(e) { | |
144 AppsDevTool.showOverlay($('packItemOverlay')); | |
145 }, | |
146 | |
136 /** | 147 /** |
137 * Handles the Update Extension Now Button. | 148 * Handles the Update Extension Now Button. |
138 * @param {Event} e Change event. | 149 * @param {Event} e Change event. |
139 * @private | 150 * @private |
140 */ | 151 */ |
141 handleUpdateItemNow_: function(e) { | 152 handleUpdateItemNow_: function(e) { |
142 chrome.developerPrivate.autoUpdate(function(response) {}); | 153 chrome.developerPrivate.autoUpdate(function(response) {}); |
143 }, | 154 }, |
144 }; | 155 }; |
145 | 156 |
146 /** | 157 /** |
147 * Returns the current overlay or null if one does not exist. | 158 * Returns the current overlay or null if one does not exist. |
148 * @return {Element} The overlay element. | 159 * @return {Element} The overlay element. |
149 */ | 160 */ |
150 AppsDevTool.getCurrentOverlay = function() { | 161 AppsDevTool.getCurrentOverlay = function() { |
151 return this.ownerDocument.querySelector('#overlay .page.showing'); | 162 return document.querySelector('#overlay .page.showing'); |
152 }; | 163 }; |
153 | 164 |
154 /** | 165 /** |
155 * Shows |el|. If there's another overlay showing, hide it. | 166 * Shows |el|. If there's another overlay showing, hide it. |
156 * @param {HTMLElement} el The overlay page to show. If falsey, all overlays | 167 * @param {HTMLElement} el The overlay page to show. If falsey, all overlays |
157 * are hidden. | 168 * are hidden. |
158 */ | 169 */ |
159 AppsDevTool.showOverlay = function(el) { | 170 AppsDevTool.showOverlay = function(el) { |
160 var currentlyShowingOverlay = AppsDevTool.getCurrentOverlay(); | 171 var currentlyShowingOverlay = AppsDevTool.getCurrentOverlay(); |
161 if (currentlyShowingOverlay) | 172 if (currentlyShowingOverlay) |
162 currentlyShowingOverlay.classList.remove('showing'); | 173 currentlyShowingOverlay.classList.remove('showing'); |
163 if (el) | 174 if (el) |
164 el.classList.add('showing'); | 175 el.classList.add('showing'); |
165 overlay.hidden = !el; | 176 overlay.hidden = !el; |
166 uber.invokeMethodOnParent(el ? 'beginInterceptingEvents' : | 177 uber.invokeMethodOnParent(el ? 'beginInterceptingEvents' : |
167 'stopInterceptingEvents'); | 178 'stopInterceptingEvents'); |
168 }; | 179 }; |
OLD | NEW |