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

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 hotword service 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
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 (model_urls[default_index]->HasGoogleBaseURLs(
1209 template_url_service_->search_terms_data())) {
Dan Beam 2014/12/04 20:44:07 looks confusingly like it's inside the conditional
rpetterson 2014/12/04 23:20:29 Done.
1210 // If the user has chosen Google as the default search provider, make
1211 // hotwording as an option available again.
1212 HandleRequestHotwordAvailable(nullptr);
Dan Beam 2014/12/04 20:44:07 how does the hotword section get unhidden?
rpetterson 2014/12/04 23:20:29 That function -- HandleRequestHotwordAvailable --
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.hideHotwordSection");
1217 HotwordService* hotword_service =
1218 HotwordServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
Dan Beam 2014/12/04 20:44:07 4\s indent on continuations
rpetterson 2014/12/04 23:20:28 Argh. Thank you. I have to figure out a way to get
1219 if (hotword_service)
Dan Beam 2014/12/04 20:44:07 how often is |hotword_service| null here?
rpetterson 2014/12/04 23:20:29 Mostly in some tests but also any platform/situati
1220 hotword_service->DisableHotwordPreferences();
1221 }
1222
1208 SetupExtensionControlledIndicators(); 1223 SetupExtensionControlledIndicators();
1209 } 1224 }
1210 1225
1211 void BrowserOptionsHandler::SetDefaultSearchEngine( 1226 void BrowserOptionsHandler::SetDefaultSearchEngine(
1212 const base::ListValue* args) { 1227 const base::ListValue* args) {
1213 int selected_index = -1; 1228 int selected_index = -1;
1214 if (!ExtractIntegerValue(args, &selected_index)) { 1229 if (!ExtractIntegerValue(args, &selected_index)) {
1215 NOTREACHED(); 1230 NOTREACHED();
1216 return; 1231 return;
1217 } 1232 }
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, 2065 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns,
2051 const policy::PolicyMap& previous, 2066 const policy::PolicyMap& previous,
2052 const policy::PolicyMap& current) { 2067 const policy::PolicyMap& current) {
2053 std::set<std::string> different_keys; 2068 std::set<std::string> different_keys;
2054 current.GetDifferingKeys(previous, &different_keys); 2069 current.GetDifferingKeys(previous, &different_keys);
2055 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) 2070 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled))
2056 SetupMetricsReportingCheckbox(); 2071 SetupMetricsReportingCheckbox();
2057 } 2072 }
2058 2073
2059 } // namespace options 2074 } // namespace options
OLDNEW
« chrome/browser/search/hotword_service.cc ('K') | « chrome/browser/search/hotword_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698