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

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 780703004: [Hotword] Ok Google options disappear if search provider is changed from (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: check for no default url Created 6 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
« no previous file with comments | « chrome/browser/search/hotword_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/search/hotword_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698