Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: chrome/browser/resources/md_extensions/service.js

Issue 2948443003: Run clang-format on .js files in c/b/r/md_extensions (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 cr.define('extensions', function() { 5 cr.define('extensions', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * @constructor 9 * @constructor
10 * @implements {extensions.ErrorPageDelegate} 10 * @implements {extensions.ErrorPageDelegate}
(...skipping 12 matching lines...) Expand all
23 managerReady: function(manager) { 23 managerReady: function(manager) {
24 /** @private {extensions.Manager} */ 24 /** @private {extensions.Manager} */
25 this.manager_ = manager; 25 this.manager_ = manager;
26 this.manager_.toolbar.setDelegate(this); 26 this.manager_.toolbar.setDelegate(this);
27 this.manager_.set('itemDelegate', this); 27 this.manager_.set('itemDelegate', this);
28 this.manager_.packDialog.set('delegate', this); 28 this.manager_.packDialog.set('delegate', this);
29 this.manager_.loadError.set('delegate', this); 29 this.manager_.loadError.set('delegate', this);
30 this.manager_.errorPage.delegate = this; 30 this.manager_.errorPage.delegate = this;
31 var keyboardShortcuts = this.manager_.keyboardShortcuts; 31 var keyboardShortcuts = this.manager_.keyboardShortcuts;
32 keyboardShortcuts.addEventListener( 32 keyboardShortcuts.addEventListener(
33 'shortcut-updated', 33 'shortcut-updated', this.onExtensionCommandUpdated_.bind(this));
34 this.onExtensionCommandUpdated_.bind(this));
35 keyboardShortcuts.addEventListener( 34 keyboardShortcuts.addEventListener(
36 'shortcut-capture-started', 35 'shortcut-capture-started',
37 this.onShortcutCaptureChanged_.bind(this, true)); 36 this.onShortcutCaptureChanged_.bind(this, true));
38 keyboardShortcuts.addEventListener( 37 keyboardShortcuts.addEventListener(
39 'shortcut-capture-ended', 38 'shortcut-capture-ended',
40 this.onShortcutCaptureChanged_.bind(this, false)); 39 this.onShortcutCaptureChanged_.bind(this, false));
41 chrome.developerPrivate.onProfileStateChanged.addListener( 40 chrome.developerPrivate.onProfileStateChanged.addListener(
42 this.onProfileStateChanged_.bind(this)); 41 this.onProfileStateChanged_.bind(this));
43 chrome.developerPrivate.onItemStateChanged.addListener( 42 chrome.developerPrivate.onItemStateChanged.addListener(
44 this.onItemStateChanged_.bind(this)); 43 this.onItemStateChanged_.bind(this));
45 chrome.developerPrivate.getExtensionsInfo( 44 chrome.developerPrivate.getExtensionsInfo(
46 {includeDisabled: true, includeTerminated: true}, 45 {includeDisabled: true, includeTerminated: true},
47 function(extensions) { 46 function(extensions) {
48 /** @private {Array<chrome.developerPrivate.ExtensionInfo>} */ 47 /** @private {Array<chrome.developerPrivate.ExtensionInfo>} */
49 this.extensions_ = extensions; 48 this.extensions_ = extensions;
50 for (let extension of extensions) 49 for (let extension of extensions)
51 this.manager_.addItem(extension); 50 this.manager_.addItem(extension);
52 51
53 this.manager_.initPage(); 52 this.manager_.initPage();
54 }.bind(this)); 53 }.bind(this));
55 chrome.developerPrivate.getProfileConfiguration( 54 chrome.developerPrivate.getProfileConfiguration(
56 this.onProfileStateChanged_.bind(this)); 55 this.onProfileStateChanged_.bind(this));
57 }, 56 },
58 57
59 /** 58 /**
60 * @param {chrome.developerPrivate.ProfileInfo} profileInfo 59 * @param {chrome.developerPrivate.ProfileInfo} profileInfo
61 * @private 60 * @private
62 */ 61 */
63 onProfileStateChanged_: function(profileInfo) { 62 onProfileStateChanged_: function(profileInfo) {
64 this.manager_.set('inDevMode', profileInfo.inDeveloperMode); 63 this.manager_.set('inDevMode', profileInfo.inDeveloperMode);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 * Opens a file browser dialog for the user to select a file (or directory). 109 * Opens a file browser dialog for the user to select a file (or directory).
111 * @param {chrome.developerPrivate.SelectType} selectType 110 * @param {chrome.developerPrivate.SelectType} selectType
112 * @param {chrome.developerPrivate.FileType} fileType 111 * @param {chrome.developerPrivate.FileType} fileType
113 * @return {Promise<string>} The promise to be resolved with the selected 112 * @return {Promise<string>} The promise to be resolved with the selected
114 * path. 113 * path.
115 */ 114 */
116 chooseFilePath_: function(selectType, fileType) { 115 chooseFilePath_: function(selectType, fileType) {
117 return new Promise(function(resolve, reject) { 116 return new Promise(function(resolve, reject) {
118 chrome.developerPrivate.choosePath( 117 chrome.developerPrivate.choosePath(
119 selectType, fileType, function(path) { 118 selectType, fileType, function(path) {
120 if (chrome.runtime.lastError && 119 if (chrome.runtime.lastError &&
121 chrome.runtime.lastError != 'File selection was canceled.') { 120 chrome.runtime.lastError != 'File selection was canceled.') {
122 reject(chrome.runtime.lastError); 121 reject(chrome.runtime.lastError);
123 } else { 122 } else {
124 resolve(path || ''); 123 resolve(path || '');
125 } 124 }
126 }); 125 });
127 }); 126 });
128 }, 127 },
129 128
130 /** 129 /**
131 * Updates an extension command. 130 * Updates an extension command.
132 * @param {!CustomEvent} e 131 * @param {!CustomEvent} e
133 * @private 132 * @private
134 */ 133 */
135 onExtensionCommandUpdated_: function(e) { 134 onExtensionCommandUpdated_: function(e) {
136 chrome.developerPrivate.updateExtensionCommand({ 135 chrome.developerPrivate.updateExtensionCommand({
(...skipping 21 matching lines...) Expand all
158 /** 157 /**
159 * Attempts to load an unpacked extension, optionally as another attempt at 158 * Attempts to load an unpacked extension, optionally as another attempt at
160 * a previously-specified load. 159 * a previously-specified load.
161 * @param {string=} opt_retryGuid 160 * @param {string=} opt_retryGuid
162 * @private 161 * @private
163 */ 162 */
164 loadUnpackedHelper_: function(opt_retryGuid) { 163 loadUnpackedHelper_: function(opt_retryGuid) {
165 chrome.developerPrivate.loadUnpacked( 164 chrome.developerPrivate.loadUnpacked(
166 {failQuietly: true, populateError: true, retryGuid: opt_retryGuid}, 165 {failQuietly: true, populateError: true, retryGuid: opt_retryGuid},
167 (loadError) => { 166 (loadError) => {
168 if (chrome.runtime.lastError && 167 if (chrome.runtime.lastError &&
169 chrome.runtime.lastError.message != 168 chrome.runtime.lastError.message !=
170 'File selection was canceled.') { 169 'File selection was canceled.') {
171 throw new Error(chrome.runtime.lastError.message); 170 throw new Error(chrome.runtime.lastError.message);
172 } 171 }
173 if (loadError) { 172 if (loadError) {
174 this.manager_.loadError.loadError = loadError; 173 this.manager_.loadError.loadError = loadError;
175 this.manager_.loadError.show(); 174 this.manager_.loadError.show();
176 } 175 }
177 }); 176 });
178 }, 177 },
179 178
180 /** @override */ 179 /** @override */
181 deleteItem: function(id) { 180 deleteItem: function(id) {
182 if (this.isDeleting_) 181 if (this.isDeleting_)
183 return; 182 return;
184 this.isDeleting_ = true; 183 this.isDeleting_ = true;
185 chrome.management.uninstall(id, {showConfirmDialog: true}, function() { 184 chrome.management.uninstall(id, {showConfirmDialog: true}, function() {
186 // The "last error" was almost certainly the user canceling the dialog. 185 // The "last error" was almost certainly the user canceling the dialog.
187 // Do nothing. We only check it so we don't get noisy logs. 186 // Do nothing. We only check it so we don't get noisy logs.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 resolve(code); 317 resolve(code);
319 }); 318 });
320 }); 319 });
321 }, 320 },
322 }; 321 };
323 322
324 cr.addSingletonGetter(Service); 323 cr.addSingletonGetter(Service);
325 324
326 return {Service: Service}; 325 return {Service: Service};
327 }); 326 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698