Chromium Code Reviews| 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 cr.define('settings', function() { | 9 cr.define('settings', function() { |
| 10 /** @interface */ | 10 /** @interface */ |
| 11 function ManageProfileBrowserProxy() {} | 11 function ManageProfileBrowserProxy() {} |
| 12 | 12 |
| 13 ManageProfileBrowserProxy.prototype = { | 13 ManageProfileBrowserProxy.prototype = { |
| 14 /** | 14 /** |
| 15 * Gets the available profile icons to choose from. | 15 * Gets the available profile icons to choose from. |
| 16 * @return {!Promise<!Array<string>>} | 16 * @return {!Promise<!Array<string>>} |
| 17 */ | 17 */ |
| 18 getAvailableIcons: function() {}, | 18 getAvailableIcons: function() {}, |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Sets the profile's icon and name. There is no response. | 21 * Sets the profile's icon and name. There is no response. |
| 22 * @param {!string} iconUrl The new profile URL. | 22 * @param {!string} iconUrl The new profile URL. |
| 23 * @param {!string} name The new profile name. | 23 * @param {!string} name The new profile name. |
| 24 */ | 24 */ |
| 25 setProfileIconAndName: function(iconUrl, name) {}, | 25 setProfileIconAndName: function(iconUrl, name) {}, |
| 26 | |
| 27 /** | |
| 28 * Returns whether the current profile has a shortcut. | |
| 29 * @return {!Promise<boolean>} | |
| 30 */ | |
| 31 hasProfileShortcut: function() {}, | |
|
tommycli
2016/11/15 01:59:50
Since this is an async getter, maybe change this t
Moe
2016/11/15 16:03:10
Done.
| |
| 32 | |
| 33 /** | |
| 34 * Adds a shortcut for the current profile. | |
| 35 */ | |
| 36 addProfileShortcut: function() {}, | |
| 37 | |
| 38 /** | |
| 39 * Removes the shortcut of the current profile. | |
| 40 */ | |
| 41 removeProfileShortcut: function() {}, | |
| 26 }; | 42 }; |
| 27 | 43 |
| 28 /** | 44 /** |
| 29 * @constructor | 45 * @constructor |
| 30 * @implements {settings.ManageProfileBrowserProxy} | 46 * @implements {settings.ManageProfileBrowserProxy} |
| 31 */ | 47 */ |
| 32 function ManageProfileBrowserProxyImpl() {} | 48 function ManageProfileBrowserProxyImpl() {} |
| 33 // The singleton instance_ is replaced with a test version of this wrapper | 49 // The singleton instance_ is replaced with a test version of this wrapper |
| 34 // during testing. | 50 // during testing. |
| 35 cr.addSingletonGetter(ManageProfileBrowserProxyImpl); | 51 cr.addSingletonGetter(ManageProfileBrowserProxyImpl); |
| 36 | 52 |
| 37 ManageProfileBrowserProxyImpl.prototype = { | 53 ManageProfileBrowserProxyImpl.prototype = { |
| 38 /** @override */ | 54 /** @override */ |
| 39 getAvailableIcons: function() { | 55 getAvailableIcons: function() { |
| 40 return cr.sendWithPromise('getAvailableIcons'); | 56 return cr.sendWithPromise('getAvailableIcons'); |
| 41 }, | 57 }, |
| 42 | 58 |
| 43 /** @override */ | 59 /** @override */ |
| 44 setProfileIconAndName: function(iconUrl, name) { | 60 setProfileIconAndName: function(iconUrl, name) { |
| 45 chrome.send('setProfileIconAndName', [iconUrl, name]); | 61 chrome.send('setProfileIconAndName', [iconUrl, name]); |
| 46 }, | 62 }, |
| 63 | |
| 64 /** @override */ | |
| 65 hasProfileShortcut: function() { | |
| 66 return cr.sendWithPromise('requestHasProfileShortcuts'); | |
| 67 }, | |
| 68 | |
| 69 /** @override */ | |
| 70 addProfileShortcut: function() { | |
| 71 chrome.send('addProfileShortcut'); | |
| 72 }, | |
| 73 | |
| 74 /** @override */ | |
| 75 removeProfileShortcut: function() { | |
| 76 chrome.send('removeProfileShortcut'); | |
| 77 }, | |
| 47 }; | 78 }; |
| 48 | 79 |
| 49 return { | 80 return { |
| 50 ManageProfileBrowserProxy: ManageProfileBrowserProxy, | 81 ManageProfileBrowserProxy: ManageProfileBrowserProxy, |
| 51 ManageProfileBrowserProxyImpl: ManageProfileBrowserProxyImpl, | 82 ManageProfileBrowserProxyImpl: ManageProfileBrowserProxyImpl, |
| 52 }; | 83 }; |
| 53 }); | 84 }); |
| OLD | NEW |