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 |
10 cr.define('settings', function() { | 27 cr.define('settings', function() { |
11 /** @interface */ | 28 /** @interface */ |
12 function ClearBrowsingDataBrowserProxy() {} | 29 function ClearBrowsingDataBrowserProxy() {} |
13 | 30 |
14 ClearBrowsingDataBrowserProxy.prototype = { | 31 ClearBrowsingDataBrowserProxy.prototype = { |
15 /** | 32 /** |
16 * @return {!Promise} A promise resolved when data clearing has completed. | 33 * @param {!Array<!ImportantSite>} importantSites |
| 34 * @return {!Promise<void>} |
| 35 * A promise resolved when data clearing has completed. |
17 */ | 36 */ |
18 clearBrowsingData: function() {}, | 37 clearBrowsingData: function(importantSites) {}, |
| 38 |
| 39 /** |
| 40 * @return {!Promise<!Array<!ImportantSite>>} |
| 41 * A promise resolved when imporant sites are retrieved. |
| 42 */ |
| 43 getImportantSites: function() {}, |
19 | 44 |
20 /** | 45 /** |
21 * Kick off counter updates and return initial state. | 46 * Kick off counter updates and return initial state. |
22 * @return {!Promise<void>} Signal when the setup is complete. | 47 * @return {!Promise<void>} Signal when the setup is complete. |
23 */ | 48 */ |
24 initialize: function() {}, | 49 initialize: function() {}, |
25 }; | 50 }; |
26 | 51 |
27 /** | 52 /** |
28 * @constructor | 53 * @constructor |
29 * @implements {settings.ClearBrowsingDataBrowserProxy} | 54 * @implements {settings.ClearBrowsingDataBrowserProxy} |
30 */ | 55 */ |
31 function ClearBrowsingDataBrowserProxyImpl() {} | 56 function ClearBrowsingDataBrowserProxyImpl() {} |
32 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); | 57 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); |
33 | 58 |
34 ClearBrowsingDataBrowserProxyImpl.prototype = { | 59 ClearBrowsingDataBrowserProxyImpl.prototype = { |
35 /** @override */ | 60 /** @override */ |
36 clearBrowsingData: function() { | 61 clearBrowsingData: function(importantSites) { |
37 return cr.sendWithPromise('clearBrowsingData'); | 62 return cr.sendWithPromise('clearBrowsingData', importantSites); |
38 }, | 63 }, |
39 | 64 |
40 /** @override */ | 65 /** @override */ |
| 66 getImportantSites: function() { |
| 67 return cr.sendWithPromise('getImportantSites'); |
| 68 }, |
| 69 |
| 70 /** @override */ |
41 initialize: function() { | 71 initialize: function() { |
42 return cr.sendWithPromise('initializeClearBrowsingData'); | 72 return cr.sendWithPromise('initializeClearBrowsingData'); |
43 }, | 73 }, |
44 }; | 74 }; |
45 | 75 |
46 return { | 76 return { |
47 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, | 77 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, |
48 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, | 78 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, |
49 }; | 79 }; |
50 }); | 80 }); |
OLD | NEW |