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

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

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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.ItemDelegate} 10 * @implements {extensions.ItemDelegate}
(...skipping 10 matching lines...) Expand all
21 /** @param {extensions.Manager} manager */ 21 /** @param {extensions.Manager} manager */
22 managerReady: function(manager) { 22 managerReady: function(manager) {
23 /** @private {extensions.Manager} */ 23 /** @private {extensions.Manager} */
24 this.manager_ = manager; 24 this.manager_ = manager;
25 this.manager_.sidebar.setDelegate(this); 25 this.manager_.sidebar.setDelegate(this);
26 this.manager_.set('itemDelegate', this); 26 this.manager_.set('itemDelegate', this);
27 this.manager_.packDialog.set('delegate', this); 27 this.manager_.packDialog.set('delegate', this);
28 this.manager_.errorPage.delegate = this; 28 this.manager_.errorPage.delegate = this;
29 var keyboardShortcuts = this.manager_.keyboardShortcuts; 29 var keyboardShortcuts = this.manager_.keyboardShortcuts;
30 keyboardShortcuts.addEventListener( 30 keyboardShortcuts.addEventListener(
31 'shortcut-updated', 31 'shortcut-updated', this.onExtensionCommandUpdated_.bind(this));
32 this.onExtensionCommandUpdated_.bind(this));
33 keyboardShortcuts.addEventListener( 32 keyboardShortcuts.addEventListener(
34 'shortcut-capture-started', 33 'shortcut-capture-started',
35 this.onShortcutCaptureChanged_.bind(this, true)); 34 this.onShortcutCaptureChanged_.bind(this, true));
36 keyboardShortcuts.addEventListener( 35 keyboardShortcuts.addEventListener(
37 'shortcut-capture-ended', 36 'shortcut-capture-ended',
38 this.onShortcutCaptureChanged_.bind(this, false)); 37 this.onShortcutCaptureChanged_.bind(this, false));
39 chrome.developerPrivate.onProfileStateChanged.addListener( 38 chrome.developerPrivate.onProfileStateChanged.addListener(
40 this.onProfileStateChanged_.bind(this)); 39 this.onProfileStateChanged_.bind(this));
41 chrome.developerPrivate.onItemStateChanged.addListener( 40 chrome.developerPrivate.onItemStateChanged.addListener(
42 this.onItemStateChanged_.bind(this)); 41 this.onItemStateChanged_.bind(this));
43 chrome.developerPrivate.getExtensionsInfo( 42 chrome.developerPrivate.getExtensionsInfo(
44 {includeDisabled: true, includeTerminated: true}, 43 {includeDisabled: true, includeTerminated: true},
45 function(extensions) { 44 function(extensions) {
46 /** @private {Array<chrome.developerPrivate.ExtensionInfo>} */ 45 /** @private {Array<chrome.developerPrivate.ExtensionInfo>} */
47 this.extensions_ = extensions; 46 this.extensions_ = extensions;
48 for (let extension of extensions) 47 for (let extension of extensions)
49 this.manager_.addItem(extension); 48 this.manager_.addItem(extension);
50 49
51 var id = new URLSearchParams(location.search).get('id'); 50 var id = new URLSearchParams(location.search).get('id');
52 if (id) { 51 if (id) {
53 var data = this.extensions_.find(function(e) { 52 var data = this.extensions_.find(function(e) {
54 return e.id == id; 53 return e.id == id;
55 }); 54 });
56 if (data) 55 if (data)
57 this.manager_.showItemDetails(data); 56 this.manager_.showItemDetails(data);
58 } 57 }
59 }.bind(this)); 58 }.bind(this));
60 chrome.developerPrivate.getProfileConfiguration( 59 chrome.developerPrivate.getProfileConfiguration(
61 this.onProfileStateChanged_.bind(this)); 60 this.onProfileStateChanged_.bind(this));
62 }, 61 },
63 62
64 /** 63 /**
65 * @param {chrome.developerPrivate.ProfileInfo} profileInfo 64 * @param {chrome.developerPrivate.ProfileInfo} profileInfo
66 * @private 65 * @private
67 */ 66 */
68 onProfileStateChanged_: function(profileInfo) { 67 onProfileStateChanged_: function(profileInfo) {
69 this.manager_.set('inDevMode', profileInfo.inDeveloperMode); 68 this.manager_.set('inDevMode', profileInfo.inDeveloperMode);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 * Opens a file browser dialog for the user to select a file (or directory). 114 * Opens a file browser dialog for the user to select a file (or directory).
116 * @param {chrome.developerPrivate.SelectType} selectType 115 * @param {chrome.developerPrivate.SelectType} selectType
117 * @param {chrome.developerPrivate.FileType} fileType 116 * @param {chrome.developerPrivate.FileType} fileType
118 * @return {Promise<string>} The promise to be resolved with the selected 117 * @return {Promise<string>} The promise to be resolved with the selected
119 * path. 118 * path.
120 */ 119 */
121 chooseFilePath_: function(selectType, fileType) { 120 chooseFilePath_: function(selectType, fileType) {
122 return new Promise(function(resolve, reject) { 121 return new Promise(function(resolve, reject) {
123 chrome.developerPrivate.choosePath( 122 chrome.developerPrivate.choosePath(
124 selectType, fileType, function(path) { 123 selectType, fileType, function(path) {
125 if (chrome.runtime.lastError && 124 if (chrome.runtime.lastError &&
126 chrome.runtime.lastError != 'File selection was canceled.') { 125 chrome.runtime.lastError != 'File selection was canceled.') {
127 reject(chrome.runtime.lastError); 126 reject(chrome.runtime.lastError);
128 } else { 127 } else {
129 resolve(path || ''); 128 resolve(path || '');
130 } 129 }
131 }); 130 });
132 }); 131 });
133 }, 132 },
134 133
135 /** 134 /**
136 * Updates an extension command. 135 * Updates an extension command.
137 * @param {!CustomEvent} e 136 * @param {!CustomEvent} e
138 * @private 137 * @private
139 */ 138 */
140 onExtensionCommandUpdated_: function(e) { 139 onExtensionCommandUpdated_: function(e) {
141 chrome.developerPrivate.updateExtensionCommand({ 140 chrome.developerPrivate.updateExtensionCommand({
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 resolve(code); 288 resolve(code);
290 }); 289 });
291 }); 290 });
292 }, 291 },
293 }; 292 };
294 293
295 cr.addSingletonGetter(Service); 294 cr.addSingletonGetter(Service);
296 295
297 return {Service: Service}; 296 return {Service: Service};
298 }); 297 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_extensions/pack_dialog.js ('k') | chrome/browser/resources/md_extensions/shortcut_input.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698