| OLD | NEW |
| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // Google Now cards in the launcher | 69 // Google Now cards in the launcher |
| 70 cr.addWebUIListener( | 70 cr.addWebUIListener( |
| 71 'google-now-availability-changed', | 71 'google-now-availability-changed', |
| 72 this.googleNowAvailabilityUpdate_.bind(this)); | 72 this.googleNowAvailabilityUpdate_.bind(this)); |
| 73 this.browserProxy_.getGoogleNowAvailability().then(function(available) { | 73 this.browserProxy_.getGoogleNowAvailability().then(function(available) { |
| 74 this.googleNowAvailabilityUpdate_(available); | 74 this.googleNowAvailabilityUpdate_(available); |
| 75 }.bind(this)); | 75 }.bind(this)); |
| 76 | 76 |
| 77 this.focusConfig_ = new Map(); | 77 this.focusConfig_ = new Map(); |
| 78 this.focusConfig_.set( | 78 if (settings.routes.SEARCH_ENGINES) { |
| 79 settings.Route.SEARCH_ENGINES.path, '#subpage-trigger .subpage-arrow'); | 79 this.focusConfig_.set( |
| 80 settings.routes.SEARCH_ENGINES.path, |
| 81 '#subpage-trigger .subpage-arrow'); |
| 82 } |
| 80 }, | 83 }, |
| 81 | 84 |
| 82 /** @private */ | 85 /** @private */ |
| 83 onChange_: function() { | 86 onChange_: function() { |
| 84 var select = /** @type {!HTMLSelectElement} */ (this.$$('select')); | 87 var select = /** @type {!HTMLSelectElement} */ (this.$$('select')); |
| 85 var searchEngine = this.searchEngines_[select.selectedIndex]; | 88 var searchEngine = this.searchEngines_[select.selectedIndex]; |
| 86 this.browserProxy_.setDefaultSearchEngine(searchEngine.modelIndex); | 89 this.browserProxy_.setDefaultSearchEngine(searchEngine.modelIndex); |
| 87 }, | 90 }, |
| 88 | 91 |
| 89 /** @private */ | 92 /** @private */ |
| 90 onDisableExtension_: function() { | 93 onDisableExtension_: function() { |
| 91 this.fire('refresh-pref', 'default_search_provider.enabled'); | 94 this.fire('refresh-pref', 'default_search_provider.enabled'); |
| 92 }, | 95 }, |
| 93 | 96 |
| 94 /** @private */ | 97 /** @private */ |
| 95 onManageSearchEnginesTap_: function() { | 98 onManageSearchEnginesTap_: function() { |
| 96 settings.navigateTo(settings.Route.SEARCH_ENGINES); | 99 settings.navigateTo(settings.routes.SEARCH_ENGINES); |
| 97 }, | 100 }, |
| 98 | 101 |
| 99 /** | 102 /** |
| 100 * @param {!Event} event | 103 * @param {!Event} event |
| 101 * @private | 104 * @private |
| 102 */ | 105 */ |
| 103 onHotwordSearchEnableChange_: function(event) { | 106 onHotwordSearchEnableChange_: function(event) { |
| 104 // Do not set the pref directly, allow Chrome to run the setup app instead. | 107 // Do not set the pref directly, allow Chrome to run the setup app instead. |
| 105 this.browserProxy_.setHotwordSearchEnabled( | 108 this.browserProxy_.setHotwordSearchEnabled( |
| 106 !!this.hotwordSearchEnablePref_.value); | 109 !!this.hotwordSearchEnablePref_.value); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 188 |
| 186 /** | 189 /** |
| 187 * @param {!chrome.settingsPrivate.PrefObject} pref | 190 * @param {!chrome.settingsPrivate.PrefObject} pref |
| 188 * @return {boolean} | 191 * @return {boolean} |
| 189 * @private | 192 * @private |
| 190 */ | 193 */ |
| 191 isDefaultSearchEngineEnforced_: function(pref) { | 194 isDefaultSearchEngineEnforced_: function(pref) { |
| 192 return pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; | 195 return pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; |
| 193 }, | 196 }, |
| 194 }); | 197 }); |
| OLD | NEW |