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

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

Issue 8937011: Revert "Options2: Pull the trigger." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('options.internet', function() {
6 var OptionsPage = options.OptionsPage;
7
8 /*
9 * Helper function to set hidden attribute on given element list.
10 * @param {Array} elements List of elements to be updated.
11 * @param {bool} hidden New hidden value.
12 */
13 function updateHidden(elements, hidden) {
14 for (var i = 0, el; el = elements[i]; i++) {
15 el.hidden = hidden;
16 }
17 }
18
19 /////////////////////////////////////////////////////////////////////////////
20 // DetailsInternetPage class:
21
22 /**
23 * Encapsulated handling of ChromeOS internet details overlay page.
24 * @constructor
25 */
26 function DetailsInternetPage() {
27 OptionsPage.call(this, 'detailsInternetPage', null, 'detailsInternetPage');
28 }
29
30 cr.addSingletonGetter(DetailsInternetPage);
31
32 DetailsInternetPage.prototype = {
33 __proto__: OptionsPage.prototype,
34
35 /**
36 * Initializes DetailsInternetPage page.
37 * Calls base class implementation to starts preference initialization.
38 */
39 initializePage: function() {
40 OptionsPage.prototype.initializePage.call(this);
41 },
42
43 /**
44 * Update details page controls.
45 * @private
46 */
47 updateControls_: function() {
48 // Only show ipconfig section if network is connected OR if nothing on
49 // this device is connected. This is so that you can fix the ip configs
50 // if you can't connect to any network.
51 // TODO(chocobo): Once ipconfig is moved to flimflam service objects,
52 // we need to redo this logic to allow configuration of all networks.
53 $('ipconfigSection').hidden = !this.connected && this.deviceConnected;
54
55 // Network type related.
56 updateHidden(
57 cr.doc.querySelectorAll('#detailsInternetPage .cellular-details'),
58 !this.cellular);
59 updateHidden(
60 cr.doc.querySelectorAll('#detailsInternetPage .wifi-details'),
61 !this.wireless);
62 updateHidden(
63 cr.doc.querySelectorAll('#detailsInternetPage .vpn-details'),
64 !this.vpn);
65
66 // Cell plan related.
67 $('planList').hidden = this.cellplanloading;
68 updateHidden(
69 cr.doc.querySelectorAll('#detailsInternetPage .no-plan-info'),
70 !this.cellular || this.cellplanloading || this.hascellplan);
71 updateHidden(
72 cr.doc.querySelectorAll('#detailsInternetPage .plan-loading-info'),
73 !this.cellular || this.nocellplan || this.hascellplan);
74 updateHidden(
75 cr.doc.querySelectorAll('#detailsInternetPage .plan-details-info'),
76 !this.cellular || this.nocellplan || this.cellplanloading);
77 updateHidden(
78 cr.doc.querySelectorAll('#detailsInternetPage .gsm-only'),
79 !this.cellular || !this.gsm);
80 updateHidden(
81 cr.doc.querySelectorAll('#detailsInternetPage .cdma-only'),
82 !this.cellular || this.gsm);
83 updateHidden(
84 cr.doc.querySelectorAll('#detailsInternetPage .apn-list-view'),
85 !this.cellular || !this.gsm);
86 updateHidden(
87 cr.doc.querySelectorAll('#detailsInternetPage .apn-details-view'),
88 true);
89
90 // Password and shared.
91 updateHidden(
92 cr.doc.querySelectorAll('#detailsInternetPage .password-details'),
93 !this.wireless || !this.password);
94 updateHidden(
95 cr.doc.querySelectorAll('#detailsInternetPage .shared-network'),
96 !this.shared);
97 updateHidden(
98 cr.doc.querySelectorAll('#detailsInternetPage .prefer-network'),
99 !this.showPreferred);
100 }
101 };
102
103 /**
104 * Whether the underlying network is connected. Only used for display purpose.
105 * @type {boolean}
106 */
107 cr.defineProperty(DetailsInternetPage, 'connected',
108 cr.PropertyKind.JS,
109 DetailsInternetPage.prototype.updateControls_);
110
111 /**
112 * Whether the underlying network is wifi. Only used for display purpose.
113 * @type {boolean}
114 */
115 cr.defineProperty(DetailsInternetPage, 'wireless',
116 cr.PropertyKind.JS,
117 DetailsInternetPage.prototype.updateControls_);
118
119 /**
120 * Whether the underlying network shared wifi. Only used for display purpose.
121 * @type {boolean}
122 */
123 cr.defineProperty(DetailsInternetPage, 'shared',
124 cr.PropertyKind.JS,
125 DetailsInternetPage.prototype.updateControls_);
126
127 /**
128 * Whether the underlying network is a vpn. Only used for display purpose.
129 * @type {boolean}
130 */
131 cr.defineProperty(DetailsInternetPage, 'vpn',
132 cr.PropertyKind.JS,
133 DetailsInternetPage.prototype.updateControls_);
134
135 /**
136 * Whether the underlying network is ethernet. Only used for display purpose.
137 * @type {boolean}
138 */
139 cr.defineProperty(DetailsInternetPage, 'ethernet',
140 cr.PropertyKind.JS,
141 DetailsInternetPage.prototype.updateControls_);
142
143 /**
144 * Whether the underlying network is cellular. Only used for display purpose.
145 * @type {boolean}
146 */
147 cr.defineProperty(DetailsInternetPage, 'cellular',
148 cr.PropertyKind.JS,
149 DetailsInternetPage.prototype.updateControls_);
150
151 /**
152 * Whether the network is loading cell plan. Only used for display purpose.
153 * @type {boolean}
154 */
155 cr.defineProperty(DetailsInternetPage, 'cellplanloading',
156 cr.PropertyKind.JS,
157 DetailsInternetPage.prototype.updateControls_);
158
159 /**
160 * Whether the network has cell plan(s). Only used for display purpose.
161 * @type {boolean}
162 */
163 cr.defineProperty(DetailsInternetPage, 'hascellplan',
164 cr.PropertyKind.JS,
165 DetailsInternetPage.prototype.updateControls_);
166
167 /**
168 * Whether the network has no cell plan. Only used for display purpose.
169 * @type {boolean}
170 */
171 cr.defineProperty(DetailsInternetPage, 'nocellplan',
172 cr.PropertyKind.JS,
173 DetailsInternetPage.prototype.updateControls_);
174
175 /**
176 * Whether the network is gsm. Only used for display purpose.
177 * @type {boolean}
178 */
179 cr.defineProperty(DetailsInternetPage, 'gsm',
180 cr.PropertyKind.JS,
181 DetailsInternetPage.prototype.updateControls_);
182
183 /**
184 * Whether show password details for network. Only used for display purpose.
185 * @type {boolean}
186 */
187 cr.defineProperty(DetailsInternetPage, 'password',
188 cr.PropertyKind.JS,
189 DetailsInternetPage.prototype.updateControls_);
190
191 // TODO(xiyuan): Check to see if it is safe to remove these attributes.
192 cr.defineProperty(DetailsInternetPage, 'hasactiveplan',
193 cr.PropertyKind.JS);
194 cr.defineProperty(DetailsInternetPage, 'activated',
195 cr.PropertyKind.JS);
196 cr.defineProperty(DetailsInternetPage, 'connecting',
197 cr.PropertyKind.JS);
198 cr.defineProperty(DetailsInternetPage, 'connected',
199 cr.PropertyKind.JS);
200
201 return {
202 DetailsInternetPage: DetailsInternetPage
203 };
204 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698