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="../uber/uber_utils.js"></include> | 5 <include src="../uber/uber_utils.js"></include> |
6 <include src="extension_commands_overlay.js"></include> | 6 <include src="extension_commands_overlay.js"></include> |
7 <include src="extension_focus_manager.js"></include> | 7 <include src="extension_focus_manager.js"></include> |
8 <include src="extension_list.js"></include> | 8 <include src="extension_list.js"></include> |
9 <include src="pack_extension_overlay.js"></include> | 9 <include src="pack_extension_overlay.js"></include> |
10 <include src="extension_error_overlay.js"></include> | 10 <include src="extension_error_overlay.js"></include> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 * @class | 79 * @class |
80 */ | 80 */ |
81 function ExtensionSettings() {} | 81 function ExtensionSettings() {} |
82 | 82 |
83 cr.addSingletonGetter(ExtensionSettings); | 83 cr.addSingletonGetter(ExtensionSettings); |
84 | 84 |
85 ExtensionSettings.prototype = { | 85 ExtensionSettings.prototype = { |
86 __proto__: HTMLDivElement.prototype, | 86 __proto__: HTMLDivElement.prototype, |
87 | 87 |
88 /** | 88 /** |
| 89 * Whether the App Developer Tools promo has been dismissed on this page. |
| 90 * @type {boolean} |
| 91 * @private |
| 92 */ |
| 93 promoDismissed_: false, |
| 94 |
| 95 /** |
89 * Perform initial setup. | 96 * Perform initial setup. |
90 */ | 97 */ |
91 initialize: function() { | 98 initialize: function() { |
92 uber.onContentFrameLoaded(); | 99 uber.onContentFrameLoaded(); |
93 cr.ui.FocusOutlineManager.forDocument(document); | 100 cr.ui.FocusOutlineManager.forDocument(document); |
94 measureCheckboxStrings(); | 101 measureCheckboxStrings(); |
95 | 102 |
96 // Set the title. | 103 // Set the title. |
97 var title = loadTimeData.getString('extensionSettings'); | 104 var title = loadTimeData.getString('extensionSettings'); |
98 uber.invokeMethodOnParent('setTitle', {title: title}); | 105 uber.invokeMethodOnParent('setTitle', {title: title}); |
99 | 106 |
100 // This will request the data to show on the page and will get a response | 107 // This will request the data to show on the page and will get a response |
101 // back in returnExtensionsData. | 108 // back in returnExtensionsData. |
102 chrome.send('extensionSettingsRequestExtensionsData'); | 109 chrome.send('extensionSettingsRequestExtensionsData'); |
103 | 110 |
104 $('toggle-dev-on').addEventListener('change', | 111 $('toggle-dev-on').addEventListener('change', |
105 this.handleToggleDevMode_.bind(this)); | 112 this.handleToggleDevMode_.bind(this)); |
106 $('dev-controls').addEventListener('webkitTransitionEnd', | 113 $('dev-controls').addEventListener('webkitTransitionEnd', |
107 this.handleDevControlsTransitionEnd_.bind(this)); | 114 this.handleDevControlsTransitionEnd_.bind(this)); |
108 | 115 |
109 // Set up the three dev mode buttons (load unpacked, pack and update). | 116 // Set up the three dev mode buttons (load unpacked, pack and update). |
110 $('load-unpacked').addEventListener('click', | 117 $('load-unpacked').addEventListener('click', |
111 this.handleLoadUnpackedExtension_.bind(this)); | 118 this.handleLoadUnpackedExtension_.bind(this)); |
112 $('pack-extension').addEventListener('click', | 119 $('pack-extension').addEventListener('click', |
113 this.handlePackExtension_.bind(this)); | 120 this.handlePackExtension_.bind(this)); |
114 $('update-extensions-now').addEventListener('click', | 121 $('update-extensions-now').addEventListener('click', |
115 this.handleUpdateExtensionNow_.bind(this)); | 122 this.handleUpdateExtensionNow_.bind(this)); |
116 | 123 |
| 124 // Set up the close dialog for the apps developer tools promo. |
| 125 $('apps-developer-tools-promo').querySelector('.close-button'). |
| 126 addEventListener('click', function(e) { |
| 127 this.promoDismissed_ = true; |
| 128 $('extension-settings').classList.remove('adt-promo'); |
| 129 }.bind(this)); |
| 130 |
117 if (!loadTimeData.getBoolean('offStoreInstallEnabled')) { | 131 if (!loadTimeData.getBoolean('offStoreInstallEnabled')) { |
118 this.dragWrapper_ = new cr.ui.DragWrapper(document.documentElement, | 132 this.dragWrapper_ = new cr.ui.DragWrapper(document.documentElement, |
119 dragWrapperHandler); | 133 dragWrapperHandler); |
120 } | 134 } |
121 | 135 |
122 extensions.PackExtensionOverlay.getInstance().initializePage(); | 136 extensions.PackExtensionOverlay.getInstance().initializePage(); |
123 | 137 |
124 // Hook up the configure commands link to the overlay. | 138 // Hook up the configure commands link to the overlay. |
125 var link = document.querySelector('.extension-commands-config'); | 139 var link = document.querySelector('.extension-commands-config'); |
126 link.addEventListener('click', | 140 link.addEventListener('click', |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 304 |
291 if (extensionsData.developerMode) { | 305 if (extensionsData.developerMode) { |
292 pageDiv.classList.add('dev-mode'); | 306 pageDiv.classList.add('dev-mode'); |
293 $('toggle-dev-on').checked = true; | 307 $('toggle-dev-on').checked = true; |
294 $('dev-controls').hidden = false; | 308 $('dev-controls').hidden = false; |
295 } else { | 309 } else { |
296 pageDiv.classList.remove('dev-mode'); | 310 pageDiv.classList.remove('dev-mode'); |
297 $('toggle-dev-on').checked = false; | 311 $('toggle-dev-on').checked = false; |
298 } | 312 } |
299 | 313 |
| 314 var showPromo = extensionsData.promoteAppsDevTools && !this.promoDismissed_; |
| 315 pageDiv.classList.toggle('adt-promo', showPromo); |
| 316 |
300 $('load-unpacked').disabled = extensionsData.loadUnpackedDisabled; | 317 $('load-unpacked').disabled = extensionsData.loadUnpackedDisabled; |
301 | 318 |
302 ExtensionsList.prototype.data_ = extensionsData; | 319 ExtensionsList.prototype.data_ = extensionsData; |
303 var extensionList = $('extension-settings-list'); | 320 var extensionList = $('extension-settings-list'); |
304 ExtensionsList.decorate(extensionList); | 321 ExtensionsList.decorate(extensionList); |
305 } | 322 } |
306 | 323 |
307 // Indicate that warning |message| has occured for pack of |crx_path| and | 324 // Indicate that warning |message| has occured for pack of |crx_path| and |
308 // |pem_path| files. Ask if user wants override the warning. Send | 325 // |pem_path| files. Ask if user wants override the warning. Send |
309 // |overrideFlags| to repeated 'pack' call to accomplish the override. | 326 // |overrideFlags| to repeated 'pack' call to accomplish the override. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 416 |
400 // Export | 417 // Export |
401 return { | 418 return { |
402 ExtensionSettings: ExtensionSettings | 419 ExtensionSettings: ExtensionSettings |
403 }; | 420 }; |
404 }); | 421 }); |
405 | 422 |
406 window.addEventListener('load', function(e) { | 423 window.addEventListener('load', function(e) { |
407 extensions.ExtensionSettings.getInstance().initialize(); | 424 extensions.ExtensionSettings.getInstance().initialize(); |
408 }); | 425 }); |
OLD | NEW |