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 /** | 10 /** |
11 * An ImportantSite represents a domain with data that the user might want | 11 * An ImportantSite represents a domain with data that the user might want |
12 * to protect from being deleted. ImportantSites are determined based on | 12 * to protect from being deleted. ImportantSites are determined based on |
13 * various engagement factors, such as whether a site is bookmarked or receives | 13 * various engagement factors, such as whether a site is bookmarked or receives |
14 * notifications. | 14 * notifications. |
15 * | 15 * |
16 * @typedef {{ | 16 * @typedef {{ |
17 * registerableDomain: string, | 17 * registerableDomain: string, |
18 * reasonBitfield: number, | 18 * reasonBitfield: number, |
19 * exampleOrigin: string, | 19 * exampleOrigin: string, |
20 * isChecked: boolean, | 20 * isChecked: boolean, |
21 * storageSize: number, | 21 * storageSize: number, |
22 * hasNotifications: boolean | 22 * hasNotifications: boolean |
23 * }} | 23 * }} |
24 */ | 24 */ |
25 var ImportantSite; | 25 var ImportantSite; |
26 | 26 |
27 cr.define('settings', function() { | 27 cr.define('settings', function() { |
28 /** @interface */ | 28 /** @interface */ |
29 function ClearBrowsingDataBrowserProxy() {} | 29 class ClearBrowsingDataBrowserProxy { |
30 | |
31 ClearBrowsingDataBrowserProxy.prototype = { | |
32 /** | 30 /** |
33 * @param {!Array<!ImportantSite>} importantSites | 31 * @param {!Array<!ImportantSite>} importantSites |
34 * @return {!Promise<void>} | 32 * @return {!Promise<void>} |
35 * A promise resolved when data clearing has completed. | 33 * A promise resolved when data clearing has completed. |
36 */ | 34 */ |
37 clearBrowsingData: function(importantSites) {}, | 35 clearBrowsingData(importantSites) {} |
38 | 36 |
39 /** | 37 /** |
40 * @return {!Promise<!Array<!ImportantSite>>} | 38 * @return {!Promise<!Array<!ImportantSite>>} |
41 * A promise resolved when imporant sites are retrieved. | 39 * A promise resolved when imporant sites are retrieved. |
42 */ | 40 */ |
43 getImportantSites: function() {}, | 41 getImportantSites() {} |
44 | 42 |
45 /** | 43 /** |
46 * Kick off counter updates and return initial state. | 44 * Kick off counter updates and return initial state. |
47 * @return {!Promise<void>} Signal when the setup is complete. | 45 * @return {!Promise<void>} Signal when the setup is complete. |
48 */ | 46 */ |
49 initialize: function() {}, | 47 initialize() {} |
50 }; | 48 } |
51 | 49 |
52 /** | 50 /** |
53 * @constructor | |
54 * @implements {settings.ClearBrowsingDataBrowserProxy} | 51 * @implements {settings.ClearBrowsingDataBrowserProxy} |
55 */ | 52 */ |
56 function ClearBrowsingDataBrowserProxyImpl() {} | 53 class ClearBrowsingDataBrowserProxyImpl { |
57 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); | |
58 | |
59 ClearBrowsingDataBrowserProxyImpl.prototype = { | |
60 /** @override */ | 54 /** @override */ |
61 clearBrowsingData: function(importantSites) { | 55 clearBrowsingData(importantSites) { |
62 return cr.sendWithPromise('clearBrowsingData', importantSites); | 56 return cr.sendWithPromise('clearBrowsingData', importantSites); |
63 }, | 57 } |
64 | 58 |
65 /** @override */ | 59 /** @override */ |
66 getImportantSites: function() { | 60 getImportantSites() { |
67 return cr.sendWithPromise('getImportantSites'); | 61 return cr.sendWithPromise('getImportantSites'); |
68 }, | 62 } |
69 | 63 |
70 /** @override */ | 64 /** @override */ |
71 initialize: function() { | 65 initialize() { |
72 return cr.sendWithPromise('initializeClearBrowsingData'); | 66 return cr.sendWithPromise('initializeClearBrowsingData'); |
73 }, | 67 } |
74 }; | 68 } |
| 69 |
| 70 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); |
75 | 71 |
76 return { | 72 return { |
77 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, | 73 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, |
78 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, | 74 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, |
79 }; | 75 }; |
80 }); | 76 }); |
OLD | NEW |