| 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/app_list/speech_recognizer.h" | 5 #include "chrome/browser/ui/app_list/speech_recognizer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void SpeechRecognizer::EventListener::StartOnIOThread( | 121 void SpeechRecognizer::EventListener::StartOnIOThread( |
| 122 const std::string& auth_scope, | 122 const std::string& auth_scope, |
| 123 const std::string& auth_token, | 123 const std::string& auth_token, |
| 124 const scoped_refptr<content::SpeechRecognitionSessionPreamble>& preamble) { | 124 const scoped_refptr<content::SpeechRecognitionSessionPreamble>& preamble) { |
| 125 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 125 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 126 if (session_ != kInvalidSessionId) | 126 if (session_ != kInvalidSessionId) |
| 127 StopOnIOThread(); | 127 StopOnIOThread(); |
| 128 | 128 |
| 129 content::SpeechRecognitionSessionConfig config; | 129 content::SpeechRecognitionSessionConfig config; |
| 130 config.language = locale_; | 130 config.language = locale_; |
| 131 config.is_legacy_api = false; | |
| 132 config.continuous = true; | 131 config.continuous = true; |
| 133 config.interim_results = true; | 132 config.interim_results = true; |
| 134 config.max_hypotheses = 1; | 133 config.max_hypotheses = 1; |
| 135 config.filter_profanities = true; | 134 config.filter_profanities = true; |
| 136 config.url_request_context_getter = url_request_context_getter_; | 135 config.url_request_context_getter = url_request_context_getter_; |
| 137 config.event_listener = weak_factory_.GetWeakPtr(); | 136 config.event_listener = weak_factory_.GetWeakPtr(); |
| 138 // kInvalidUniqueID is not a valid render process, so the speech permission | 137 // kInvalidUniqueID is not a valid render process, so the speech permission |
| 139 // check allows the request through. | 138 // check allows the request through. |
| 140 config.initial_context.render_process_id = | 139 config.initial_context.render_process_id = |
| 141 content::ChildProcessHost::kInvalidUniqueID; | 140 content::ChildProcessHost::kInvalidUniqueID; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 void SpeechRecognizer::Stop() { | 311 void SpeechRecognizer::Stop() { |
| 313 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 312 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 314 content::BrowserThread::PostTask( | 313 content::BrowserThread::PostTask( |
| 315 content::BrowserThread::IO, | 314 content::BrowserThread::IO, |
| 316 FROM_HERE, | 315 FROM_HERE, |
| 317 base::Bind(&SpeechRecognizer::EventListener::StopOnIOThread, | 316 base::Bind(&SpeechRecognizer::EventListener::StopOnIOThread, |
| 318 speech_event_listener_)); | 317 speech_event_listener_)); |
| 319 } | 318 } |
| 320 | 319 |
| 321 } // namespace app_list | 320 } // namespace app_list |
| OLD | NEW |