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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 //////////////////////////////////////////////////////////////////////////////// | 89 //////////////////////////////////////////////////////////////////////////////// |
90 | 90 |
91 // The handler for Javascript messages for the about:flags page. | 91 // The handler for Javascript messages for the about:flags page. |
92 class VoiceSearchDomHandler : public WebUIMessageHandler { | 92 class VoiceSearchDomHandler : public WebUIMessageHandler { |
93 public: | 93 public: |
94 explicit VoiceSearchDomHandler(Profile* profile) : profile_(profile) {} | 94 explicit VoiceSearchDomHandler(Profile* profile) : profile_(profile) {} |
95 | 95 |
96 virtual ~VoiceSearchDomHandler() {} | 96 virtual ~VoiceSearchDomHandler() {} |
97 | 97 |
98 // WebUIMessageHandler implementation. | 98 // WebUIMessageHandler implementation. |
99 virtual void RegisterMessages() OVERRIDE { | 99 virtual void RegisterMessages() override { |
100 web_ui()->RegisterMessageCallback( | 100 web_ui()->RegisterMessageCallback( |
101 "requestVoiceSearchInfo", | 101 "requestVoiceSearchInfo", |
102 base::Bind(&VoiceSearchDomHandler::HandleRequestVoiceSearchInfo, | 102 base::Bind(&VoiceSearchDomHandler::HandleRequestVoiceSearchInfo, |
103 base::Unretained(this))); | 103 base::Unretained(this))); |
104 } | 104 } |
105 | 105 |
106 private: | 106 private: |
107 // Callback for the "requestVoiceSearchInfo" message. No arguments. | 107 // Callback for the "requestVoiceSearchInfo" message. No arguments. |
108 void HandleRequestVoiceSearchInfo(const base::ListValue* args) { | 108 void HandleRequestVoiceSearchInfo(const base::ListValue* args) { |
109 base::DictionaryValue voiceSearchInfo; | 109 base::DictionaryValue voiceSearchInfo; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) | 363 VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui) |
364 : content::WebUIController(web_ui) { | 364 : content::WebUIController(web_ui) { |
365 Profile* profile = Profile::FromWebUI(web_ui); | 365 Profile* profile = Profile::FromWebUI(web_ui); |
366 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); | 366 web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile)); |
367 | 367 |
368 // Set up the about:voicesearch source. | 368 // Set up the about:voicesearch source. |
369 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); | 369 content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource()); |
370 } | 370 } |
371 | 371 |
372 VoiceSearchUI::~VoiceSearchUI() {} | 372 VoiceSearchUI::~VoiceSearchUI() {} |
OLD | NEW |