Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: chrome/browser/resources/settings/about_page/about_page.js

Issue 2873193002: Make update over cellular an option for user (Closed)
Patch Set: Put code in CHROME_OS wrapper to fix trybot error Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 'settings-about-page' contains version and OS related 6 * @fileoverview 'settings-about-page' contains version and OS related
7 * information. 7 * information.
8 */ 8 */
9
9 Polymer({ 10 Polymer({
10 is: 'settings-about-page', 11 is: 'settings-about-page',
11 12
12 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior], 13 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior],
13 14
14 properties: { 15 properties: {
15 /** @private {?UpdateStatusChangedEvent} */ 16 /** @private {?UpdateStatusChangedEvent} */
16 currentUpdateStatusEvent_: { 17 currentUpdateStatusEvent_: {
17 type: Object, 18 type: Object,
18 value: {message: '', progress: 0, status: UpdateStatus.DISABLED}, 19 value: {message: '', progress: 0, status: UpdateStatus.DISABLED},
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 /** @private {!Map<string, string>} */ 78 /** @private {!Map<string, string>} */
78 focusConfig_: { 79 focusConfig_: {
79 type: Object, 80 type: Object,
80 value: function() { 81 value: function() {
81 var map = new Map(); 82 var map = new Map();
82 map.set( 83 map.set(
83 settings.Route.DETAILED_BUILD_INFO.path, 84 settings.Route.DETAILED_BUILD_INFO.path,
84 '#detailed-build-info-trigger'); 85 '#detailed-build-info-trigger');
85 return map; 86 return map;
86 }, 87 },
87 } 88 },
89
90 /** @private */
91 showUpdateWarningDialog_: {
92 type: Boolean,
93 value: false,
94 },
95
96 /** @private {!AboutPageUpdateInfo|undefined} */
97 updateInfo_: Object,
88 // </if> 98 // </if>
89 }, 99 },
90 100
91 observers: [ 101 observers: [
92 // <if expr="not chromeos"> 102 // <if expr="not chromeos">
93 'updateShowUpdateStatus_(' + 103 'updateShowUpdateStatus_(' +
94 'obsoleteSystemInfo_, currentUpdateStatusEvent_)', 104 'obsoleteSystemInfo_, currentUpdateStatusEvent_)',
95 'updateShowRelaunch_(currentUpdateStatusEvent_)', 105 'updateShowRelaunch_(currentUpdateStatusEvent_)',
96 'updateShowButtonContainer_(showRelaunch_)', 106 'updateShowButtonContainer_(showRelaunch_)',
97 // </if> 107 // </if>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 }, 166 },
157 167
158 /** 168 /**
159 * @param {!UpdateStatusChangedEvent} event 169 * @param {!UpdateStatusChangedEvent} event
160 * @private 170 * @private
161 */ 171 */
162 onUpdateStatusChanged_: function(event) { 172 onUpdateStatusChanged_: function(event) {
163 // <if expr="chromeos"> 173 // <if expr="chromeos">
164 if (event.status == UpdateStatus.CHECKING) 174 if (event.status == UpdateStatus.CHECKING)
165 this.hasCheckedForUpdates_ = true; 175 this.hasCheckedForUpdates_ = true;
176 else if (event.status == UpdateStatus.NEED_PERMISSION_TO_UPDATE) {
177 this.showUpdateWarningDialog_ = true;
178 this.updateInfo_ = {version: event.version, size: event.size};
179 }
166 // </if> 180 // </if>
167 this.currentUpdateStatusEvent_ = event; 181 this.currentUpdateStatusEvent_ = event;
168 }, 182 },
169 183
170 // <if expr="_google_chrome and is_macosx"> 184 // <if expr="_google_chrome and is_macosx">
171 /** 185 /**
172 * @param {!PromoteUpdaterStatus} status 186 * @param {!PromoteUpdaterStatus} status
173 * @private 187 * @private
174 */ 188 */
175 onPromoteUpdaterStatusChanged_: function(status) { 189 onPromoteUpdaterStatusChanged_: function(status) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 }, 265 },
252 266
253 /** 267 /**
254 * @return {string} 268 * @return {string}
255 * @private 269 * @private
256 */ 270 */
257 getUpdateStatusMessage_: function() { 271 getUpdateStatusMessage_: function() {
258 switch (this.currentUpdateStatusEvent_.status) { 272 switch (this.currentUpdateStatusEvent_.status) {
259 case UpdateStatus.CHECKING: 273 case UpdateStatus.CHECKING:
260 return this.i18n('aboutUpgradeCheckStarted'); 274 return this.i18n('aboutUpgradeCheckStarted');
275 case UpdateStatus.NEED_PERMISSION_TO_UPDATE:
276 // This status is immediately followed by an reporting error status.
277 // When update engine reports error, UI just shows that your device is
278 // up to date. This is a bug that needs to be fixed in the future.
279 // TODO(weidongg/581071): Show proper message when update engine aborts
280 // due to cellular connection.
281 return '';
261 case UpdateStatus.NEARLY_UPDATED: 282 case UpdateStatus.NEARLY_UPDATED:
262 // <if expr="chromeos"> 283 // <if expr="chromeos">
263 if (this.currentChannel_ != this.targetChannel_) 284 if (this.currentChannel_ != this.targetChannel_)
264 return this.i18n('aboutUpgradeSuccessChannelSwitch'); 285 return this.i18n('aboutUpgradeSuccessChannelSwitch');
265 // </if> 286 // </if>
266 return this.i18n('aboutUpgradeRelaunch'); 287 return this.i18n('aboutUpgradeRelaunch');
267 case UpdateStatus.UPDATED: 288 case UpdateStatus.UPDATED:
268 return this.i18n('aboutUpgradeUpToDate'); 289 return this.i18n('aboutUpgradeUpToDate');
269 case UpdateStatus.UPDATING: 290 case UpdateStatus.UPDATING:
270 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); 291 assert(typeof this.currentUpdateStatusEvent_.progress == 'number');
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 /** 413 /**
393 * @return {boolean} 414 * @return {boolean}
394 * @private 415 * @private
395 */ 416 */
396 computeShowCheckUpdates_: function() { 417 computeShowCheckUpdates_: function() {
397 // Enable the update button if we are in a stale 'updated' status or 418 // Enable the update button if we are in a stale 'updated' status or
398 // update has failed. Disable it otherwise. 419 // update has failed. Disable it otherwise.
399 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && 420 var staleUpdatedStatus = !this.hasCheckedForUpdates_ &&
400 this.checkStatus_(UpdateStatus.UPDATED); 421 this.checkStatus_(UpdateStatus.UPDATED);
401 422
402 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED); 423 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED) ||
424 this.checkStatus_(UpdateStatus.NEED_PERMISSION_TO_UPDATE);
403 }, 425 },
404 426
405 /** 427 /**
406 * @return {boolean} 428 * @return {boolean}
407 * @private 429 * @private
408 */ 430 */
409 shouldShowRegulatoryInfo_: function() { 431 shouldShowRegulatoryInfo_: function() {
410 return this.regulatoryInfo_ !== null; 432 return this.regulatoryInfo_ !== null;
411 }, 433 },
434
435 /** @private */
436 onUpdateWarningDialogClose_: function() {
437 this.showUpdateWarningDialog_ = false;
438 },
412 // </if> 439 // </if>
413 440
414 /** @private */ 441 /** @private */
415 onProductLogoTap_: function() { 442 onProductLogoTap_: function() {
416 this.$['product-logo'].animate({ 443 this.$['product-logo'].animate({
417 transform: ['none', 'rotate(-10turn)'], 444 transform: ['none', 'rotate(-10turn)'],
418 }, { 445 }, {
419 duration: 500, 446 duration: 500,
420 easing: 'cubic-bezier(1, 0, 0, 1)', 447 easing: 'cubic-bezier(1, 0, 0, 1)',
421 }); 448 });
422 }, 449 },
423 450
424 // <if expr="_google_chrome"> 451 // <if expr="_google_chrome">
425 /** @private */ 452 /** @private */
426 onReportIssueTap_: function() { 453 onReportIssueTap_: function() {
427 this.aboutBrowserProxy_.openFeedbackDialog(); 454 this.aboutBrowserProxy_.openFeedbackDialog();
428 }, 455 },
429 // </if> 456 // </if>
430 }); 457 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698