| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 config.continuous = true; | 122 config.continuous = true; |
| 123 config.interim_results = true; | 123 config.interim_results = true; |
| 124 config.max_hypotheses = 1; | 124 config.max_hypotheses = 1; |
| 125 config.filter_profanities = true; | 125 config.filter_profanities = true; |
| 126 config.url_request_context_getter = url_request_context_getter_; | 126 config.url_request_context_getter = url_request_context_getter_; |
| 127 config.event_listener = weak_factory_.GetWeakPtr(); | 127 config.event_listener = weak_factory_.GetWeakPtr(); |
| 128 // kInvalidUniqueID is not a valid render process, so the speech permission | 128 // kInvalidUniqueID is not a valid render process, so the speech permission |
| 129 // check allows the request through. | 129 // check allows the request through. |
| 130 config.initial_context.render_process_id = | 130 config.initial_context.render_process_id = |
| 131 content::ChildProcessHost::kInvalidUniqueID; | 131 content::ChildProcessHost::kInvalidUniqueID; |
| 132 config.initial_context.render_frame_id = MSG_ROUTING_NONE; |
| 132 config.auth_scope = auth_scope; | 133 config.auth_scope = auth_scope; |
| 133 config.auth_token = auth_token; | 134 config.auth_token = auth_token; |
| 134 config.preamble = preamble; | 135 config.preamble = preamble; |
| 135 | 136 |
| 136 auto speech_instance = content::SpeechRecognitionManager::GetInstance(); | 137 auto speech_instance = content::SpeechRecognitionManager::GetInstance(); |
| 137 session_ = speech_instance->CreateSession(config); | 138 session_ = speech_instance->CreateSession(config); |
| 138 speech_instance->StartSession(session_); | 139 speech_instance->StartSession(session_); |
| 139 } | 140 } |
| 140 | 141 |
| 141 void SpeechRecognizer::EventListener::StopOnIOThread() { | 142 void SpeechRecognizer::EventListener::StopOnIOThread() { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 void SpeechRecognizer::Stop() { | 294 void SpeechRecognizer::Stop() { |
| 294 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 295 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 295 content::BrowserThread::PostTask( | 296 content::BrowserThread::PostTask( |
| 296 content::BrowserThread::IO, | 297 content::BrowserThread::IO, |
| 297 FROM_HERE, | 298 FROM_HERE, |
| 298 base::Bind(&SpeechRecognizer::EventListener::StopOnIOThread, | 299 base::Bind(&SpeechRecognizer::EventListener::StopOnIOThread, |
| 299 speech_event_listener_)); | 300 speech_event_listener_)); |
| 300 } | 301 } |
| 301 | 302 |
| 302 } // namespace app_list | 303 } // namespace app_list |
| OLD | NEW |