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_input_manager_impl.h" | 5 #include "content/browser/speech/speech_input_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.h" | 9 #include "content/browser/renderer_host/render_view_host.h" |
10 #include "content/browser/speech/speech_input_dispatcher_host.h" | 10 #include "content/browser/speech/speech_input_dispatcher_host.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 SpeechInputParams( | 136 SpeechInputParams( |
137 delegate, caller_id, render_process_id, render_view_id, | 137 delegate, caller_id, render_process_id, render_view_id, |
138 element_rect, language, grammar, origin_url, context_getter, | 138 element_rect, language, grammar, origin_url, context_getter, |
139 speech_input_prefs))); | 139 speech_input_prefs))); |
140 } | 140 } |
141 | 141 |
142 void SpeechInputManagerImpl::CheckRenderViewTypeAndStartRecognition( | 142 void SpeechInputManagerImpl::CheckRenderViewTypeAndStartRecognition( |
143 const SpeechInputParams& params) { | 143 const SpeechInputParams& params) { |
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
145 | 145 |
146 RenderViewHost* render_view_host = RenderViewHost::FromID( | 146 RenderViewHostImpl* render_view_host = RenderViewHostImpl::FromID( |
147 params.render_process_id, params.render_view_id); | 147 params.render_process_id, params.render_view_id); |
148 if (!render_view_host || !render_view_host->delegate()) | 148 if (!render_view_host || !render_view_host->GetDelegate()) |
149 return; | 149 return; |
150 | 150 |
151 // For host delegates other than TabContents we can't reliably show a popup, | 151 // For host delegates other than TabContents we can't reliably show a popup, |
152 // including the speech input bubble. In these cases for privacy reasons we | 152 // including the speech input bubble. In these cases for privacy reasons we |
153 // don't want to start recording if the user can't be properly notified. | 153 // don't want to start recording if the user can't be properly notified. |
154 // An example of this is trying to show the speech input bubble within an | 154 // An example of this is trying to show the speech input bubble within an |
155 // extension popup: http://crbug.com/92083. In these situations the speech | 155 // extension popup: http://crbug.com/92083. In these situations the speech |
156 // input extension API should be used instead. | 156 // input extension API should be used instead. |
157 if (render_view_host->delegate()->GetRenderViewType() == | 157 if (render_view_host->GetDelegate()->GetRenderViewType() == |
158 content::VIEW_TYPE_TAB_CONTENTS) { | 158 content::VIEW_TYPE_TAB_CONTENTS) { |
159 BrowserThread::PostTask( | 159 BrowserThread::PostTask( |
160 BrowserThread::IO, FROM_HERE, | 160 BrowserThread::IO, FROM_HERE, |
161 base::Bind(&SpeechInputManagerImpl::ProceedStartingRecognition, | 161 base::Bind(&SpeechInputManagerImpl::ProceedStartingRecognition, |
162 base::Unretained(this), params)); | 162 base::Unretained(this), params)); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 void SpeechInputManagerImpl::ProceedStartingRecognition( | 166 void SpeechInputManagerImpl::ProceedStartingRecognition( |
167 const SpeechInputParams& params) { | 167 const SpeechInputParams& params) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 SpeechInputManagerImpl::SpeechInputRequest::SpeechInputRequest() | 343 SpeechInputManagerImpl::SpeechInputRequest::SpeechInputRequest() |
344 : delegate(NULL), | 344 : delegate(NULL), |
345 is_active(false) { | 345 is_active(false) { |
346 } | 346 } |
347 | 347 |
348 SpeechInputManagerImpl::SpeechInputRequest::~SpeechInputRequest() { | 348 SpeechInputManagerImpl::SpeechInputRequest::~SpeechInputRequest() { |
349 } | 349 } |
350 | 350 |
351 } // namespace speech_input | 351 } // namespace speech_input |
OLD | NEW |