OLD | NEW |
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 /** | |
6 * @fileoverview controller pairing screen implementation. | |
7 */ | |
8 | |
9 login.createScreen('ControllerPairingScreen', 'controller-pairing', function() { | |
10 return { | |
11 decorate: function() { | |
12 this.children[0].decorate(this); | |
13 } | |
14 }; | |
15 }); | |
16 | |
17 Polymer('pairing-device-list', (function() { | 5 Polymer('pairing-device-list', (function() { |
18 /** @const */ var ICON_COLORS = ['#F0B9CB', '#F0ACC3', '#F098B6', '#F084A9', | 6 /** @const */ var ICON_COLORS = ['#F0B9CB', '#F0ACC3', '#F098B6', '#F084A9', |
19 '#F06D99', '#F05287', '#F0467F', '#F03473', | 7 '#F06D99', '#F05287', '#F0467F', '#F03473', |
20 '#F01E65', '#F00051']; | 8 '#F01E65', '#F00051']; |
21 return { | 9 return { |
22 /* Returns pseudo-random color depending of hash of the |name|. */ | 10 /* Returns pseudo-random color depending of hash of the |name|. */ |
23 colorByName: function(name) { | 11 colorByName: function(name) { |
24 var hash = 0; | 12 var hash = 0; |
25 for (var i = 0; i < name.length; ++i) | 13 for (var i = 0; i < name.length; ++i) |
26 hash = (name.charCodeAt(i) + 31 * hash) | 0; | 14 hash = (name.charCodeAt(i) + 31 * hash) | 0; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 }, | 69 }, |
82 | 70 |
83 onAuthCompleted_: function(credentials) { | 71 onAuthCompleted_: function(credentials) { |
84 this.context.set(CONTEXT_KEY_ACCOUNT_ID, credentials.email); | 72 this.context.set(CONTEXT_KEY_ACCOUNT_ID, credentials.email); |
85 this.commitContextChanges(); | 73 this.commitContextChanges(); |
86 this.send(login.Screen.CALLBACK_USER_ACTED, ACTION_ENROLL); | 74 this.send(login.Screen.CALLBACK_USER_ACTED, ACTION_ENROLL); |
87 } | 75 } |
88 }; | 76 }; |
89 })()); | 77 })()); |
90 | 78 |
OLD | NEW |