| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 private: | 157 private: |
| 158 // Callback for the "requestVoiceSearchInfo" message. No arguments. | 158 // Callback for the "requestVoiceSearchInfo" message. No arguments. |
| 159 void HandleRequestVoiceSearchInfo(const base::ListValue* args) { | 159 void HandleRequestVoiceSearchInfo(const base::ListValue* args) { |
| 160 PopulatePageInformation(); | 160 PopulatePageInformation(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void ReturnVoiceSearchInfo(std::unique_ptr<base::ListValue> info) { | 163 void ReturnVoiceSearchInfo(std::unique_ptr<base::ListValue> info) { |
| 164 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 164 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 165 DCHECK(info); | 165 DCHECK(info); |
| 166 base::DictionaryValue voiceSearchInfo; | 166 base::DictionaryValue voiceSearchInfo; |
| 167 voiceSearchInfo.Set("voiceSearchInfo", std::move(info)); | 167 voiceSearchInfo.Set("voiceSearchInfo", info.release()); |
| 168 web_ui()->CallJavascriptFunctionUnsafe("returnVoiceSearchInfo", | 168 web_ui()->CallJavascriptFunctionUnsafe("returnVoiceSearchInfo", |
| 169 voiceSearchInfo); | 169 voiceSearchInfo); |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Fill in the data to be displayed on the page. | 172 // Fill in the data to be displayed on the page. |
| 173 void PopulatePageInformation() { | 173 void PopulatePageInformation() { |
| 174 // Store Key-Value pairs of about-information. | 174 // Store Key-Value pairs of about-information. |
| 175 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 175 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
| 176 | 176 |
| 177 // Populate information. | 177 // Populate information. |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) | 437 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) |
| 438 : content::WebUIController(web_ui) { | 438 : content::WebUIController(web_ui) { |
| 439 Profile* profile = Profile::FromWebUI(web_ui); | 439 Profile* profile = Profile::FromWebUI(web_ui); |
| 440 web_ui->AddMessageHandler(base::MakeUnique<VoiceSearchDomHandler>(profile)); | 440 web_ui->AddMessageHandler(base::MakeUnique<VoiceSearchDomHandler>(profile)); |
| 441 | 441 |
| 442 // Set up the about:voicesearch source. | 442 // Set up the about:voicesearch source. |
| 443 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); | 443 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); |
| 444 } | 444 } |
| 445 | 445 |
| 446 VoiceSearchUI::~VoiceSearchUI() {} | 446 VoiceSearchUI::~VoiceSearchUI() {} |
| OLD | NEW |