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

Side by Side Diff: chrome/browser/resources/settings/internet_page/internet_detail_page.js

Issue 2817613002: MD Settings: Internet: IP Settings: Only set to static on change (Closed)
Patch Set: Feedback / elim dead code Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 6 * @fileoverview
7 * 'settings-internet-detail' is the settings subpage containing details 7 * 'settings-internet-detail' is the settings subpage containing details
8 * for a network. 8 * for a network.
9 */ 9 */
10 (function() { 10 (function() {
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 var field = event.detail.field; 679 var field = event.detail.field;
680 var value = event.detail.value; 680 var value = event.detail.value;
681 if (field != 'ProxySettings') 681 if (field != 'ProxySettings')
682 return; 682 return;
683 var onc = this.getEmptyNetworkProperties_(); 683 var onc = this.getEmptyNetworkProperties_();
684 CrOnc.setProperty(onc, 'ProxySettings', /** @type {!Object} */ (value)); 684 CrOnc.setProperty(onc, 'ProxySettings', /** @type {!Object} */ (value));
685 this.setNetworkProperties_(onc); 685 this.setNetworkProperties_(onc);
686 }, 686 },
687 687
688 /** 688 /**
689 * @param {!CrOnc.NetworkProperties} networkProperties
689 * @return {boolean} True if the shared message should be shown. 690 * @return {boolean} True if the shared message should be shown.
690 * @private 691 * @private
691 */ 692 */
692 showShared_: function() { 693 showShared_: function(networkProperties) {
693 return this.networkProperties.Source == 'Device' || 694 return networkProperties.Source == 'Device' ||
694 this.networkProperties.Source == 'DevicePolicy'; 695 networkProperties.Source == 'DevicePolicy';
695 }, 696 },
696 697
697 /** 698 /**
698 * @param {!CrOnc.NetworkProperties} networkProperties 699 * @param {!CrOnc.NetworkProperties} networkProperties
699 * @return {boolean} True if the AutoConnect checkbox should be shown. 700 * @return {boolean} True if the AutoConnect checkbox should be shown.
700 * @private 701 * @private
701 */ 702 */
702 showAutoConnect_: function(networkProperties) { 703 showAutoConnect_: function(networkProperties) {
703 return this.networkProperties.Type != CrOnc.Type.ETHERNET && 704 return networkProperties.Type != CrOnc.Type.ETHERNET &&
704 this.isRemembered_(networkProperties); 705 this.isRemembered_(networkProperties);
705 }, 706 },
706 707
707 /** 708 /**
708 * @param {!CrOnc.NetworkProperties} networkProperties 709 * @param {!CrOnc.NetworkProperties} networkProperties
709 * @param {!chrome.networkingPrivate.GlobalPolicy} globalPolicy 710 * @param {!chrome.networkingPrivate.GlobalPolicy} globalPolicy
710 * @return {boolean} 711 * @return {boolean}
711 * @private 712 * @private
712 */ 713 */
713 enableAutoConnect_: function(networkProperties, globalPolicy) { 714 enableAutoConnect_: function(networkProperties, globalPolicy) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 hasNetworkSection_: function(networkProperties) { 875 hasNetworkSection_: function(networkProperties) {
875 if (networkProperties.Type == CrOnc.Type.VPN) 876 if (networkProperties.Type == CrOnc.Type.VPN)
876 return false; 877 return false;
877 if (networkProperties.Type == CrOnc.Type.CELLULAR) 878 if (networkProperties.Type == CrOnc.Type.CELLULAR)
878 return true; 879 return true;
879 return this.isRememberedOrConnected_(networkProperties); 880 return this.isRememberedOrConnected_(networkProperties);
880 }, 881 },
881 882
882 /** 883 /**
883 * @param {string} type The network type. 884 * @param {string} type The network type.
885 * @param {!CrOnc.NetworkProperties} networkProperties
884 * @return {boolean} True if the network type matches 'type'. 886 * @return {boolean} True if the network type matches 'type'.
885 * @private 887 * @private
886 */ 888 */
887 isType_: function(type) { 889 isType_: function(type, networkProperties) {
888 return this.networkProperties.Type == type; 890 return networkProperties.Type == type;
889 }, 891 },
890 892
891 /** 893 /**
892 * @return {boolean} True if the Cellular SIM section should be shown. 894 * @param {!CrOnc.NetworkProperties} networkProperties
895 * @return {boolean}
893 * @private 896 * @private
894 */ 897 */
895 showCellularSim_: function() { 898 showCellularSim_: function(networkProperties) {
896 if (this.networkProperties.Type != 'Cellular' || 899 if (networkProperties.Type != 'Cellular' ||
897 !this.networkProperties.Cellular) { 900 !networkProperties.Cellular) {
898 return false; 901 return false;
899 } 902 }
900 return this.networkProperties.Cellular.Family == 'GSM'; 903 return networkProperties.Cellular.Family == 'GSM';
901 }, 904 },
902 905
903 /** 906 /**
907 * @param {!CrOnc.NetworkProperties} networkProperties
908 * @return {boolean}
909 * @private
910 */
911 showIpConfig_: function(networkProperties) {
912 if (!this.isRememberedOrConnected_(networkProperties))
913 return false;
914 return !!networkProperties.IPAddressConfigType;
915 },
916
917 /**
904 * @param {!Object} curValue 918 * @param {!Object} curValue
905 * @param {!Object} newValue 919 * @param {!Object} newValue
906 * @return {boolean} True if all properties set in |newValue| are equal to 920 * @return {boolean} True if all properties set in |newValue| are equal to
907 * the corresponding properties in |curValue|. Note: Not all properties 921 * the corresponding properties in |curValue|. Note: Not all properties
908 * of |curValue| need to be specified in |newValue| for this to return 922 * of |curValue| need to be specified in |newValue| for this to return
909 * true. 923 * true.
910 * @private 924 * @private
911 */ 925 */
912 allPropertiesMatch_: function(curValue, newValue) { 926 allPropertiesMatch_: function(curValue, newValue) {
913 for (var key in newValue) { 927 for (var key in newValue) {
914 if (newValue[key] != curValue[key]) 928 if (newValue[key] != curValue[key])
915 return false; 929 return false;
916 } 930 }
917 return true; 931 return true;
918 } 932 }
919 }); 933 });
920 })(); 934 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698