diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 05:31:15 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 05:31:15 +0000 |
commit | 299d7f1d0003d467a159fb79ba1884080a655a00 (patch) | |
tree | 087f5e337119e9c836260bf46cfd808236157d30 /chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc | |
parent | de030d16f66334efafdef4ddd01f715d9ebbcfe9 (diff) | |
download | chromium_src-299d7f1d0003d467a159fb79ba1884080a655a00.zip chromium_src-299d7f1d0003d467a159fb79ba1884080a655a00.tar.gz chromium_src-299d7f1d0003d467a159fb79ba1884080a655a00.tar.bz2 |
Get rid of the RenderViewType concept in content, since it was only used by Chrome. Store the enum value in the WebContents' property bag.
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/10409088
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc')
-rw-r--r-- | chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc index 14b6af3..6b0162c 100644 --- a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc +++ b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc @@ -14,15 +14,15 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/common/chrome_view_type.h" +#include "chrome/browser/view_type_utils.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_view_host.h" -#include "content/public/browser/render_view_host_delegate.h" #include "content/public/browser/resource_context.h" #include "content/public/browser/speech_recognition_manager.h" #include "content/public/browser/speech_recognition_session_config.h" #include "content/public/browser/speech_recognition_session_context.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/speech_recognition_error.h" #include "content/public/common/speech_recognition_result.h" #include "grit/generated_resources.h" @@ -35,6 +35,7 @@ using content::BrowserThread; using content::SpeechRecognitionManager; +using content::WebContents; namespace { const int kNoActiveBubble = @@ -311,18 +312,20 @@ void ChromeSpeechRecognitionManagerDelegate::CheckRenderViewType( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const content::RenderViewHost* render_view_host = content::RenderViewHost::FromID(render_process_id, render_view_id); - - // For host delegates other than VIEW_TYPE_TAB_CONTENTS we can't reliably show - // a popup, including the speech input bubble. In these cases for privacy - // reasons we don't want to start recording if the user can't be properly - // notified. An example of this is trying to show the speech input bubble - // within an extension popup: http://crbug.com/92083. In these situations the - // speech input extension API should be used instead. - - const bool allowed = (render_view_host != NULL && - render_view_host->GetDelegate() != NULL && - render_view_host->GetDelegate()->GetRenderViewType() == - chrome::VIEW_TYPE_TAB_CONTENTS); + bool allowed = false; + if (render_view_host) { + // For host delegates other than VIEW_TYPE_TAB_CONTENTS we can't reliably + // show a popup, including the speech input bubble. In these cases for + // privacy reasons we don't want to start recording if the user can't be + // properly notified. An example of this is trying to show the speech input + // bubble within an extension popup: http://crbug.com/92083. In these + // situations the speech input extension API should be used instead. + WebContents* web_contents = + WebContents::FromRenderViewHost(render_view_host); + chrome::ViewType view_type = chrome::GetViewType(web_contents); + if (view_type == chrome::VIEW_TYPE_TAB_CONTENTS) + allowed = true; + } BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(callback, session_id, allowed)); } |