| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview A helper object used from the "About" section to interact with |
| 7 * the browser. |
| 8 */ |
| 9 |
| 10 <if expr="chromeos"> |
| 11 /** |
| 12 * @typedef {{ |
| 13 * text: string, |
| 14 * url: string, |
| 15 * }} |
| 16 */ |
| 17 var RegulatoryInfo; |
| 18 |
| 19 /** |
| 20 * @typedef {{ |
| 21 * arcVersion: string, |
| 22 * osFirmware: string, |
| 23 * osVersion: string, |
| 24 * }} |
| 25 */ |
| 26 var VersionInfo; |
| 27 </if> |
| 28 |
| 29 cr.define('settings', function() { |
| 30 /** |
| 31 * Enumeration of all possible browser channels. |
| 32 * @enum {string} |
| 33 */ |
| 34 var BrowserChannel = { |
| 35 BETA: 'beta-channel', |
| 36 DEV: 'dev-channel', |
| 37 STABLE: 'stable-channel', |
| 38 }; |
| 39 |
| 40 /** @interface */ |
| 41 function AboutPageBrowserProxy() {} |
| 42 |
| 43 AboutPageBrowserProxy.prototype = { |
| 44 /** |
| 45 * Called once the page is ready. It results in one or more |
| 46 * 'update-status-changed' WebUI events. |
| 47 */ |
| 48 refreshUpdateStatus: function() {}, |
| 49 |
| 50 /** |
| 51 * Relaunches the browser. |
| 52 */ |
| 53 relaunchNow: function() {}, |
| 54 |
| 55 /** Opens the help page. */ |
| 56 openHelpPage: function() {}, |
| 57 |
| 58 <if expr="_google_chrome"> |
| 59 /** |
| 60 * Opens the feedback dialog. |
| 61 */ |
| 62 openFeedbackDialog: function() {}, |
| 63 </if> |
| 64 |
| 65 <if expr="chromeos"> |
| 66 /** |
| 67 * Checks for available update and applies if it exists. |
| 68 */ |
| 69 requestUpdate: function() {}, |
| 70 |
| 71 /** |
| 72 * @param {!BrowserChannel} channel |
| 73 * @param {boolean} isPowerwashAllowed |
| 74 */ |
| 75 setChannel: function(channel, isPowerwashAllowed) {}, |
| 76 |
| 77 /** @return {!Promise<string>} */ |
| 78 getCurrentChannel: function() {}, |
| 79 |
| 80 /** @return {!Promise<string>} */ |
| 81 getTargetChannel: function() {}, |
| 82 |
| 83 /** @return {!Promise<!VersionInfo>} */ |
| 84 getVersionInfo: function() {}, |
| 85 |
| 86 /** @return {!Promise<?RegulatoryInfo>} */ |
| 87 getRegulatoryInfo: function() {}, |
| 88 </if> |
| 89 }; |
| 90 |
| 91 /** |
| 92 * @implements {settings.AboutPageBrowserProxy} |
| 93 * @constructor |
| 94 */ |
| 95 function AboutPageBrowserProxyImpl() {} |
| 96 cr.addSingletonGetter(AboutPageBrowserProxyImpl); |
| 97 |
| 98 AboutPageBrowserProxyImpl.prototype = { |
| 99 /** @override */ |
| 100 refreshUpdateStatus: function() { |
| 101 chrome.send('refreshUpdateStatus'); |
| 102 }, |
| 103 |
| 104 /** @override */ |
| 105 relaunchNow: function() { |
| 106 chrome.send('relaunchNow'); |
| 107 }, |
| 108 |
| 109 /** @override */ |
| 110 openHelpPage: function() { |
| 111 chrome.send('openHelpPage'); |
| 112 }, |
| 113 |
| 114 <if expr="_google_chrome"> |
| 115 /** @override */ |
| 116 openFeedbackDialog: function() { |
| 117 chrome.send('openFeedbackDialog'); |
| 118 }, |
| 119 </if> |
| 120 |
| 121 <if expr="chromeos"> |
| 122 /** @override */ |
| 123 requestUpdate: function() { |
| 124 chrome.send('requestUpdate'); |
| 125 }, |
| 126 |
| 127 /** @override */ |
| 128 setChannel: function(channel, isPowerwashAllowed) { |
| 129 chrome.send('setChannel', [channel, isPowerwashAllowed]); |
| 130 }, |
| 131 |
| 132 /** @override */ |
| 133 getCurrentChannel: function() { |
| 134 return cr.sendWithPromise('getCurrentChannel'); |
| 135 }, |
| 136 |
| 137 /** @override */ |
| 138 getTargetChannel: function() { |
| 139 return cr.sendWithPromise('getTargetChannel'); |
| 140 }, |
| 141 |
| 142 /** @override */ |
| 143 getVersionInfo: function() { |
| 144 return cr.sendWithPromise('getVersionInfo'); |
| 145 }, |
| 146 |
| 147 /** @override */ |
| 148 getRegulatoryInfo: function() { |
| 149 return cr.sendWithPromise('getRegulatoryInfo'); |
| 150 } |
| 151 </if> |
| 152 }; |
| 153 |
| 154 return { |
| 155 AboutPageBrowserProxy: AboutPageBrowserProxy, |
| 156 AboutPageBrowserProxyImpl: AboutPageBrowserProxyImpl, |
| 157 }; |
| 158 }); |
| OLD | NEW |