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 = appsDevtool.PackItemOverlay.getInstance(); | |
126 packItemOverlay.initializePage(); | |
Dan Beam
2013/02/11 23:44:24
nit: indent off
Gaurav
2013/02/12 19:33:17
Done.
| |
127 | |
Dan Beam
2013/02/11 23:44:24
nit: remove \n
Gaurav
2013/02/12 19:33:17
Done.
| |
123 }, | 128 }, |
124 | 129 |
125 /** | 130 /** Handles the Load Unpacked Extension button. |
126 * Handles the Load Unpacked Extension button. | 131 * @param {Event} e Change event. |
127 * @param {!Event} e Change event. | |
128 * @private | 132 * @private |
129 */ | 133 */ |
130 handleLoadUnpackedItem_: function(e) { | 134 handleLoadUnpackedItem_: function(e) { |
131 chrome.developerPrivate.loadUnpacked(function(success) { | 135 chrome.developerPrivate.loadUnpacked(function(success) { |
132 loadItemsInfo(); | 136 loadItemsInfo(); |
133 }); | 137 }); |
134 }, | 138 }, |
135 | 139 |
140 /** Handles the Pack Extension button. | |
141 * @param {Event} e Change event. | |
142 * @private | |
143 */ | |
144 handlePackItem_: function(e) { | |
145 AppsDevTool.showOverlay($('packItemOverlay')); | |
146 }, | |
147 | |
136 /** | 148 /** |
137 * Handles the Update Extension Now Button. | 149 * Handles the Update Extension Now Button. |
138 * @param {Event} e Change event. | 150 * @param {Event} e Change event. |
139 * @private | 151 * @private |
140 */ | 152 */ |
141 handleUpdateItemNow_: function(e) { | 153 handleUpdateItemNow_: function(e) { |
142 chrome.developerPrivate.autoUpdate(function(response) {}); | 154 chrome.developerPrivate.autoUpdate(function(response) {}); |
143 }, | 155 }, |
144 }; | 156 }; |
145 | 157 |
146 /** | 158 /** |
147 * Returns the current overlay or null if one does not exist. | 159 * Returns the current overlay or null if one does not exist. |
148 * @return {Element} The overlay element. | 160 * @return {Element} The overlay element. |
149 */ | 161 */ |
150 AppsDevTool.getCurrentOverlay = function() { | 162 AppsDevTool.getCurrentOverlay = function() { |
151 return this.ownerDocument.querySelector('#overlay .page.showing'); | 163 return document.querySelector('#overlay .page.showing'); |
Dan Beam
2013/02/11 23:44:24
why did you change this?
Gaurav
2013/02/12 19:33:17
this.ownerDocument returns null.
On 2013/02/11 23
Dan Beam
2013/02/14 21:10:40
ah, 'cuz it's static, OK
| |
152 }; | 164 }; |
153 | 165 |
154 /** | 166 /** |
155 * Shows |el|. If there's another overlay showing, hide it. | 167 * Shows |el|. If there's another overlay showing, hide it. |
156 * @param {HTMLElement} el The overlay page to show. If falsey, all overlays | 168 * @param {HTMLElement} el The overlay page to show. If falsey, all overlays |
157 * are hidden. | 169 * are hidden. |
158 */ | 170 */ |
159 AppsDevTool.showOverlay = function(el) { | 171 AppsDevTool.showOverlay = function(el) { |
160 var currentlyShowingOverlay = AppsDevTool.getCurrentOverlay(); | 172 var currentlyShowingOverlay = AppsDevTool.getCurrentOverlay(); |
161 if (currentlyShowingOverlay) | 173 if (currentlyShowingOverlay) |
162 currentlyShowingOverlay.classList.remove('showing'); | 174 currentlyShowingOverlay.classList.remove('showing'); |
163 if (el) | 175 if (el) |
164 el.classList.add('showing'); | 176 el.classList.add('showing'); |
165 overlay.hidden = !el; | 177 overlay.hidden = !el; |
166 uber.invokeMethodOnParent(el ? 'beginInterceptingEvents' : | 178 uber.invokeMethodOnParent(el ? 'beginInterceptingEvents' : |
167 'stopInterceptingEvents'); | 179 'stopInterceptingEvents'); |
168 }; | 180 }; |
OLD | NEW |