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

Side by Side Diff: chrome/browser/resources/chromeos/login/oobe_screen_update.js

Issue 13913011: Polished update screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 Oobe update screen implementation. 6 * @fileoverview Oobe update screen implementation.
7 */ 7 */
8 8
9 cr.define('oobe', function() { 9 cr.define('oobe', function() {
10 /** 10 /**
11 * Creates a new oobe screen div. 11 * Creates a new oobe screen div.
12 * @constructor 12 * @constructor
13 * @extends {HTMLDivElement} 13 * @extends {HTMLDivElement}
14 */ 14 */
15 var UpdateScreen = cr.ui.define('div'); 15 var UpdateScreen = cr.ui.define('div');
16 16
17 /** @const */ var ELLIPSIS = ['', '.', '..', '...'];
18 /** @const */ var ELLIPSIS_ANIMATION_TIMEOUT_MS = 1000;
19
20 /** 17 /**
21 * Registers with Oobe. 18 * Registers with Oobe.
22 */ 19 */
23 UpdateScreen.register = function() { 20 UpdateScreen.register = function() {
24 var screen = $('update'); 21 var screen = $('update');
25 UpdateScreen.decorate(screen); 22 UpdateScreen.decorate(screen);
26 Oobe.getInstance().registerScreen(screen); 23 Oobe.getInstance().registerScreen(screen);
27 }; 24 };
28 25
29 UpdateScreen.prototype = { 26 UpdateScreen.prototype = {
30 __proto__: HTMLDivElement.prototype, 27 __proto__: HTMLDivElement.prototype,
31 28
32 /** @override */ 29 /** @override */
33 decorate: function() { 30 decorate: function() {
34 }, 31 },
35 32
36 onBeforeShow: function(data) {
37 UpdateScreen.startEllipsisAnimation();
Nikita (slow) 2013/04/10 04:52:05 I think you should specifically add rule like "dis
Nikita (slow) 2013/04/12 12:54:39 What about this comment?
38 },
39
40 onBeforeHide: function() {
41 UpdateScreen.stopEllipsisAnimation();
42 },
43
44 /** 33 /**
45 * Header text of the screen. 34 * Header text of the screen.
46 * @type {string} 35 * @type {string}
47 */ 36 */
48 get header() { 37 get header() {
49 return loadTimeData.getString('updateScreenTitle'); 38 return loadTimeData.getString('updateScreenTitle');
50 }, 39 },
51 40
52 /** 41 /**
53 * Buttons in oobe wizard's button strip.
54 * @type {array} Array of Buttons.
55 */
56 get buttons() {
57 return null;
58 },
59
60 /**
61 * Cancels the screen. 42 * Cancels the screen.
62 */ 43 */
63 cancel: function() { 44 cancel: function() {
64 // It's safe to act on the accelerator even if it's disabled on official 45 // It's safe to act on the accelerator even if it's disabled on official
65 // builds, since Chrome will just ignore the message in that case. 46 // builds, since Chrome will just ignore the message in that case.
66 var updateCancelHint = $('update-cancel-hint').firstElementChild; 47 var updateCancelHint = $('update-cancel-hint').firstElementChild;
67 updateCancelHint.textContent = 48 updateCancelHint.textContent =
68 loadTimeData.getString('cancelledUpdateMessage'); 49 loadTimeData.getString('cancelledUpdateMessage');
69 chrome.send('cancelUpdate'); 50 chrome.send('cancelUpdate');
70 }, 51 },
71 }; 52 };
72 53
73 var ellipsisAnimationActive = false;
74
75 /**
76 * Updates number of dots in the ellipsis.
77 *
78 * @private
79 * @param {number} count Number of dots that should be shown.
80 */
81 function updateEllipsisAnimation_(count) {
82 $('update-checking-ellipsis').textContent = ELLIPSIS[count];
83 if (ellipsisAnimationActive) {
84 window.setTimeout(function() {
85 updateEllipsisAnimation_((count + 1) % ELLIPSIS.length);
86 }, ELLIPSIS_ANIMATION_TIMEOUT_MS);
87 }
88 };
89
90 /** 54 /**
91 * Makes 'press Escape to cancel update' hint visible. 55 * Makes 'press Escape to cancel update' hint visible.
92 */ 56 */
93 UpdateScreen.enableUpdateCancel = function() { 57 UpdateScreen.enableUpdateCancel = function() {
94 $('update-cancel-hint').hidden = false; 58 $('update-cancel-hint').hidden = false;
95 }; 59 };
96 60
97 /**
98 * Starts animation for tail ellipses in "Checking for update..." label.
99 */
100 UpdateScreen.startEllipsisAnimation = function() {
101 ellipsisAnimationActive = true;
102 updateEllipsisAnimation_(0);
103 };
104
105 /**
106 * Stops animation for tail ellipses in "Checking for update..." label.
107 */
108 UpdateScreen.stopEllipsisAnimation = function() {
109 ellipsisAnimationActive = false;
110 };
111
112 return { 61 return {
113 UpdateScreen: UpdateScreen 62 UpdateScreen: UpdateScreen
114 }; 63 };
115 }); 64 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698