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