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

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: Move update engine related code to another CL 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
5 /** 4 /**
6 * @fileoverview 'settings-about-page' contains version and OS related 5 * @fileoverview 'settings-about-page' contains version and OS related
7 * information. 6 * information.
8 */ 7 */
9 Polymer({ 8 Polymer({
10 is: 'settings-about-page', 9 is: 'settings-about-page',
11 10
12 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior], 11 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior],
13 12
14 properties: { 13 properties: {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 /** @private {!Map<string, string>} */ 76 /** @private {!Map<string, string>} */
78 focusConfig_: { 77 focusConfig_: {
79 type: Object, 78 type: Object,
80 value: function() { 79 value: function() {
81 var map = new Map(); 80 var map = new Map();
82 map.set( 81 map.set(
83 settings.Route.DETAILED_BUILD_INFO.path, 82 settings.Route.DETAILED_BUILD_INFO.path,
84 '#detailed-build-info-trigger'); 83 '#detailed-build-info-trigger');
85 return map; 84 return map;
86 }, 85 },
87 } 86 },
87
88 /** @private */
89 showUpdateWarningDialog_: {
90 type: Boolean,
91 value: false,
92 },
93
94 /** @private */
95 updateInfo_: {
96 type: Object,
97 value: {version: '', size: ''},
98 },
stevenjb 2017/05/11 17:20:15 I think this can just be undefined initially; we w
weidongg 2017/05/11 18:09:29 Done.
88 // </if> 99 // </if>
89 }, 100 },
90 101
91 observers: [ 102 observers: [
92 // <if expr="not chromeos"> 103 // <if expr="not chromeos">
93 'updateShowUpdateStatus_(' + 104 'updateShowUpdateStatus_(' +
94 'obsoleteSystemInfo_, currentUpdateStatusEvent_)', 105 'obsoleteSystemInfo_, currentUpdateStatusEvent_)',
95 'updateShowRelaunch_(currentUpdateStatusEvent_)', 106 'updateShowRelaunch_(currentUpdateStatusEvent_)',
96 'updateShowButtonContainer_(showRelaunch_)', 107 'updateShowButtonContainer_(showRelaunch_)',
97 // </if> 108 // </if>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 }, 167 },
157 168
158 /** 169 /**
159 * @param {!UpdateStatusChangedEvent} event 170 * @param {!UpdateStatusChangedEvent} event
160 * @private 171 * @private
161 */ 172 */
162 onUpdateStatusChanged_: function(event) { 173 onUpdateStatusChanged_: function(event) {
163 // <if expr="chromeos"> 174 // <if expr="chromeos">
164 if (event.status == UpdateStatus.CHECKING) 175 if (event.status == UpdateStatus.CHECKING)
165 this.hasCheckedForUpdates_ = true; 176 this.hasCheckedForUpdates_ = true;
177 else if (event.status == UpdateStatus.NEED_PERMISSION_TO_UPDATE) {
178 this.showUpdateWarningDialog_ = true;
179 // Async to wait for dialog to appear in the DOM.
180 this.async(function() {
stevenjb 2017/05/11 17:20:15 This no longer needs to be async since we do not n
weidongg 2017/05/11 18:09:29 Done.
181 this.updateInfo_ = {version: event.version, size: event.size};
182 }.bind(this));
183 }
166 // </if> 184 // </if>
167 this.currentUpdateStatusEvent_ = event; 185 this.currentUpdateStatusEvent_ = event;
168 }, 186 },
169 187
170 // <if expr="_google_chrome and is_macosx"> 188 // <if expr="_google_chrome and is_macosx">
171 /** 189 /**
172 * @param {!PromoteUpdaterStatus} status 190 * @param {!PromoteUpdaterStatus} status
173 * @private 191 * @private
174 */ 192 */
175 onPromoteUpdaterStatusChanged_: function(status) { 193 onPromoteUpdaterStatusChanged_: function(status) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 }, 269 },
252 270
253 /** 271 /**
254 * @return {string} 272 * @return {string}
255 * @private 273 * @private
256 */ 274 */
257 getUpdateStatusMessage_: function() { 275 getUpdateStatusMessage_: function() {
258 switch (this.currentUpdateStatusEvent_.status) { 276 switch (this.currentUpdateStatusEvent_.status) {
259 case UpdateStatus.CHECKING: 277 case UpdateStatus.CHECKING:
260 return this.i18n('aboutUpgradeCheckStarted'); 278 return this.i18n('aboutUpgradeCheckStarted');
279 case UpdateStatus.NEED_PERMISSION_TO_UPDATE:
280 return "";
261 case UpdateStatus.NEARLY_UPDATED: 281 case UpdateStatus.NEARLY_UPDATED:
262 // <if expr="chromeos"> 282 // <if expr="chromeos">
263 if (this.currentChannel_ != this.targetChannel_) 283 if (this.currentChannel_ != this.targetChannel_)
264 return this.i18n('aboutUpgradeSuccessChannelSwitch'); 284 return this.i18n('aboutUpgradeSuccessChannelSwitch');
265 // </if> 285 // </if>
266 return this.i18n('aboutUpgradeRelaunch'); 286 return this.i18n('aboutUpgradeRelaunch');
267 case UpdateStatus.UPDATED: 287 case UpdateStatus.UPDATED:
268 return this.i18n('aboutUpgradeUpToDate'); 288 return this.i18n('aboutUpgradeUpToDate');
269 case UpdateStatus.UPDATING: 289 case UpdateStatus.UPDATING:
270 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); 290 assert(typeof this.currentUpdateStatusEvent_.progress == 'number');
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 /** 412 /**
393 * @return {boolean} 413 * @return {boolean}
394 * @private 414 * @private
395 */ 415 */
396 computeShowCheckUpdates_: function() { 416 computeShowCheckUpdates_: function() {
397 // Enable the update button if we are in a stale 'updated' status or 417 // Enable the update button if we are in a stale 'updated' status or
398 // update has failed. Disable it otherwise. 418 // update has failed. Disable it otherwise.
399 var staleUpdatedStatus = !this.hasCheckedForUpdates_ && 419 var staleUpdatedStatus = !this.hasCheckedForUpdates_ &&
400 this.checkStatus_(UpdateStatus.UPDATED); 420 this.checkStatus_(UpdateStatus.UPDATED);
401 421
402 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED); 422 return staleUpdatedStatus || this.checkStatus_(UpdateStatus.FAILED) ||
423 this.checkStatus_(UpdateStatus.NEED_PERMISSION_TO_UPDATE);
403 }, 424 },
404 425
405 /** 426 /**
406 * @return {boolean} 427 * @return {boolean}
407 * @private 428 * @private
408 */ 429 */
409 shouldShowRegulatoryInfo_: function() { 430 shouldShowRegulatoryInfo_: function() {
410 return this.regulatoryInfo_ !== null; 431 return this.regulatoryInfo_ !== null;
411 }, 432 },
433
434 /** @private */
435 onUpdateWarningDialogClose_: function() {
436 this.showUpdateWarningDialog_ = false;
437 },
412 // </if> 438 // </if>
413 439
414 /** @private */ 440 /** @private */
415 onProductLogoTap_: function() { 441 onProductLogoTap_: function() {
416 this.$['product-logo'].animate({ 442 this.$['product-logo'].animate({
417 transform: ['none', 'rotate(-10turn)'], 443 transform: ['none', 'rotate(-10turn)'],
418 }, { 444 }, {
419 duration: 500, 445 duration: 500,
420 easing: 'cubic-bezier(1, 0, 0, 1)', 446 easing: 'cubic-bezier(1, 0, 0, 1)',
421 }); 447 });
422 }, 448 },
423 449
424 // <if expr="_google_chrome"> 450 // <if expr="_google_chrome">
425 /** @private */ 451 /** @private */
426 onReportIssueTap_: function() { 452 onReportIssueTap_: function() {
427 this.aboutBrowserProxy_.openFeedbackDialog(); 453 this.aboutBrowserProxy_.openFeedbackDialog();
428 }, 454 },
429 // </if> 455 // </if>
430 }); 456 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698