| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/speech/speech_recognition_manager_impl.h" | 5 #include "content/browser/speech/speech_recognition_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/browser/browser_main_loop.h" | 8 #include "content/browser/browser_main_loop.h" |
| 9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 10 #include "content/browser/speech/input_tag_speech_dispatcher_host.h" | 10 #include "content/browser/speech/input_tag_speech_dispatcher_host.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 void SpeechRecognitionManagerImpl::CheckRenderViewTypeAndStartRecognition( | 146 void SpeechRecognitionManagerImpl::CheckRenderViewTypeAndStartRecognition( |
| 147 const SpeechRecognitionParams& params) { | 147 const SpeechRecognitionParams& params) { |
| 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 149 | 149 |
| 150 RenderViewHostImpl* render_view_host = RenderViewHostImpl::FromID( | 150 RenderViewHostImpl* render_view_host = RenderViewHostImpl::FromID( |
| 151 params.render_process_id, params.render_view_id); | 151 params.render_process_id, params.render_view_id); |
| 152 if (!render_view_host || !render_view_host->GetDelegate()) | 152 if (!render_view_host || !render_view_host->GetDelegate()) |
| 153 return; | 153 return; |
| 154 | 154 |
| 155 // For host delegates other than TabContents we can't reliably show a popup, | 155 // For host delegates other than VIEW_TYPE_TAB_CONTENTS we can't reliably show |
| 156 // including the speech input bubble. In these cases for privacy reasons we | 156 // a popup, including the speech input bubble. In these cases for privacy |
| 157 // don't want to start recording if the user can't be properly notified. | 157 // reasons we don't want to start recording if the user can't be properly |
| 158 // An example of this is trying to show the speech input bubble within an | 158 // notified. An example of this is trying to show the speech input bubble |
| 159 // extension popup: http://crbug.com/92083. In these situations the speech | 159 // within an extension popup: http://crbug.com/92083. In these situations the |
| 160 // input extension API should be used instead. | 160 // speech input extension API should be used instead. |
| 161 if (render_view_host->GetDelegate()->GetRenderViewType() == | 161 if (render_view_host->GetDelegate()->GetRenderViewType() == |
| 162 content::VIEW_TYPE_TAB_CONTENTS) { | 162 content::VIEW_TYPE_TAB_CONTENTS) { |
| 163 BrowserThread::PostTask( | 163 BrowserThread::PostTask( |
| 164 BrowserThread::IO, FROM_HERE, | 164 BrowserThread::IO, FROM_HERE, |
| 165 base::Bind(&SpeechRecognitionManagerImpl::ProceedStartingRecognition, | 165 base::Bind(&SpeechRecognitionManagerImpl::ProceedStartingRecognition, |
| 166 base::Unretained(this), params)); | 166 base::Unretained(this), params)); |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 void SpeechRecognitionManagerImpl::ProceedStartingRecognition( | 170 void SpeechRecognitionManagerImpl::ProceedStartingRecognition( |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 357 |
| 358 SpeechRecognitionManagerImpl::Request::Request() | 358 SpeechRecognitionManagerImpl::Request::Request() |
| 359 : delegate(NULL), | 359 : delegate(NULL), |
| 360 is_active(false) { | 360 is_active(false) { |
| 361 } | 361 } |
| 362 | 362 |
| 363 SpeechRecognitionManagerImpl::Request::~Request() { | 363 SpeechRecognitionManagerImpl::Request::~Request() { |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace speech | 366 } // namespace speech |
| OLD | NEW |