Chromium Code Reviews| 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 <include src="../shared/js/cr/ui/drag_wrapper.js"></include> | |
| 5 <include src="../uber/uber_utils.js"></include> | 6 <include src="../uber/uber_utils.js"></include> |
| 6 <include src="extension_list.js"></include> | 7 <include src="extension_list.js"></include> |
| 7 <include src="pack_extension_overlay.js"></include> | 8 <include src="pack_extension_overlay.js"></include> |
| 8 | 9 |
| 9 // Used for observing function of the backend datasource for this page by | 10 // Used for observing function of the backend datasource for this page by |
| 10 // tests. | 11 // tests. |
| 11 var webui_responded_ = false; | 12 var webui_responded_ = false; |
| 12 | 13 |
| 13 cr.define('extensions', function() { | 14 cr.define('extensions', function() { |
| 14 var ExtensionsList = options.ExtensionsList; | 15 var ExtensionsList = options.ExtensionsList; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 this.handleDevControlsTransitionEnd_.bind(this)); | 47 this.handleDevControlsTransitionEnd_.bind(this)); |
| 47 | 48 |
| 48 // Set up the three dev mode buttons (load unpacked, pack and update). | 49 // Set up the three dev mode buttons (load unpacked, pack and update). |
| 49 $('load-unpacked').addEventListener('click', | 50 $('load-unpacked').addEventListener('click', |
| 50 this.handleLoadUnpackedExtension_.bind(this)); | 51 this.handleLoadUnpackedExtension_.bind(this)); |
| 51 $('pack-extension').addEventListener('click', | 52 $('pack-extension').addEventListener('click', |
| 52 this.handlePackExtension_.bind(this)); | 53 this.handlePackExtension_.bind(this)); |
| 53 $('update-extensions-now').addEventListener('click', | 54 $('update-extensions-now').addEventListener('click', |
| 54 this.handleUpdateExtensionNow_.bind(this)); | 55 this.handleUpdateExtensionNow_.bind(this)); |
| 55 | 56 |
| 57 if (document.body.getAttribute('offstoreinstallenabled') == 'false') | |
| 58 this.dragWrapper_ = new cr.ui.DragWrapper(document.body, this); | |
| 59 | |
| 56 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance(); | 60 var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance(); |
| 57 packExtensionOverlay.initializePage(); | 61 packExtensionOverlay.initializePage(); |
| 58 }, | 62 }, |
| 59 | 63 |
| 64 shouldAcceptDrag: function() { | |
|
James Hawkins
2012/05/01 23:13:36
nit: Document these methods.
Evan Stade
2012/05/01 23:43:07
@inheritDoc is enough
Aaron Boodman
2012/05/02 00:41:36
To make this more clear, I've extracted the handle
| |
| 65 // It would be nice to only say yes in the case of files ending in '.crx', | |
| 66 // but the event always says there are no files at this point. | |
|
Evan Stade
2012/05/01 23:43:07
what types are available in dataTransfer? it shoul
Aaron Boodman
2012/05/02 00:41:36
Negative. The DataTransfer object is in 'protected
| |
| 67 return true; | |
| 68 }, | |
| 69 doDragEnter: function() { | |
| 70 chrome.send('startDrag'); | |
| 71 var dropTarget = $('install-drop-target'); | |
|
Evan Stade
2012/05/01 23:43:07
what I had intended was
body.drag-target #install
Aaron Boodman
2012/05/02 00:41:36
I did that for display. I need to delay the assign
| |
| 72 dropTarget.style.opacity = 0; | |
| 73 window.setTimeout(function() { | |
| 74 dropTarget.style.opacity = 1; | |
| 75 }, 0); | |
| 76 }, | |
| 77 doDragLeave: function() { | |
| 78 chrome.send('stopDrag'); | |
| 79 }, | |
| 80 doDragOver: function(e) { | |
| 81 if (e.target.id == 'install-drop-target') | |
| 82 e.target.classList.add('active'); | |
| 83 else | |
| 84 $('install-drop-target').classList.remove('active'); | |
| 85 }, | |
| 86 doDrop: function(e) { | |
| 87 if (e.srcElement.id == 'install-drop-target') | |
| 88 chrome.send('installDroppedFile'); | |
| 89 e.preventDefault(); | |
|
Evan Stade
2012/05/01 23:43:07
this breaks the case where you drag a URL to the p
Aaron Boodman
2012/05/02 00:41:36
Hm, I am not sure it makes sense for navigation to
| |
| 90 }, | |
| 91 | |
| 60 /** | 92 /** |
| 61 * Handles the Load Unpacked Extension button. | 93 * Handles the Load Unpacked Extension button. |
| 62 * @param {Event} e Change event. | 94 * @param {Event} e Change event. |
| 63 * @private | 95 * @private |
| 64 */ | 96 */ |
| 65 handleLoadUnpackedExtension_: function(e) { | 97 handleLoadUnpackedExtension_: function(e) { |
| 66 chrome.send('extensionSettingsLoadUnpackedExtension'); | 98 chrome.send('extensionSettingsLoadUnpackedExtension'); |
| 67 | 99 |
| 68 // TODO(jhawkins): Refactor metrics support out of options and use it | 100 // TODO(jhawkins): Refactor metrics support out of options and use it |
| 69 // in extensions.html. | 101 // in extensions.html. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 /** | 143 /** |
| 112 * Called when a transition has ended for #dev-controls. | 144 * Called when a transition has ended for #dev-controls. |
| 113 * @param {Event} e webkitTransitionEnd event. | 145 * @param {Event} e webkitTransitionEnd event. |
| 114 * @private | 146 * @private |
| 115 */ | 147 */ |
| 116 handleDevControlsTransitionEnd_: function(e) { | 148 handleDevControlsTransitionEnd_: function(e) { |
| 117 if (e.propertyName == 'height' && | 149 if (e.propertyName == 'height' && |
| 118 !$('extension-settings').classList.contains('dev-mode')) { | 150 !$('extension-settings').classList.contains('dev-mode')) { |
| 119 $('dev-controls').hidden = true; | 151 $('dev-controls').hidden = true; |
| 120 } | 152 } |
| 121 }, | 153 } |
| 122 }; | 154 }; |
| 123 | 155 |
| 124 /** | 156 /** |
| 125 * Called by the dom_ui_ to re-populate the page with data representing | 157 * Called by the dom_ui_ to re-populate the page with data representing |
| 126 * the current state of installed extensions. | 158 * the current state of installed extensions. |
| 127 */ | 159 */ |
| 128 ExtensionSettings.returnExtensionsData = function(extensionsData) { | 160 ExtensionSettings.returnExtensionsData = function(extensionsData) { |
| 129 // We can get called many times in short order, thus we need to | 161 // We can get called many times in short order, thus we need to |
| 130 // be careful to remove the 'finished loading' timeout. | 162 // be careful to remove the 'finished loading' timeout. |
| 131 if (this.loadingTimeout_) | 163 if (this.loadingTimeout_) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 return { | 274 return { |
| 243 ExtensionSettings: ExtensionSettings | 275 ExtensionSettings: ExtensionSettings |
| 244 }; | 276 }; |
| 245 }); | 277 }); |
| 246 | 278 |
| 247 var ExtensionSettings = extensions.ExtensionSettings; | 279 var ExtensionSettings = extensions.ExtensionSettings; |
| 248 | 280 |
| 249 window.addEventListener('load', function(e) { | 281 window.addEventListener('load', function(e) { |
| 250 ExtensionSettings.getInstance().initialize(); | 282 ExtensionSettings.getInstance().initialize(); |
| 251 }); | 283 }); |
| OLD | NEW |