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

Side by Side Diff: chrome/browser/resources/settings/search_page/search_page.js

Issue 2805363002: MD Settings: Add mechanism to restore focus after subpage exiting. (Closed)
Patch Set: Address @dbeam comments. 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-search-page' is the settings page containing search settings. 7 * 'settings-search-page' is the settings page containing search settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-search-page', 10 is: 'settings-search-page',
(...skipping 21 matching lines...) Expand all
32 * This is a local PrefObject used to reflect the enabled state of hotword 32 * This is a local PrefObject used to reflect the enabled state of hotword
33 * search. It is not tied directly to a pref. (There are two prefs 33 * search. It is not tied directly to a pref. (There are two prefs
34 * associated with state and they do not map directly to whether or not 34 * associated with state and they do not map directly to whether or not
35 * hotword search is actually enabled). 35 * hotword search is actually enabled).
36 * @private {!chrome.settingsPrivate.PrefObject|undefined} 36 * @private {!chrome.settingsPrivate.PrefObject|undefined}
37 */ 37 */
38 hotwordSearchEnablePref_: Object, 38 hotwordSearchEnablePref_: Object,
39 39
40 /** @private */ 40 /** @private */
41 googleNowAvailable_: Boolean, 41 googleNowAvailable_: Boolean,
42
43 /** @type {?Map<string, string>} */
44 focusConfig_: Object,
42 }, 45 },
43 46
44 /** @private {?settings.SearchEnginesBrowserProxy} */ 47 /** @private {?settings.SearchEnginesBrowserProxy} */
45 browserProxy_: null, 48 browserProxy_: null,
46 49
47 /** @override */ 50 /** @override */
48 created: function() { 51 created: function() {
49 this.browserProxy_ = settings.SearchEnginesBrowserProxyImpl.getInstance(); 52 this.browserProxy_ = settings.SearchEnginesBrowserProxyImpl.getInstance();
50 }, 53 },
51 54
(...skipping 11 matching lines...) Expand all
63 cr.addWebUIListener( 66 cr.addWebUIListener(
64 'hotword-info-update', this.hotwordInfoUpdate_.bind(this)); 67 'hotword-info-update', this.hotwordInfoUpdate_.bind(this));
65 68
66 // Google Now cards in the launcher 69 // Google Now cards in the launcher
67 cr.addWebUIListener( 70 cr.addWebUIListener(
68 'google-now-availability-changed', 71 'google-now-availability-changed',
69 this.googleNowAvailabilityUpdate_.bind(this)); 72 this.googleNowAvailabilityUpdate_.bind(this));
70 this.browserProxy_.getGoogleNowAvailability().then(function(available) { 73 this.browserProxy_.getGoogleNowAvailability().then(function(available) {
71 this.googleNowAvailabilityUpdate_(available); 74 this.googleNowAvailabilityUpdate_(available);
72 }.bind(this)); 75 }.bind(this));
76
77 this.focusConfig_ = new Map();
78 this.focusConfig_.set(
79 settings.Route.SEARCH_ENGINES.path, '#subpage-trigger .subpage-arrow');
73 }, 80 },
74 81
75 /** @private */ 82 /** @private */
76 onChange_: function() { 83 onChange_: function() {
77 var select = /** @type {!HTMLSelectElement} */ (this.$$('select')); 84 var select = /** @type {!HTMLSelectElement} */ (this.$$('select'));
78 var searchEngine = this.searchEngines_[select.selectedIndex]; 85 var searchEngine = this.searchEngines_[select.selectedIndex];
79 this.browserProxy_.setDefaultSearchEngine(searchEngine.modelIndex); 86 this.browserProxy_.setDefaultSearchEngine(searchEngine.modelIndex);
80 }, 87 },
81 88
82 /** @private */ 89 /** @private */
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 }, 172 },
166 173
167 /** 174 /**
168 * @param {Event} event 175 * @param {Event} event
169 * @private 176 * @private
170 */ 177 */
171 doNothing_: function(event) { 178 doNothing_: function(event) {
172 event.stopPropagation(); 179 event.stopPropagation();
173 } 180 }
174 }); 181 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698