| 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/voice_search_ui.h" | 5 #include "chrome/browser/ui/webui/voice_search_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Store Key-Value pairs of about-information. | 161 // Store Key-Value pairs of about-information. |
| 162 scoped_ptr<base::ListValue> list(new base::ListValue()); | 162 scoped_ptr<base::ListValue> list(new base::ListValue()); |
| 163 | 163 |
| 164 // Populate information. | 164 // Populate information. |
| 165 AddOperatingSystemInfo(list.get()); | 165 AddOperatingSystemInfo(list.get()); |
| 166 AddAudioInfo(list.get()); | 166 AddAudioInfo(list.get()); |
| 167 AddLanguageInfo(list.get()); | 167 AddLanguageInfo(list.get()); |
| 168 AddHotwordInfo(list.get()); | 168 AddHotwordInfo(list.get()); |
| 169 AddAppListInfo(list.get()); | 169 AddAppListInfo(list.get()); |
| 170 | 170 |
| 171 std::string extension_id = extension_misc::kHotwordExtensionId; | 171 AddExtensionInfo(extension_misc::kHotwordNewExtensionId, |
| 172 HotwordService* hotword_service = | 172 "Extension", |
| 173 HotwordServiceFactory::GetForProfile(profile_); | 173 list.get()); |
| 174 if (hotword_service && hotword_service->IsExperimentalHotwordingEnabled()) | |
| 175 extension_id = extension_misc::kHotwordNewExtensionId; | |
| 176 AddExtensionInfo(extension_id, "Extension", list.get()); | |
| 177 | 174 |
| 178 AddExtensionInfo(extension_misc::kHotwordSharedModuleId, | 175 AddExtensionInfo(extension_misc::kHotwordSharedModuleId, |
| 179 "Shared Module", | 176 "Shared Module", |
| 180 list.get()); | 177 list.get()); |
| 181 | 178 |
| 182 base::FilePath path; | 179 base::FilePath path; |
| 183 extensions::ExtensionSystem* extension_system = | 180 extensions::ExtensionSystem* extension_system = |
| 184 extensions::ExtensionSystem::Get(profile_); | 181 extensions::ExtensionSystem::Get(profile_); |
| 185 if (extension_system) { | 182 if (extension_system) { |
| 186 ExtensionService* extension_service = | 183 ExtensionService* extension_service = |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 HotwordService* hotword_service = | 316 HotwordService* hotword_service = |
| 320 HotwordServiceFactory::GetForProfile(profile_); | 317 HotwordServiceFactory::GetForProfile(profile_); |
| 321 if (hotword_service && hotword_service->IsOptedIntoAudioLogging()) | 318 if (hotword_service && hotword_service->IsOptedIntoAudioLogging()) |
| 322 audio_logging_enabled = "Yes"; | 319 audio_logging_enabled = "Yes"; |
| 323 AddPair(list, "Hotword Audio Logging Enabled", audio_logging_enabled); | 320 AddPair(list, "Hotword Audio Logging Enabled", audio_logging_enabled); |
| 324 | 321 |
| 325 std::string group = base::FieldTrialList::FindFullName( | 322 std::string group = base::FieldTrialList::FindFullName( |
| 326 hotword_internal::kHotwordFieldTrialName); | 323 hotword_internal::kHotwordFieldTrialName); |
| 327 AddPair(list, "Field trial", group); | 324 AddPair(list, "Field trial", group); |
| 328 | 325 |
| 329 std::string new_hotwording_enabled = "No"; | |
| 330 if (hotword_service && hotword_service->IsExperimentalHotwordingEnabled()) | |
| 331 new_hotwording_enabled = "Yes"; | |
| 332 AddPair(list, "New Hotwording Enabled", new_hotwording_enabled); | |
| 333 | |
| 334 AddLineBreak(list); | 326 AddLineBreak(list); |
| 335 } | 327 } |
| 336 | 328 |
| 337 // Adds information specific to an extension to the list. | 329 // Adds information specific to an extension to the list. |
| 338 void AddExtensionInfo(const std::string& extension_id, | 330 void AddExtensionInfo(const std::string& extension_id, |
| 339 const std::string& name_prefix, | 331 const std::string& name_prefix, |
| 340 base::ListValue* list) { | 332 base::ListValue* list) { |
| 341 DCHECK(!name_prefix.empty()); | 333 DCHECK(!name_prefix.empty()); |
| 342 std::string version("undefined"); | 334 std::string version("undefined"); |
| 343 std::string id("undefined"); | 335 std::string id("undefined"); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) | 436 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) |
| 445 : content::WebUIController(web_ui) { | 437 : content::WebUIController(web_ui) { |
| 446 Profile* profile = Profile::FromWebUI(web_ui); | 438 Profile* profile = Profile::FromWebUI(web_ui); |
| 447 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); | 439 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); |
| 448 | 440 |
| 449 // Set up the about:voicesearch source. | 441 // Set up the about:voicesearch source. |
| 450 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); | 442 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); |
| 451 } | 443 } |
| 452 | 444 |
| 453 VoiceSearchUI::~VoiceSearchUI() {} | 445 VoiceSearchUI::~VoiceSearchUI() {} |
| OLD | NEW |