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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 content::WebUIDataSource* CreateVoiceSearchUiHtmlSource() { | 52 content::WebUIDataSource* CreateVoiceSearchUiHtmlSource() { |
53 content::WebUIDataSource* html_source = | 53 content::WebUIDataSource* html_source = |
54 content::WebUIDataSource::Create(chrome::kChromeUIVoiceSearchHost); | 54 content::WebUIDataSource::Create(chrome::kChromeUIVoiceSearchHost); |
55 | 55 |
56 html_source->AddLocalizedString("loadingMessage", | 56 html_source->AddLocalizedString("loadingMessage", |
57 IDS_VOICESEARCH_LOADING_MESSAGE); | 57 IDS_VOICESEARCH_LOADING_MESSAGE); |
58 html_source->AddLocalizedString("voiceSearchLongTitle", | 58 html_source->AddLocalizedString("voiceSearchLongTitle", |
59 IDS_VOICESEARCH_TITLE_MESSAGE); | 59 IDS_VOICESEARCH_TITLE_MESSAGE); |
60 | 60 |
61 html_source->SetUseJsonJSFormatV2(); | |
62 html_source->SetJsonPath("strings.js"); | 61 html_source->SetJsonPath("strings.js"); |
63 html_source->AddResourcePath("about_voicesearch.js", | 62 html_source->AddResourcePath("about_voicesearch.js", |
64 IDR_ABOUT_VOICESEARCH_JS); | 63 IDR_ABOUT_VOICESEARCH_JS); |
65 html_source->SetDefaultResource(IDR_ABOUT_VOICESEARCH_HTML); | 64 html_source->SetDefaultResource(IDR_ABOUT_VOICESEARCH_HTML); |
66 return html_source; | 65 return html_source; |
67 } | 66 } |
68 | 67 |
69 // Helper functions for collecting a list of key-value pairs that will | 68 // Helper functions for collecting a list of key-value pairs that will |
70 // be displayed. | 69 // be displayed. |
71 void AddPair(base::ListValue* list, | 70 void AddPair(base::ListValue* list, |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) | 363 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) |
365 : content::WebUIController(web_ui) { | 364 : content::WebUIController(web_ui) { |
366 Profile* profile = Profile::FromWebUI(web_ui); | 365 Profile* profile = Profile::FromWebUI(web_ui); |
367 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); | 366 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); |
368 | 367 |
369 // Set up the about:voicesearch source. | 368 // Set up the about:voicesearch source. |
370 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); | 369 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); |
371 } | 370 } |
372 | 371 |
373 VoiceSearchUI::~VoiceSearchUI() {} | 372 VoiceSearchUI::~VoiceSearchUI() {} |
OLD | NEW |