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 "Clear browsing data" dialog | 6 * @fileoverview A helper object used from the "Clear browsing data" dialog |
| 7 * to interact with the browser. | 7 * to interact with the browser. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** | |
| 11 * An ImportantSite represents a domain with data that the user might want | |
| 12 * to protect from being deleted. ImportantSites are determined based on | |
| 13 * various engagement factors, such as whether a site is bookmarked or receives | |
| 14 * notifications. | |
| 15 * | |
| 16 * @typedef {{ | |
| 17 * registerableDomain: string, | |
| 18 * reasonBitfield: number, | |
| 19 * exampleOrigin: string, | |
| 20 * isChecked: boolean, | |
| 21 * storageSize: number, | |
| 22 * hasNotifications: boolean | |
| 23 * }} | |
| 24 */ | |
| 25 var ImportantSite; | |
| 26 | |
| 27 /** | |
| 28 * @typedef {{ | |
| 29 * importantSites: !Array<!ImportantSite>, | |
| 30 * }} | |
| 31 */ | |
| 32 var ImportantSitesResponse; | |
|
Dan Beam
2017/05/16 19:46:08
why can't we just return !Array<!ImportantSite> an
dullweber
2017/05/17 09:57:37
That works
| |
| 33 | |
| 10 cr.define('settings', function() { | 34 cr.define('settings', function() { |
| 11 /** @interface */ | 35 /** @interface */ |
| 12 function ClearBrowsingDataBrowserProxy() {} | 36 function ClearBrowsingDataBrowserProxy() {} |
| 13 | 37 |
| 14 ClearBrowsingDataBrowserProxy.prototype = { | 38 ClearBrowsingDataBrowserProxy.prototype = { |
| 15 /** | 39 /** |
| 16 * @return {!Promise} A promise resolved when data clearing has completed. | 40 * @param importantSites {!Array<!ImportantSite>} |
| 41 * @return {!Promise<void>} | |
| 42 * A promise resolved when data clearing has completed. | |
| 17 */ | 43 */ |
| 18 clearBrowsingData: function() {}, | 44 clearBrowsingData: function(importantSites) {}, |
| 45 | |
| 46 /** | |
| 47 * Fetches a list of important sites. | |
|
Dan Beam
2017/05/16 19:46:09
ident off
dullweber
2017/05/17 09:57:37
Done.
| |
| 48 * @return {!Promise<!ImportantSitesResponse>} | |
| 49 * A promise resolved when imporant sites are fetched. | |
| 50 */ | |
| 51 fetchImportantSites: function() {}, | |
|
Dan Beam
2017/05/16 19:46:09
we have many methods that ask the C++ for data, bu
dullweber
2017/05/17 09:57:37
sure
| |
| 19 | 52 |
| 20 /** | 53 /** |
| 21 * Kick off counter updates and return initial state. | 54 * Kick off counter updates and return initial state. |
| 22 * @return {!Promise<void>} Signal when the setup is complete. | 55 * @return {!Promise<void>} Signal when the setup is complete. |
| 23 */ | 56 */ |
| 24 initialize: function() {}, | 57 initialize: function() {}, |
| 25 }; | 58 }; |
| 26 | 59 |
| 27 /** | 60 /** |
| 28 * @constructor | 61 * @constructor |
| 29 * @implements {settings.ClearBrowsingDataBrowserProxy} | 62 * @implements {settings.ClearBrowsingDataBrowserProxy} |
| 30 */ | 63 */ |
| 31 function ClearBrowsingDataBrowserProxyImpl() {} | 64 function ClearBrowsingDataBrowserProxyImpl() {} |
| 32 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); | 65 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); |
| 33 | 66 |
| 34 ClearBrowsingDataBrowserProxyImpl.prototype = { | 67 ClearBrowsingDataBrowserProxyImpl.prototype = { |
| 35 /** @override */ | 68 /** @override */ |
| 36 clearBrowsingData: function() { | 69 clearBrowsingData: function(importantSites) { |
| 37 return cr.sendWithPromise('clearBrowsingData'); | 70 return cr.sendWithPromise('clearBrowsingData', importantSites); |
| 38 }, | 71 }, |
| 39 | 72 |
| 40 /** @override */ | 73 /** @override */ |
| 74 fetchImportantSites: function() { | |
| 75 return cr.sendWithPromise('fetchImportantSites'); | |
| 76 }, | |
| 77 | |
| 78 /** @override */ | |
| 41 initialize: function() { | 79 initialize: function() { |
| 42 return cr.sendWithPromise('initializeClearBrowsingData'); | 80 return cr.sendWithPromise('initializeClearBrowsingData'); |
| 43 }, | 81 }, |
| 44 }; | 82 }; |
| 45 | 83 |
| 46 return { | 84 return { |
| 47 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, | 85 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, |
| 48 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, | 86 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, |
| 49 }; | 87 }; |
| 50 }); | 88 }); |
| OLD | NEW |