diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-07-20 13:40:08 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-07-20 13:40:09 -0700 |
commit | 4fd21b74a91e2b34470a084755d144d71564a8d9 (patch) | |
tree | ec614cb8fc332269da4a468b24a201dce1f09c5a /Source | |
parent | f762138fb2c8ec33fe3dec8e6bfd47e459f8f6c8 (diff) | |
parent | ad46784d9075ff6d1e11cd2be47a6169761b0eeb (diff) | |
download | external_webkit-4fd21b74a91e2b34470a084755d144d71564a8d9.zip external_webkit-4fd21b74a91e2b34470a084755d144d71564a8d9.tar.gz external_webkit-4fd21b74a91e2b34470a084755d144d71564a8d9.tar.bz2 |
Merge "add webSetting API to allow media play without user gesture"
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/html/HTMLMediaElement.cpp | 6 | ||||
-rw-r--r-- | Source/WebCore/page/Settings.cpp | 2 | ||||
-rw-r--r-- | Source/WebCore/page/Settings.h | 8 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebSettings.cpp | 6 |
4 files changed, 19 insertions, 3 deletions
diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index d25bada..693f214 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -185,9 +185,9 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum document->registerForDocumentActivationCallbacks(this); document->registerForMediaVolumeCallbacks(this); document->registerForPrivateBrowsingStateChangedCallbacks(this); -#if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) - m_restrictions |= RequireUserGestureForRateChangeRestriction; -#endif + + if (document->settings() && document->settings()->mediaPlaybackRequiresUserGesture()) + m_restrictions |= RequireUserGestureForRateChangeRestriction; } HTMLMediaElement::~HTMLMediaElement() diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index f668f3e..79e38d1 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -201,6 +201,8 @@ Settings::Settings(Page* page) #else , m_passwordEchoEnabled(false) #endif + , m_mediaPlaybackRequiresUserGesture(false) + , m_mediaPlaybackAllowsInline(true) { // A Frame may not have been created yet, so we initialize the AtomicString // hash before trying to use it. diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index 2cf7715..84828ab 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -479,6 +479,12 @@ namespace WebCore { bool blockNetworkImage() const { return m_blockNetworkImage; } #endif + void setMediaPlaybackRequiresUserGesture(bool flag) { m_mediaPlaybackRequiresUserGesture = flag; }; + bool mediaPlaybackRequiresUserGesture() const { return m_mediaPlaybackRequiresUserGesture; } + + void setMediaPlaybackAllowsInline(bool flag) { m_mediaPlaybackAllowsInline = flag; }; + bool mediaPlaybackAllowsInline() const { return m_mediaPlaybackAllowsInline; } + private: Page* m_page; @@ -633,6 +639,8 @@ namespace WebCore { #ifdef ANDROID_PLUGINS bool m_pluginsOnDemand : 1; #endif + bool m_mediaPlaybackRequiresUserGesture : 1; + bool m_mediaPlaybackAllowsInline : 1; bool m_passwordEchoEnabled : 1; #if USE(SAFARI_THEME) diff --git a/Source/WebKit/android/jni/WebSettings.cpp b/Source/WebKit/android/jni/WebSettings.cpp index 467da3d..1bd3e36 100644 --- a/Source/WebKit/android/jni/WebSettings.cpp +++ b/Source/WebKit/android/jni/WebSettings.cpp @@ -151,6 +151,7 @@ struct FieldIds { #endif mOverrideCacheMode = env->GetFieldID(clazz, "mOverrideCacheMode", "I"); mPasswordEchoEnabled = env->GetFieldID(clazz, "mPasswordEchoEnabled", "Z"); + mMediaPlaybackRequiresUserGesture = env->GetFieldID(clazz, "mMediaPlaybackRequiresUserGesture", "Z"); ALOG_ASSERT(mLayoutAlgorithm, "Could not find field mLayoutAlgorithm"); ALOG_ASSERT(mTextSize, "Could not find field mTextSize"); @@ -195,6 +196,7 @@ struct FieldIds { ALOG_ASSERT(mUseDoubleTree, "Could not find field mUseDoubleTree"); ALOG_ASSERT(mPageCacheCapacity, "Could not find field mPageCacheCapacity"); ALOG_ASSERT(mPasswordEchoEnabled, "Could not find field mPasswordEchoEnabled"); + ALOG_ASSERT(mMediaPlaybackRequiresUserGesture, "Could not find field mMediaPlaybackRequiresUserGesture"); jclass enumClass = env->FindClass("java/lang/Enum"); ALOG_ASSERT(enumClass, "Could not find Enum class!"); @@ -281,6 +283,7 @@ struct FieldIds { #endif jfieldID mOverrideCacheMode; jfieldID mPasswordEchoEnabled; + jfieldID mMediaPlaybackRequiresUserGesture; }; static struct FieldIds* gFieldIds; @@ -616,6 +619,9 @@ public: bool echoPassword = env->GetBooleanField(obj, gFieldIds->mPasswordEchoEnabled); s->setPasswordEchoEnabled(echoPassword); + + flag = env->GetBooleanField(obj, gFieldIds->mMediaPlaybackRequiresUserGesture); + s->setMediaPlaybackRequiresUserGesture(flag); } }; |