| OLD | NEW |
| 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 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. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 * been recieved. | 83 * been recieved. |
| 84 * @param {Integer} state Current state of the network (see NET_STATE). | 84 * @param {Integer} state Current state of the network (see NET_STATE). |
| 85 * @param {string} network Name of the network. | 85 * @param {string} network Name of the network. |
| 86 * @param {string} reason Reason the callback was called. | 86 * @param {string} reason Reason the callback was called. |
| 87 * @param {int} last Last active network type. | 87 * @param {int} last Last active network type. |
| 88 */ | 88 */ |
| 89 HeaderBar.handleAddUser = function(state, network, reason, last) { | 89 HeaderBar.handleAddUser = function(state, network, reason, last) { |
| 90 if (state != NET_STATE.OFFLINE) { | 90 if (state != NET_STATE.OFFLINE) { |
| 91 Oobe.showSigninUI(); | 91 Oobe.showSigninUI(); |
| 92 } else { | 92 } else { |
| 93 $('bubble').showTextForElement($('add-user-button'), | 93 const BUBBLE_OFFSET = 8; |
| 94 localStrings.getString('addUserErrorMessage')); | 94 const BUBBLE_PADDING = 5; |
| 95 $('bubble').showTextForElement( |
| 96 $('add-user-button'), |
| 97 localStrings.getString('addUserErrorMessage'), |
| 98 cr.ui.Bubble.Attachment.BOTTOM, BUBBLE_OFFSET, BUBBLE_PADDING); |
| 95 chrome.send('loginAddNetworkStateObserver', | 99 chrome.send('loginAddNetworkStateObserver', |
| 96 ['login.HeaderBar.bubbleWatchdog']); | 100 ['login.HeaderBar.bubbleWatchdog']); |
| 97 } | 101 } |
| 98 }; | 102 }; |
| 99 | 103 |
| 100 /** | 104 /** |
| 101 * Observes network state, and close the bubble when network becomes online. | 105 * Observes network state, and close the bubble when network becomes online. |
| 102 * @param {Integer} state Current state of the network (see NET_STATE). | 106 * @param {Integer} state Current state of the network (see NET_STATE). |
| 103 * @param {string} network Name of the network. | 107 * @param {string} network Name of the network. |
| 104 * @param {string} reason Reason the callback was called. | 108 * @param {string} reason Reason the callback was called. |
| 105 * @param {int} last Last active network type. | 109 * @param {int} last Last active network type. |
| 106 */ | 110 */ |
| 107 HeaderBar.bubbleWatchdog = function(state, network, reason, last) { | 111 HeaderBar.bubbleWatchdog = function(state, network, reason, last) { |
| 108 if (state != NET_STATE.OFFLINE) { | 112 if (state != NET_STATE.OFFLINE) { |
| 109 $('bubble').hideForElement($('add-user-button')); | 113 $('bubble').hideForElement($('add-user-button')); |
| 110 chrome.send('loginRemoveNetworkStateObserver', | 114 chrome.send('loginRemoveNetworkStateObserver', |
| 111 ['login.HeaderBar.bubbleWatchdog']); | 115 ['login.HeaderBar.bubbleWatchdog']); |
| 112 } | 116 } |
| 113 }; | 117 }; |
| 114 | 118 |
| 115 return { | 119 return { |
| 116 HeaderBar: HeaderBar | 120 HeaderBar: HeaderBar |
| 117 }; | 121 }; |
| 118 }); | 122 }); |
| OLD | NEW |