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} element_id Id of the element which is network drop-down. |
whywhat
2011/11/29 07:58:06
Should be named "elementId"
Would "Id of network d
altimofeev
2011/11/29 17:10:46
Done.
| |
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} last Last active network type. |
whywhat
2011/11/29 07:58:06
Could you rename it to smth less general? i.e. las
altimofeev
2011/11/29 17:10:46
Done.
| |
378 */ | 378 */ |
379 DropDown.setActive = function(elementId, isActive, isOobe) { | 379 DropDown.show = function(elementId, isOobe, last) { |
380 if (isActive) { | 380 $(elementId).isShown = false; |
381 $(elementId).isShown = false; | 381 if (DropDown.activeElementId_ != elementId) { |
382 if (DropDown.activeElementId_ != elementId) { | 382 DropDown.activeElementId_ = elementId; |
383 DropDown.activeElementId_ = elementId; | 383 chrome.send('networkDropdownShow', [elementId, isOobe, last]); |
384 chrome.send('networkDropdownShow', [elementId, isOobe]); | |
385 } | |
386 } else { | |
387 if (DropDown.activeElementId_ == elementId) { | |
388 DropDown.activeElementId_ = ''; | |
389 chrome.send('networkDropdownHide', []); | |
390 } | |
391 } | 384 } |
392 }; | 385 }; |
393 | 386 |
387 /** | |
388 * Deactivates network drop-down. Deactivating not active drop-down does | |
whywhat
2011/11/29 07:58:06
not active -> inactive
altimofeev
2011/11/29 17:10:46
Done.
| |
389 * nothing. | |
390 * @param {string} element_id Id of the element which is network drop-down. | |
whywhat
2011/11/29 07:58:06
Ditto about comment and name
altimofeev
2011/11/29 17:10:46
Done.
| |
391 */ | |
392 DropDown.hide = function(elementId) { | |
393 if (DropDown.activeElementId_ == elementId) { | |
394 DropDown.activeElementId_ = ''; | |
395 chrome.send('networkDropdownHide', []); | |
whywhat
2011/11/29 07:58:06
nit: I thought you don't need to specify [] explic
altimofeev
2011/11/29 17:10:46
You are right, they are not obligatory. But I thin
| |
396 } | |
397 }; | |
398 | |
394 /** | 399 /** |
395 * Refreshes network drop-down. Should be called on language change. | 400 * Refreshes network drop-down. Should be called on language change. |
396 */ | 401 */ |
397 DropDown.refresh = function() { | 402 DropDown.refresh = function() { |
398 chrome.send('networkDropdownRefresh', []); | 403 chrome.send('networkDropdownRefresh', []); |
399 }; | 404 }; |
400 | 405 |
401 return { | 406 return { |
402 DropDown: DropDown | 407 DropDown: DropDown |
403 }; | 408 }; |
404 }); | 409 }); |
OLD | NEW |