OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 } | 1198 } |
1199 | 1199 |
1200 web_ui()->CallJavascriptFunction( | 1200 web_ui()->CallJavascriptFunction( |
1201 "BrowserOptions.updateSearchEngines", | 1201 "BrowserOptions.updateSearchEngines", |
1202 search_engines, | 1202 search_engines, |
1203 base::FundamentalValue(default_index), | 1203 base::FundamentalValue(default_index), |
1204 base::FundamentalValue( | 1204 base::FundamentalValue( |
1205 template_url_service_->is_default_search_managed() || | 1205 template_url_service_->is_default_search_managed() || |
1206 template_url_service_->IsExtensionControlledDefaultSearch())); | 1206 template_url_service_->IsExtensionControlledDefaultSearch())); |
1207 | 1207 |
| 1208 if (default_index != -1 && model_urls[default_index]->HasGoogleBaseURLs( |
| 1209 template_url_service_->search_terms_data())) { |
| 1210 // If the user has chosen Google as the default search provider, make |
| 1211 // hotwording as an option available again. |
| 1212 HandleRequestHotwordAvailable(nullptr); |
| 1213 } else { |
| 1214 // If the user has chosen a default search provide other than Google, turn |
| 1215 // off hotwording since other providers don't provide that functionality. |
| 1216 web_ui()->CallJavascriptFunction("BrowserOptions.setHotwordSectionVisible", |
| 1217 base::FundamentalValue(false)); |
| 1218 HotwordService* hotword_service = |
| 1219 HotwordServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); |
| 1220 if (hotword_service) |
| 1221 hotword_service->DisableHotwordPreferences(); |
| 1222 } |
| 1223 |
1208 SetupExtensionControlledIndicators(); | 1224 SetupExtensionControlledIndicators(); |
1209 } | 1225 } |
1210 | 1226 |
1211 void BrowserOptionsHandler::SetDefaultSearchEngine( | 1227 void BrowserOptionsHandler::SetDefaultSearchEngine( |
1212 const base::ListValue* args) { | 1228 const base::ListValue* args) { |
1213 int selected_index = -1; | 1229 int selected_index = -1; |
1214 if (!ExtractIntegerValue(args, &selected_index)) { | 1230 if (!ExtractIntegerValue(args, &selected_index)) { |
1215 NOTREACHED(); | 1231 NOTREACHED(); |
1216 return; | 1232 return; |
1217 } | 1233 } |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, | 2066 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, |
2051 const policy::PolicyMap& previous, | 2067 const policy::PolicyMap& previous, |
2052 const policy::PolicyMap& current) { | 2068 const policy::PolicyMap& current) { |
2053 std::set<std::string> different_keys; | 2069 std::set<std::string> different_keys; |
2054 current.GetDifferingKeys(previous, &different_keys); | 2070 current.GetDifferingKeys(previous, &different_keys); |
2055 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) | 2071 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) |
2056 SetupMetricsReportingCheckbox(); | 2072 SetupMetricsReportingCheckbox(); |
2057 } | 2073 } |
2058 | 2074 |
2059 } // namespace options | 2075 } // namespace options |
OLD | NEW |