| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
| 6 * The different pages that can be shown at a time. | 6 * The different pages that can be shown at a time. |
| 7 * Note: This must remain in sync with the order in manager.html! | 7 * Note: This must remain in sync with the order in manager.html! |
| 8 * @enum {string} | 8 * @enum {string} |
| 9 */ | 9 */ |
| 10 var Page = { | 10 var Page = { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 function compareLocation(x, y) { | 30 function compareLocation(x, y) { |
| 31 if (x.location == y.location) | 31 if (x.location == y.location) |
| 32 return 0; | 32 return 0; |
| 33 if (x.location == chrome.developerPrivate.Location.UNPACKED) | 33 if (x.location == chrome.developerPrivate.Location.UNPACKED) |
| 34 return -1; | 34 return -1; |
| 35 if (y.location == chrome.developerPrivate.Location.UNPACKED) | 35 if (y.location == chrome.developerPrivate.Location.UNPACKED) |
| 36 return 1; | 36 return 1; |
| 37 return 0; | 37 return 0; |
| 38 } | 38 } |
| 39 return compareLocation(a, b) || | 39 return compareLocation(a, b) || |
| 40 compare(a.name.toLowerCase(), b.name.toLowerCase()) || | 40 compare(a.name.toLowerCase(), b.name.toLowerCase()) || |
| 41 compare(a.id, b.id); | 41 compare(a.id, b.id); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 var Manager = Polymer({ | 44 var Manager = Polymer({ |
| 45 is: 'extensions-manager', | 45 is: 'extensions-manager', |
| 46 | 46 |
| 47 behaviors: [I18nBehavior], | 47 behaviors: [I18nBehavior], |
| 48 | 48 |
| 49 properties: { | 49 properties: { |
| 50 /** @type {extensions.Sidebar} */ | 50 /** @type {extensions.Sidebar} */ |
| 51 sidebar: Object, | 51 sidebar: Object, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 76 /** | 76 /** |
| 77 * The item currently displayed in the details view subpage. See also | 77 * The item currently displayed in the details view subpage. See also |
| 78 * errorPageItem_. | 78 * errorPageItem_. |
| 79 * @private {!chrome.developerPrivate.ExtensionInfo|undefined} | 79 * @private {!chrome.developerPrivate.ExtensionInfo|undefined} |
| 80 */ | 80 */ |
| 81 detailViewItem_: Object, | 81 detailViewItem_: Object, |
| 82 | 82 |
| 83 /** @type {!Array<!chrome.developerPrivate.ExtensionInfo>} */ | 83 /** @type {!Array<!chrome.developerPrivate.ExtensionInfo>} */ |
| 84 extensions: { | 84 extensions: { |
| 85 type: Array, | 85 type: Array, |
| 86 value: function() { return []; }, | 86 value: function() { |
| 87 return []; |
| 88 }, |
| 87 }, | 89 }, |
| 88 | 90 |
| 89 /** @type {!Array<!chrome.developerPrivate.ExtensionInfo>} */ | 91 /** @type {!Array<!chrome.developerPrivate.ExtensionInfo>} */ |
| 90 apps: { | 92 apps: { |
| 91 type: Array, | 93 type: Array, |
| 92 value: function() { return []; }, | 94 value: function() { |
| 95 return []; |
| 96 }, |
| 93 }, | 97 }, |
| 94 }, | 98 }, |
| 95 | 99 |
| 96 listeners: { | 100 listeners: { |
| 97 'items-list.extension-item-show-details': 'onShouldShowItemDetails_', | 101 'items-list.extension-item-show-details': 'onShouldShowItemDetails_', |
| 98 'items-list.extension-item-show-errors': 'onShouldShowItemErrors_', | 102 'items-list.extension-item-show-errors': 'onShouldShowItemErrors_', |
| 99 }, | 103 }, |
| 100 | 104 |
| 101 created: function() { | 105 created: function() { |
| 102 this.readyPromiseResolver = new PromiseResolver(); | 106 this.readyPromiseResolver = new PromiseResolver(); |
| 103 }, | 107 }, |
| 104 | 108 |
| 105 ready: function() { | 109 ready: function() { |
| 106 /** @type {extensions.Sidebar} */ | 110 /** @type {extensions.Sidebar} */ |
| 107 this.sidebar = | 111 this.sidebar = |
| 108 /** @type {extensions.Sidebar} */(this.$$('extensions-sidebar')); | 112 /** @type {extensions.Sidebar} */ (this.$$('extensions-sidebar')); |
| 109 this.listHelper_ = new ListHelper(this); | 113 this.listHelper_ = new ListHelper(this); |
| 110 this.sidebar.setListDelegate(this.listHelper_); | 114 this.sidebar.setListDelegate(this.listHelper_); |
| 111 this.readyPromiseResolver.resolve(); | 115 this.readyPromiseResolver.resolve(); |
| 112 }, | 116 }, |
| 113 | 117 |
| 114 get keyboardShortcuts() { | 118 get keyboardShortcuts() { |
| 115 return this.$['keyboard-shortcuts']; | 119 return this.$['keyboard-shortcuts']; |
| 116 }, | 120 }, |
| 117 | 121 |
| 118 get packDialog() { | 122 get packDialog() { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 this.set([listId, index], item); | 226 this.set([listId, index], item); |
| 223 | 227 |
| 224 // Update the subpage if it is open and displaying the item. If it's not | 228 // Update the subpage if it is open and displaying the item. If it's not |
| 225 // open, we don't update the data even if it's displaying that item. We'll | 229 // open, we don't update the data even if it's displaying that item. We'll |
| 226 // set the item correctly before opening the page. It's a little weird | 230 // set the item correctly before opening the page. It's a little weird |
| 227 // that the DOM will have stale data, but there's no point in causing the | 231 // that the DOM will have stale data, but there's no point in causing the |
| 228 // extra work. | 232 // extra work. |
| 229 if (this.detailViewItem_ && this.detailViewItem_.id == item.id && | 233 if (this.detailViewItem_ && this.detailViewItem_.id == item.id && |
| 230 this.$.pages.selected == Page.DETAIL_VIEW) { | 234 this.$.pages.selected == Page.DETAIL_VIEW) { |
| 231 this.detailViewItem_ = item; | 235 this.detailViewItem_ = item; |
| 232 } else if (this.errorPageItem_ && this.errorPageItem_.id == item.id && | 236 } else if ( |
| 233 this.$.pages.selected == Page.ERROR_PAGE) { | 237 this.errorPageItem_ && this.errorPageItem_.id == item.id && |
| 238 this.$.pages.selected == Page.ERROR_PAGE) { |
| 234 this.errorPageItem_ = item; | 239 this.errorPageItem_ = item; |
| 235 } | 240 } |
| 236 }, | 241 }, |
| 237 | 242 |
| 238 /** | 243 /** |
| 239 * @param {!chrome.developerPrivate.ExtensionInfo} item The data for the | 244 * @param {!chrome.developerPrivate.ExtensionInfo} item The data for the |
| 240 * item to remove. | 245 * item to remove. |
| 241 */ | 246 */ |
| 242 removeItem: function(item) { | 247 removeItem: function(item) { |
| 243 var listId = this.getListId_(item.type); | 248 var listId = this.getListId_(item.type); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 271 /** | 276 /** |
| 272 * Changes the active page selection. | 277 * Changes the active page selection. |
| 273 * @param {Page} toPage | 278 * @param {Page} toPage |
| 274 */ | 279 */ |
| 275 changePage: function(toPage) { | 280 changePage: function(toPage) { |
| 276 var fromPage = this.$.pages.selected; | 281 var fromPage = this.$.pages.selected; |
| 277 if (fromPage == toPage) | 282 if (fromPage == toPage) |
| 278 return; | 283 return; |
| 279 var entry; | 284 var entry; |
| 280 var exit; | 285 var exit; |
| 281 if (fromPage == Page.ITEM_LIST && (toPage == Page.DETAIL_VIEW || | 286 if (fromPage == Page.ITEM_LIST && |
| 282 toPage == Page.ERROR_PAGE)) { | 287 (toPage == Page.DETAIL_VIEW || toPage == Page.ERROR_PAGE)) { |
| 283 entry = extensions.Animation.HERO; | 288 entry = extensions.Animation.HERO; |
| 284 exit = extensions.Animation.HERO; | 289 exit = extensions.Animation.HERO; |
| 285 } else if (toPage == Page.ITEM_LIST) { | 290 } else if (toPage == Page.ITEM_LIST) { |
| 286 entry = extensions.Animation.FADE_IN; | 291 entry = extensions.Animation.FADE_IN; |
| 287 exit = extensions.Animation.SCALE_DOWN; | 292 exit = extensions.Animation.SCALE_DOWN; |
| 288 } else { | 293 } else { |
| 289 assert(toPage == Page.DETAIL_VIEW || | 294 assert(toPage == Page.DETAIL_VIEW || toPage == Page.KEYBOARD_SHORTCUTS); |
| 290 toPage == Page.KEYBOARD_SHORTCUTS); | |
| 291 entry = extensions.Animation.FADE_IN; | 295 entry = extensions.Animation.FADE_IN; |
| 292 exit = extensions.Animation.FADE_OUT; | 296 exit = extensions.Animation.FADE_OUT; |
| 293 } | 297 } |
| 294 this.getPage_(fromPage).animationHelper.setExitAnimation(exit); | 298 this.getPage_(fromPage).animationHelper.setExitAnimation(exit); |
| 295 this.getPage_(toPage).animationHelper.setEntryAnimation(entry); | 299 this.getPage_(toPage).animationHelper.setEntryAnimation(entry); |
| 296 this.$.pages.selected = toPage; | 300 this.$.pages.selected = toPage; |
| 297 }, | 301 }, |
| 298 | 302 |
| 299 /** | 303 /** |
| 300 * Handles the event for the user clicking on a details button. | 304 * Handles the event for the user clicking on a details button. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 var items; | 351 var items; |
| 348 switch (type) { | 352 switch (type) { |
| 349 case extensions.ShowingType.EXTENSIONS: | 353 case extensions.ShowingType.EXTENSIONS: |
| 350 items = this.manager_.extensions; | 354 items = this.manager_.extensions; |
| 351 break; | 355 break; |
| 352 case extensions.ShowingType.APPS: | 356 case extensions.ShowingType.APPS: |
| 353 items = this.manager_.apps; | 357 items = this.manager_.apps; |
| 354 break; | 358 break; |
| 355 } | 359 } |
| 356 | 360 |
| 357 this.manager_.$/* hack */ ['items-list'].set('items', assert(items)); | 361 this.manager_.$ /* hack */['items-list'].set('items', assert(items)); |
| 358 this.manager_.changePage(Page.ITEM_LIST); | 362 this.manager_.changePage(Page.ITEM_LIST); |
| 359 }, | 363 }, |
| 360 | 364 |
| 361 /** @override */ | 365 /** @override */ |
| 362 showKeyboardShortcuts: function() { | 366 showKeyboardShortcuts: function() { |
| 363 this.manager_.changePage(Page.KEYBOARD_SHORTCUTS); | 367 this.manager_.changePage(Page.KEYBOARD_SHORTCUTS); |
| 364 }, | 368 }, |
| 365 | 369 |
| 366 /** @override */ | 370 /** @override */ |
| 367 showPackDialog: function() { | 371 showPackDialog: function() { |
| 368 this.manager_.packDialog.show(); | 372 this.manager_.packDialog.show(); |
| 369 } | 373 } |
| 370 }; | 374 }; |
| 371 | 375 |
| 372 return {Manager: Manager}; | 376 return {Manager: Manager}; |
| 373 }); | 377 }); |
| OLD | NEW |