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

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

Issue 2841873004: MD Settings: Fix subpage navigation focus for bluetooth+internet (Closed)
Patch Set: Fix browser tests Created 3 years, 7 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }, 137 },
138 }, 138 },
139 139
140 /** 140 /**
141 * Listener function for chrome.networkingPrivate.onNetworksChanged event. 141 * Listener function for chrome.networkingPrivate.onNetworksChanged event.
142 * @type {?function(!Array<string>)} 142 * @type {?function(!Array<string>)}
143 * @private 143 * @private
144 */ 144 */
145 networksChangedListener_: null, 145 networksChangedListener_: null,
146 146
147 /** @private {boolean} */
148 didSetFocus_: false,
149
147 /** 150 /**
148 * settings.RouteObserverBehavior 151 * settings.RouteObserverBehavior
149 * @param {!settings.Route} route 152 * @param {!settings.Route} route
150 * @protected 153 * @protected
151 */ 154 */
152 currentRouteChanged: function(route) { 155 currentRouteChanged: function(route) {
153 if (route != settings.Route.NETWORK_DETAIL) { 156 if (route != settings.Route.NETWORK_DETAIL) {
154 if (this.networksChangedListener_) { 157 if (this.networksChangedListener_) {
155 this.networkingPrivate.onNetworksChanged.removeListener( 158 this.networkingPrivate.onNetworksChanged.removeListener(
156 this.networksChangedListener_); 159 this.networksChangedListener_);
(...skipping 16 matching lines...) Expand all
173 var type = /** @type {!chrome.networkingPrivate.NetworkType} */ ( 176 var type = /** @type {!chrome.networkingPrivate.NetworkType} */ (
174 queryParams.get('type')) || 177 queryParams.get('type')) ||
175 CrOnc.Type.WI_FI; 178 CrOnc.Type.WI_FI;
176 var name = queryParams.get('name') || type; 179 var name = queryParams.get('name') || type;
177 this.networkProperties = { 180 this.networkProperties = {
178 GUID: this.guid, 181 GUID: this.guid,
179 Type: type, 182 Type: type,
180 ConnectionState: CrOnc.ConnectionState.NOT_CONNECTED, 183 ConnectionState: CrOnc.ConnectionState.NOT_CONNECTED,
181 Name: {Active: name}, 184 Name: {Active: name},
182 }; 185 };
186 this.didSetFocus_ = false;
183 this.getNetworkDetails_(); 187 this.getNetworkDetails_();
184 }, 188 },
185 189
186 /** @private */ 190 /** @private */
187 close_: function() { 191 close_: function() {
188 // Delay navigating until the next render frame to allow other subpages to 192 // Delay navigating until the next render frame to allow other subpages to
189 // load first. 193 // load first.
190 setTimeout(function() { 194 setTimeout(function() {
191 settings.navigateTo(settings.Route.INTERNET); 195 settings.navigateTo(settings.Route.INTERNET);
192 }); 196 });
(...skipping 16 matching lines...) Expand all
209 if (preferNetwork != this.preferNetwork_) 213 if (preferNetwork != this.preferNetwork_)
210 this.preferNetwork_ = preferNetwork; 214 this.preferNetwork_ = preferNetwork;
211 215
212 // Set the IPAddress property to the IPV4 Address. 216 // Set the IPAddress property to the IPV4 Address.
213 var ipv4 = 217 var ipv4 =
214 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); 218 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4);
215 this.IPAddress_ = (ipv4 && ipv4.IPAddress) || ''; 219 this.IPAddress_ = (ipv4 && ipv4.IPAddress) || '';
216 220
217 // Update the detail page title. 221 // Update the detail page title.
218 this.parentNode.pageTitle = CrOnc.getNetworkName(this.networkProperties); 222 this.parentNode.pageTitle = CrOnc.getNetworkName(this.networkProperties);
223
224 // Focus a button once the initial state is set.
225 if (!this.didSetFocus_) {
226 this.didSetFocus_ = true;
227 var button = this.$$('#buttonDiv .primary-button:not([hidden])');
228 if (!button)
229 button = this.$$('#buttonDiv .secondary-button:not([hidden])');
230 assert(button); // At least one button will always be visible.
231 button.focus();
232 }
219 }, 233 },
220 234
221 /** @private */ 235 /** @private */
222 autoConnectChanged_: function() { 236 autoConnectChanged_: function() {
223 if (!this.networkProperties || !this.guid) 237 if (!this.networkProperties || !this.guid)
224 return; 238 return;
225 var onc = this.getEmptyNetworkProperties_(); 239 var onc = this.getEmptyNetworkProperties_();
226 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_); 240 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_);
227 this.setNetworkProperties_(onc); 241 this.setNetworkProperties_(onc);
228 }, 242 },
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 onConfigureTap_: function() { 556 onConfigureTap_: function() {
543 chrome.send('configureNetwork', [this.guid]); 557 chrome.send('configureNetwork', [this.guid]);
544 }, 558 },
545 559
546 /** @private */ 560 /** @private */
547 onViewAccountTap_: function() { 561 onViewAccountTap_: function() {
548 // startActivate() will show the account page for activated networks. 562 // startActivate() will show the account page for activated networks.
549 this.networkingPrivate.startActivate(this.guid); 563 this.networkingPrivate.startActivate(this.guid);
550 }, 564 },
551 565
552 /** @const {string} */ CR_EXPAND_BUTTON_TAG: 'CR-EXPAND-BUTTON', 566 /** @const {string} */
567 CR_EXPAND_BUTTON_TAG: 'CR-EXPAND-BUTTON',
553 568
554 /** 569 /**
555 * @param {Event} event 570 * @param {Event} event
556 * @private 571 * @private
557 */ 572 */
558 toggleAdvancedExpanded_: function(event) { 573 toggleAdvancedExpanded_: function(event) {
559 if (event.target.tagName == this.CR_EXPAND_BUTTON_TAG) 574 if (event.target.tagName == this.CR_EXPAND_BUTTON_TAG)
560 return; // Already handled. 575 return; // Already handled.
561 this.advancedExpanded_ = !this.advancedExpanded_; 576 this.advancedExpanded_ = !this.advancedExpanded_;
562 }, 577 },
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 */ 952 */
938 allPropertiesMatch_: function(curValue, newValue) { 953 allPropertiesMatch_: function(curValue, newValue) {
939 for (var key in newValue) { 954 for (var key in newValue) {
940 if (newValue[key] != curValue[key]) 955 if (newValue[key] != curValue[key])
941 return false; 956 return false;
942 } 957 }
943 return true; 958 return true;
944 } 959 }
945 }); 960 });
946 })(); 961 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698