| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @fileoverview A helper object used from the "Manage Profile" subpage of | 6 * @fileoverview A helper object used from the "Manage Profile" subpage of |
| 7 * the People section to interact with the browser. Chrome Browser only. | 7 * the People section to interact with the browser. Chrome Browser only. |
| 8 */ | 8 */ |
| 9 |
| 10 /** |
| 11 * Contains the possible profile shortcut statuses. These strings must be kept |
| 12 * in sync with the C++ Manage Profile handler. |
| 13 * @enum {string} |
| 14 */ |
| 15 var ProfileShortcutStatus = { |
| 16 PROFILE_SHORTCUT_SETTING_HIDDEN: 'profileShortcutSettingHidden', |
| 17 PROFILE_SHORTCUT_NOT_FOUND: 'profileShortcutNotFound', |
| 18 PROFILE_SHORTCUT_FOUND: 'profileShortcutFound', |
| 19 }; |
| 20 |
| 9 cr.define('settings', function() { | 21 cr.define('settings', function() { |
| 10 /** @interface */ | 22 /** @interface */ |
| 11 function ManageProfileBrowserProxy() {} | 23 function ManageProfileBrowserProxy() {} |
| 12 | 24 |
| 13 ManageProfileBrowserProxy.prototype = { | 25 ManageProfileBrowserProxy.prototype = { |
| 14 /** | 26 /** |
| 15 * Gets the available profile icons to choose from. | 27 * Gets the available profile icons to choose from. |
| 16 * @return {!Promise<!Array<string>>} | 28 * @return {!Promise<!Array<string>>} |
| 17 */ | 29 */ |
| 18 getAvailableIcons: function() {}, | 30 getAvailableIcons: function() {}, |
| 19 | 31 |
| 20 /** | 32 /** |
| 21 * Sets the profile's icon and name. There is no response. | 33 * Sets the profile's icon and name. There is no response. |
| 22 * @param {!string} iconUrl The new profile URL. | 34 * @param {!string} iconUrl The new profile URL. |
| 23 * @param {!string} name The new profile name. | 35 * @param {!string} name The new profile name. |
| 24 */ | 36 */ |
| 25 setProfileIconAndName: function(iconUrl, name) {}, | 37 setProfileIconAndName: function(iconUrl, name) {}, |
| 26 | 38 |
| 27 /** | 39 /** |
| 28 * Returns whether the current profile has a shortcut. | 40 * Returns whether the current profile has a shortcut. |
| 29 * @return {!Promise<boolean>} | 41 * @return {!Promise<ProfileShortcutStatus>} |
| 30 */ | 42 */ |
| 31 getHasProfileShortcut: function() {}, | 43 getProfileShortcutStatus: function() {}, |
| 32 | 44 |
| 33 /** | 45 /** |
| 34 * Adds a shortcut for the current profile. | 46 * Adds a shortcut for the current profile. |
| 35 */ | 47 */ |
| 36 addProfileShortcut: function() {}, | 48 addProfileShortcut: function() {}, |
| 37 | 49 |
| 38 /** | 50 /** |
| 39 * Removes the shortcut of the current profile. | 51 * Removes the shortcut of the current profile. |
| 40 */ | 52 */ |
| 41 removeProfileShortcut: function() {}, | 53 removeProfileShortcut: function() {}, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 55 getAvailableIcons: function() { | 67 getAvailableIcons: function() { |
| 56 return cr.sendWithPromise('getAvailableIcons'); | 68 return cr.sendWithPromise('getAvailableIcons'); |
| 57 }, | 69 }, |
| 58 | 70 |
| 59 /** @override */ | 71 /** @override */ |
| 60 setProfileIconAndName: function(iconUrl, name) { | 72 setProfileIconAndName: function(iconUrl, name) { |
| 61 chrome.send('setProfileIconAndName', [iconUrl, name]); | 73 chrome.send('setProfileIconAndName', [iconUrl, name]); |
| 62 }, | 74 }, |
| 63 | 75 |
| 64 /** @override */ | 76 /** @override */ |
| 65 getHasProfileShortcut: function() { | 77 getProfileShortcutStatus: function() { |
| 66 return cr.sendWithPromise('requestHasProfileShortcuts'); | 78 return cr.sendWithPromise('requestProfileShortcutStatus'); |
| 67 }, | 79 }, |
| 68 | 80 |
| 69 /** @override */ | 81 /** @override */ |
| 70 addProfileShortcut: function() { | 82 addProfileShortcut: function() { |
| 71 chrome.send('addProfileShortcut'); | 83 chrome.send('addProfileShortcut'); |
| 72 }, | 84 }, |
| 73 | 85 |
| 74 /** @override */ | 86 /** @override */ |
| 75 removeProfileShortcut: function() { | 87 removeProfileShortcut: function() { |
| 76 chrome.send('removeProfileShortcut'); | 88 chrome.send('removeProfileShortcut'); |
| 77 }, | 89 }, |
| 78 }; | 90 }; |
| 79 | 91 |
| 80 return { | 92 return { |
| 81 ManageProfileBrowserProxy: ManageProfileBrowserProxy, | 93 ManageProfileBrowserProxy: ManageProfileBrowserProxy, |
| 82 ManageProfileBrowserProxyImpl: ManageProfileBrowserProxyImpl, | 94 ManageProfileBrowserProxyImpl: ManageProfileBrowserProxyImpl, |
| 83 }; | 95 }; |
| 84 }); | 96 }); |
| OLD | NEW |