OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 Login UI header bar implementation. | 6 * @fileoverview Login UI header bar implementation. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('login', function() { | 9 cr.define('login', function() { |
10 // Network state constants. | 10 // Network state constants. |
11 const NET_STATE = { | 11 const NET_STATE = { |
12 OFFLINE: 0, | 12 OFFLINE: 0, |
13 ONLINE: 1, | 13 ONLINE: 1, |
14 PORTAL: 2 | 14 PORTAL: 2 |
15 }; | 15 }; |
16 | 16 |
17 /** | 17 /** |
18 * Creates a header bar element. | 18 * Creates a header bar element. |
19 * @constructor | 19 * @constructor |
20 * @extends {HTMLDivElement} | 20 * @extends {HTMLDivElement} |
21 */ | 21 */ |
22 var HeaderBar = cr.ui.define('div'); | 22 var HeaderBar = cr.ui.define('div'); |
23 | 23 |
24 HeaderBar.prototype = { | 24 HeaderBar.prototype = { |
25 __proto__: HTMLDivElement.prototype, | 25 __proto__: HTMLDivElement.prototype, |
26 | 26 |
27 /** @inheritDoc */ | 27 /** @inheritDoc */ |
28 decorate: function() { | 28 decorate: function() { |
29 // All header bar buttons have custom appearance. | |
Nikita (slow)
2011/11/22 12:36:12
Please add this class in html instead.
Ivan Korotkov
2011/11/22 12:43:02
Done.
| |
30 var buttons = this.getElementsByTagName('button'); | |
31 for (var i = 0, button; button = buttons[i]; ++i) { | |
32 button.classList.add('custom-appearance'); | |
33 } | |
29 $('shutdown-header-bar-item').addEventListener('click', | 34 $('shutdown-header-bar-item').addEventListener('click', |
30 this.handleShutdownClick_); | 35 this.handleShutdownClick_); |
31 $('shutdown-button').addEventListener('click', | 36 $('shutdown-button').addEventListener('click', |
32 this.handleShutdownClick_); | 37 this.handleShutdownClick_); |
33 $('add-user-button').addEventListener('click', function(e) { | 38 $('add-user-button').addEventListener('click', function(e) { |
34 chrome.send('loginRequestNetworkState', | 39 chrome.send('loginRequestNetworkState', |
35 ['login.HeaderBar.handleAddUser', | 40 ['login.HeaderBar.handleAddUser', |
36 'check']); | 41 'check']); |
37 }); | 42 }); |
38 $('cancel-add-user-button').addEventListener('click', function(e) { | 43 $('cancel-add-user-button').addEventListener('click', function(e) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 $('bubble').hideForElement($('add-user-button')); | 101 $('bubble').hideForElement($('add-user-button')); |
97 chrome.send('loginRemoveNetworkStateObserver', | 102 chrome.send('loginRemoveNetworkStateObserver', |
98 ['login.HeaderBar.bubbleWatchdog']); | 103 ['login.HeaderBar.bubbleWatchdog']); |
99 } | 104 } |
100 }; | 105 }; |
101 | 106 |
102 return { | 107 return { |
103 HeaderBar: HeaderBar | 108 HeaderBar: HeaderBar |
104 }; | 109 }; |
105 }); | 110 }); |
OLD | NEW |