Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: chrome/browser/resources/options/chromeos/internet_detail.js

Issue 11829015: Add the ability to activate for carriers that need to be directly activated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/chromeos/internet_options_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 cr.define('options.internet', function() { 5 cr.define('options.internet', function() {
6 var OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; 7 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
8 /** @const */ var IPAddressField = options.internet.IPAddressField; 8 /** @const */ var IPAddressField = options.internet.IPAddressField;
9 9
10 /** 10 /**
(...skipping 16 matching lines...) Expand all
27 * @param {string} selector CSS selector for extracting a list of elements. 27 * @param {string} selector CSS selector for extracting a list of elements.
28 * @param {bool} hidden New hidden value. 28 * @param {bool} hidden New hidden value.
29 */ 29 */
30 function updateHidden(selector, hidden) { 30 function updateHidden(selector, hidden) {
31 var elements = cr.doc.querySelectorAll(selector); 31 var elements = cr.doc.querySelectorAll(selector);
32 for (var i = 0, el; el = elements[i]; i++) { 32 for (var i = 0, el; el = elements[i]; i++) {
33 el.hidden = hidden; 33 el.hidden = hidden;
34 } 34 }
35 } 35 }
36 36
37 /*
38 * Helper function to update the properties of the data object from the
39 * properties in the update object.
40 * @param {object} data object to update.
41 * @param {object} object containing the updated properties.
42 */
43 function updateDataObject(data, update) {
44 for (prop in update) {
45 if (prop in data)
46 data[prop] = update[prop];
47 }
48 }
49
37 /** 50 /**
38 * Monitor pref change of given element. 51 * Monitor pref change of given element.
39 * @param {Element} el Target element. 52 * @param {Element} el Target element.
40 */ 53 */
41 function observePrefsUI(el) { 54 function observePrefsUI(el) {
42 Preferences.getInstance().addEventListener(el.pref, handlePrefUpdate); 55 Preferences.getInstance().addEventListener(el.pref, handlePrefUpdate);
43 } 56 }
44 57
45 /** 58 /**
46 * UI pref change handler. 59 * UI pref change handler.
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 * Changes the network carrier. 498 * Changes the network carrier.
486 */ 499 */
487 DetailsInternetPage.handleCarrierChanged = function() { 500 DetailsInternetPage.handleCarrierChanged = function() {
488 var carrierSelector = $('select-carrier'); 501 var carrierSelector = $('select-carrier');
489 var carrier = carrierSelector[carrierSelector.selectedIndex].textContent; 502 var carrier = carrierSelector[carrierSelector.selectedIndex].textContent;
490 DetailsInternetPage.showCarrierChangeSpinner(true); 503 DetailsInternetPage.showCarrierChangeSpinner(true);
491 var data = $('connection-state').data; 504 var data = $('connection-state').data;
492 chrome.send('setCarrier', [data.servicePath, carrier]); 505 chrome.send('setCarrier', [data.servicePath, carrier]);
493 }; 506 };
494 507
495
496 /** 508 /**
497 * Performs minimal initialization of the InternetDetails dialog in 509 * Performs minimal initialization of the InternetDetails dialog in
498 * preparation for showing proxy-setttings. 510 * preparation for showing proxy-setttings.
499 */ 511 */
500 DetailsInternetPage.initializeProxySettings = function() { 512 DetailsInternetPage.initializeProxySettings = function() {
501 var detailsPage = DetailsInternetPage.getInstance(); 513 var detailsPage = DetailsInternetPage.getInstance();
502 detailsPage.initializePageContents_(); 514 detailsPage.initializePageContents_();
503 }; 515 };
504 516
505 /** 517 /**
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 userDns.removeAttribute('selected'); 687 userDns.removeAttribute('selected');
676 break; 688 break;
677 case 'user': 689 case 'user':
678 automaticDns.removeAttribute('selected'); 690 automaticDns.removeAttribute('selected');
679 googleDns.removeAttribute('selected'); 691 googleDns.removeAttribute('selected');
680 userDns.setAttribute('selected', ''); 692 userDns.setAttribute('selected', '');
681 break; 693 break;
682 } 694 }
683 }; 695 };
684 696
697 DetailsInternetPage.updateConnectionData = function(update) {
698 var detailsPage = DetailsInternetPage.getInstance();
699 if (!detailsPage.visible)
700 return;
701
702 var data = $('connection-state').data;
703 if (!data)
704 return;
705
706 // Update our cached data object.
707 updateDataObject(data, update);
708
709 detailsPage.deviceConnected = data.deviceConnected;
710 detailsPage.connecting = data.connecting;
711 detailsPage.connected = data.connected;
712 $('connection-state').textContent = data.connectionState;
713
714 $('details-internet-login').hidden = data.connected;
715 $('details-internet-login').disabled = data.disableConnectButton;
716
717 if (data.type == Constants.TYPE_WIFI) {
718 $('wifi-connection-state').textContent = data.connectionState;
719 } else if (data.type == Constants.TYPE_WIMAX) {
720 $('wimax-connection-state').textContent = data.connectionState;
721 } else if (data.type == Constants.TYPE_CELLULAR) {
722 $('activation-state').textContent = data.activationState;
723
724 $('buyplan-details').hidden = !data.showBuyButton;
725 $('view-account-details').hidden = !data.showViewAccountButton;
726
727 $('activate-details').hidden = !data.showActivateButton;
728 if (data.showActivateButton)
729 $('details-internet-login').hidden = true;
730 }
731
732 if (data.type != Constants.TYPE_ETHERNET)
733 $('details-internet-disconnect').hidden = !data.connected;
734
735 $('connection-state').data = data;
736 }
737
685 DetailsInternetPage.showDetailedInfo = function(data) { 738 DetailsInternetPage.showDetailedInfo = function(data) {
686 var detailsPage = DetailsInternetPage.getInstance(); 739 var detailsPage = DetailsInternetPage.getInstance();
687 740
688 // Populate header 741 // Populate header
689 $('network-details-title').textContent = data.networkName; 742 $('network-details-title').textContent = data.networkName;
690 var statusKey = data.connected ? 'networkConnected' : 743 var statusKey = data.connected ? 'networkConnected' :
691 'networkNotConnected'; 744 'networkNotConnected';
692 $('network-details-subtitle-status').textContent = 745 $('network-details-subtitle-status').textContent =
693 loadTimeData.getString(statusKey); 746 loadTimeData.getString(statusKey);
694 var typeKey = null; 747 var typeKey = null;
(...skipping 26 matching lines...) Expand all
721 } 774 }
722 775
723 // TODO(chocobo): Is this hack to cache the data here reasonable? 776 // TODO(chocobo): Is this hack to cache the data here reasonable?
724 // TODO(kevers): Find more appropriate place to cache data. 777 // TODO(kevers): Find more appropriate place to cache data.
725 $('connection-state').data = data; 778 $('connection-state').data = data;
726 779
727 $('buyplan-details').hidden = true; 780 $('buyplan-details').hidden = true;
728 $('activate-details').hidden = true; 781 $('activate-details').hidden = true;
729 $('view-account-details').hidden = true; 782 $('view-account-details').hidden = true;
730 $('details-internet-login').hidden = data.connected; 783 $('details-internet-login').hidden = data.connected;
784 $('details-internet-login').disabled = data.disableConnectButton;
731 if (data.type == Constants.TYPE_ETHERNET) 785 if (data.type == Constants.TYPE_ETHERNET)
732 $('details-internet-disconnect').hidden = true; 786 $('details-internet-disconnect').hidden = true;
733 else 787 else
734 $('details-internet-disconnect').hidden = !data.connected; 788 $('details-internet-disconnect').hidden = !data.connected;
735 789
736 detailsPage.deviceConnected = data.deviceConnected; 790 detailsPage.deviceConnected = data.deviceConnected;
737 detailsPage.connecting = data.connecting; 791 detailsPage.connecting = data.connecting;
738 detailsPage.connected = data.connected; 792 detailsPage.connected = data.connected;
739 detailsPage.showProxy = data.showProxy; 793 detailsPage.showProxy = data.showProxy;
740 detailsPage.showStaticIPConfig = data.showStaticIPConfig; 794 detailsPage.showStaticIPConfig = data.showStaticIPConfig;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 1105
1052 // Don't show page name in address bar and in history to prevent people 1106 // Don't show page name in address bar and in history to prevent people
1053 // navigate here by hand and solve issue with page session restore. 1107 // navigate here by hand and solve issue with page session restore.
1054 OptionsPage.showPageByName('detailsInternetPage', false); 1108 OptionsPage.showPageByName('detailsInternetPage', false);
1055 }; 1109 };
1056 1110
1057 return { 1111 return {
1058 DetailsInternetPage: DetailsInternetPage 1112 DetailsInternetPage: DetailsInternetPage
1059 }; 1113 };
1060 }); 1114 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/chromeos/internet_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698