| 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 Network drop-down implementation. | 6 * @fileoverview Network drop-down implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 cr.define('cr.ui', function() { | 9 cr.define('cr.ui', function() { |
| 10 /** | 10 /** |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 * Updates network title, which is shown by the drop-down. | 362 * Updates network title, which is shown by the drop-down. |
| 363 * @param {string} title Title to be displayed. | 363 * @param {string} title Title to be displayed. |
| 364 * @param {!Object} icon Icon to be displayed. | 364 * @param {!Object} icon Icon to be displayed. |
| 365 */ | 365 */ |
| 366 DropDown.updateNetworkTitle = function(title, icon) { | 366 DropDown.updateNetworkTitle = function(title, icon) { |
| 367 if (DropDown.activeElementId_) | 367 if (DropDown.activeElementId_) |
| 368 $(DropDown.activeElementId_).setTitle(title, icon); | 368 $(DropDown.activeElementId_).setTitle(title, icon); |
| 369 }; | 369 }; |
| 370 | 370 |
| 371 /** | 371 /** |
| 372 * Activates or deactivates network drop-down. Only one network drop-down | 372 * Activates network drop-down. Only one network drop-down |
| 373 * can be active at the same time. So activating new drop-down deactivates | 373 * can be active at the same time. So activating new drop-down deactivates |
| 374 * the previous one. Deactivating not active drop-down does nothing. | 374 * the previous one. |
| 375 * @param {string} element_id Id of the element which is network drop-down. | 375 * @param {string} elementId Id of network drop-down element. |
| 376 * @param {boolean} isActive Is drop-down active? | 376 * @param {boolean} isOobe Whether drop-down is used by an Oobe screen. |
| 377 * @param {boolean} isOobe Is dropdown placed on an OOBE screen. | 377 * @param {integer} lastNetworkType Last active network type. Pass -1 if it |
| 378 * isn't known. |
| 378 */ | 379 */ |
| 379 DropDown.setActive = function(elementId, isActive, isOobe) { | 380 DropDown.show = function(elementId, isOobe, lastNetworkType) { |
| 380 if (isActive) { | 381 $(elementId).isShown = false; |
| 381 $(elementId).isShown = false; | 382 if (DropDown.activeElementId_ != elementId) { |
| 382 if (DropDown.activeElementId_ != elementId) { | 383 DropDown.activeElementId_ = elementId; |
| 383 DropDown.activeElementId_ = elementId; | 384 chrome.send('networkDropdownShow', [elementId, isOobe, lastNetworkType]); |
| 384 chrome.send('networkDropdownShow', [elementId, isOobe]); | |
| 385 } | |
| 386 } else { | |
| 387 if (DropDown.activeElementId_ == elementId) { | |
| 388 DropDown.activeElementId_ = ''; | |
| 389 chrome.send('networkDropdownHide', []); | |
| 390 } | |
| 391 } | 385 } |
| 392 }; | 386 }; |
| 393 | 387 |
| 388 /** |
| 389 * Deactivates network drop-down. Deactivating inactive drop-down does |
| 390 * nothing. |
| 391 * @param {string} elementId Id of network drop-down element. |
| 392 */ |
| 393 DropDown.hide = function(elementId) { |
| 394 if (DropDown.activeElementId_ == elementId) { |
| 395 DropDown.activeElementId_ = ''; |
| 396 chrome.send('networkDropdownHide', []); |
| 397 } |
| 398 }; |
| 399 |
| 394 /** | 400 /** |
| 395 * Refreshes network drop-down. Should be called on language change. | 401 * Refreshes network drop-down. Should be called on language change. |
| 396 */ | 402 */ |
| 397 DropDown.refresh = function() { | 403 DropDown.refresh = function() { |
| 398 chrome.send('networkDropdownRefresh', []); | 404 chrome.send('networkDropdownRefresh', []); |
| 399 }; | 405 }; |
| 400 | 406 |
| 401 return { | 407 return { |
| 402 DropDown: DropDown | 408 DropDown: DropDown |
| 403 }; | 409 }; |
| 404 }); | 410 }); |
| OLD | NEW |