OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/voicesearch_ui.h" | 5 #include "chrome/browser/ui/webui/voicesearch_ui.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 void AddHotwordInfo(base::ListValue* list) { | 238 void AddHotwordInfo(base::ListValue* list) { |
239 std::string search_enabled = "No"; | 239 std::string search_enabled = "No"; |
240 if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled)) | 240 if (profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled)) |
241 search_enabled = "Yes"; | 241 search_enabled = "Yes"; |
242 AddPair(list, ASCIIToUTF16("Hotword Search Enabled"), | 242 AddPair(list, ASCIIToUTF16("Hotword Search Enabled"), |
243 ASCIIToUTF16(search_enabled)); | 243 ASCIIToUTF16(search_enabled)); |
244 | 244 |
245 std::string audio_logging_enabled = "No"; | 245 std::string audio_logging_enabled = "No"; |
246 HotwordService* hotword_service = | 246 HotwordService* hotword_service = |
247 HotwordServiceFactory::GetForProfile(profile_); | 247 HotwordServiceFactory::GetForProfile(profile_); |
248 if (hotword_service->IsOptedIntoAudioLogging()) | 248 if (hotword_service && hotword_service->IsOptedIntoAudioLogging()) |
249 audio_logging_enabled = "Yes"; | 249 audio_logging_enabled = "Yes"; |
250 AddPair(list, ASCIIToUTF16("Hotword Audio Logging Enabled"), | 250 AddPair(list, ASCIIToUTF16("Hotword Audio Logging Enabled"), |
251 ASCIIToUTF16(audio_logging_enabled)); | 251 ASCIIToUTF16(audio_logging_enabled)); |
252 | 252 |
253 std::string group = base::FieldTrialList::FindFullName( | 253 std::string group = base::FieldTrialList::FindFullName( |
254 hotword_internal::kHotwordFieldTrialName); | 254 hotword_internal::kHotwordFieldTrialName); |
255 AddPair(list, ASCIIToUTF16("Field trial"), ASCIIToUTF16(group)); | 255 AddPair(list, ASCIIToUTF16("Field trial"), ASCIIToUTF16(group)); |
256 | 256 |
257 AddLineBreak(list); | 257 AddLineBreak(list); |
258 } | 258 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) | 364 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) |
365 : content::WebUIController(web_ui) { | 365 : content::WebUIController(web_ui) { |
366 Profile* profile = Profile::FromWebUI(web_ui); | 366 Profile* profile = Profile::FromWebUI(web_ui); |
367 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); | 367 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); |
368 | 368 |
369 // Set up the about:voicesearch source. | 369 // Set up the about:voicesearch source. |
370 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); | 370 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); |
371 } | 371 } |
372 | 372 |
373 VoiceSearchUI::~VoiceSearchUI() {} | 373 VoiceSearchUI::~VoiceSearchUI() {} |
OLD | NEW |