Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: chrome/browser/ui/app_list/speech_recognizer.cc

Issue 636863003: Make SpeechRecognition per RenderFrame instead of per RenderView. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698