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

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

Issue 599273004: Polished UI for the host side of pairing flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@merge_point
Patch Set: Removed TODO. Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 host pairing screen implementation. 6 * @fileoverview host pairing screen implementation.
7 */ 7 */
8 8
9 login.createScreen('HostPairingScreen', 'host-pairing', function() { 9 login.createScreen('HostPairingScreen', 'host-pairing', function() {
10 'use strict'; 10 return {
11 polymerScreen_: null,
Nikita (slow) 2014/09/26 09:10:08 nit: Add comment explaining why such wrapper is ne
dzhioev (left Google) 2014/09/26 22:56:11 Done.
11 12
12 // Keep these constants synced with corresponding constants in
13 // host_pairing_screen_actor.{h,cc}.
14 /** @const */ var CONTEXT_KEY_PAGE = 'page';
15 /** @const */ var CONTEXT_KEY_DEVICE_NAME = 'deviceName';
16 /** @const */ var CONTEXT_KEY_CONFIRMATION_CODE = 'code';
17 /** @const */ var CONTEXT_KEY_ENROLLMENT_DOMAIN = 'enrollmentDomain';
18 /** @const */ var CONTEXT_KEY_UPDATE_PROGRESS = 'updateProgress';
19
20 /** @const */ var PAGE_WELCOME = 'welcome';
21 /** @const */ var PAGE_CODE_CONFIRMATION = 'code-confirmation';
22 /** @const */ var PAGE_UPDATE = 'update';
23 /** @const */ var PAGE_ENROLLMENT_INTRODUCTION = 'enrollment-introduction';
24 /** @const */ var PAGE_ENROLLMENT = 'enrollment';
25 /** @const */ var PAGE_ENROLLMENT_ERROR = 'enrollment-error';
26 /** @const */ var PAGE_PAIRING_DONE = 'pairing-done';
27
28 /** @const */ var CALLBACK_CONTEXT_READY = 'contextReady';
29
30
31 /** @const */ var PAGE_NAMES = [
32 PAGE_WELCOME,
33 PAGE_CODE_CONFIRMATION,
34 PAGE_UPDATE,
35 PAGE_ENROLLMENT_INTRODUCTION,
36 PAGE_ENROLLMENT,
37 PAGE_ENROLLMENT_ERROR,
38 PAGE_PAIRING_DONE];
39
40 return {
41 pages_: null,
42
43 /** @override */
44 decorate: function() { 13 decorate: function() {
45 this.initialize(); 14 polymerScreen_ = this.children[0];
46 15 polymerScreen_.decorate(this);
47 this.pages_ = {};
48 PAGE_NAMES.forEach(function(pageName) {
49 var page = this.querySelector('.page-' + pageName);
50 if (page === null)
51 throw Error('Page "' + pageName + '" was not found.');
52 page.hidden = true;
53 this.pages_[pageName] = page;
54 }, this);
55
56 this.addContextObserver(CONTEXT_KEY_PAGE, this.pageChanged_);
57 this.send(CALLBACK_CONTEXT_READY);
58 }, 16 },
59 17
60 pageChanged_: function(newPage, oldPage) { 18 onBeforeShow: function() {
61 this.pageNameLabel_.textContent = '<<<< ' + newPage + ' >>>>'; 19 polymerScreen_.onBeforeShow();
62 this.deviceNameLabel_.textContent =
63 this.context.get(CONTEXT_KEY_DEVICE_NAME);
64
65 if (newPage == PAGE_CODE_CONFIRMATION)
66 this.confirmationCodeLabel_.textContent =
67 this.context.get(CONTEXT_KEY_CONFIRMATION_CODE);
68
69 if (newPage == PAGE_UPDATE) {
70 this.setUpdateProgress_(this.context.get(CONTEXT_KEY_UPDATE_PROGRESS));
71 this.addContextObserver(CONTEXT_KEY_UPDATE_PROGRESS,
72 this.setUpdateProgress_);
73 } else if (oldPage == PAGE_UPDATE) {
74 this.removeContextObserver(this.setUpdateProgress_);
75 }
76
77 if (newPage == PAGE_ENROLLMENT)
78 this.domainNameLabel_.textContent =
79 this.context.get(CONTEXT_KEY_ENROLLMENT_DOMAIN);
80
81 this.togglePage_(newPage);
82 },
83
84 togglePage_: function(newPage) {
85 PAGE_NAMES.forEach(function(pageName) {
86 this.pages_[pageName].hidden = (pageName !== newPage);
87 }, this);
88 },
89
90 setUpdateProgress_: function(progress) {
91 this.updateProgressBar_.value = progress;
92 } 20 }
93 }; 21 };
94 }); 22 });
95 23
24 Polymer('host-pairing-screen', (function() {
25 'use strict';
26
27 /** @const */ var CALLBACK_CONTEXT_READY = 'contextReady';
28
29 return {
30 onBeforeShow: function() {
31 Oobe.getInstance().headerHidden = true;
32 },
33
34 /** @override */
35 initialize: function() {
36 this.send(CALLBACK_CONTEXT_READY);
37 }
38 };
39 })());
40
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698