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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 // Helper functions for collecting a list of key-value pairs that will | 77 // Helper functions for collecting a list of key-value pairs that will |
78 // be displayed. | 78 // be displayed. |
79 void AddPair16(base::ListValue* list, | 79 void AddPair16(base::ListValue* list, |
80 const base::string16& key, | 80 const base::string16& key, |
81 const base::string16& value) { | 81 const base::string16& value) { |
82 std::unique_ptr<base::DictionaryValue> results(new base::DictionaryValue()); | 82 std::unique_ptr<base::DictionaryValue> results(new base::DictionaryValue()); |
83 results->SetString("key", key); | 83 results->SetString("key", key); |
84 results->SetString("value", value); | 84 results->SetString("value", value); |
85 list->Append(results.release()); | 85 list->Append(std::move(results)); |
86 } | 86 } |
87 | 87 |
88 void AddPair(base::ListValue* list, | 88 void AddPair(base::ListValue* list, |
89 const base::StringPiece& key, | 89 const base::StringPiece& key, |
90 const base::StringPiece& value) { | 90 const base::StringPiece& value) { |
91 AddPair16(list, UTF8ToUTF16(key), UTF8ToUTF16(value)); | 91 AddPair16(list, UTF8ToUTF16(key), UTF8ToUTF16(value)); |
92 } | 92 } |
93 | 93 |
94 void AddPairBool(base::ListValue* list, | 94 void AddPairBool(base::ListValue* list, |
95 const base::StringPiece& key, | 95 const base::StringPiece& key, |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) | 435 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) |
436 : content::WebUIController(web_ui) { | 436 : content::WebUIController(web_ui) { |
437 Profile* profile = Profile::FromWebUI(web_ui); | 437 Profile* profile = Profile::FromWebUI(web_ui); |
438 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); | 438 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); |
439 | 439 |
440 // Set up the about:voicesearch source. | 440 // Set up the about:voicesearch source. |
441 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); | 441 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); |
442 } | 442 } |
443 | 443 |
444 VoiceSearchUI::~VoiceSearchUI() {} | 444 VoiceSearchUI::~VoiceSearchUI() {} |
OLD | NEW |