summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authormichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-21 12:09:27 +0000
committermichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-21 12:09:27 +0000
commit0e8140a9e2ca1e157467e852294b35cb9adca4fa (patch)
treefac34cda93727de10bbcfa60f878dc575cd84019 /content
parenta79b0e3523caa096a0917477f0ca4c367059b3d1 (diff)
downloadchromium_src-0e8140a9e2ca1e157467e852294b35cb9adca4fa.zip
chromium_src-0e8140a9e2ca1e157467e852294b35cb9adca4fa.tar.gz
chromium_src-0e8140a9e2ca1e157467e852294b35cb9adca4fa.tar.bz2
Access defaultVideoPosterURL setting for ContentSettings
This setting is used by Android WebView API WebChromeClient.getDefaultVideoPoster(). We intercept the request of defaultVideoPosterURL and return the image from WebChromeClient.getDefaultVideoPoster(). BUG=http://b/6294871 Review URL: https://chromiumcodereview.appspot.com/12665007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/android/content_settings.cc13
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ContentSettings.java26
-rw-r--r--content/public/common/common_param_traits_macros.h1
3 files changed, 40 insertions, 0 deletions
diff --git a/content/browser/android/content_settings.cc b/content/browser/android/content_settings.cc
index 691f22c..91c63ef 100644
--- a/content/browser/android/content_settings.cc
+++ b/content/browser/android/content_settings.cc
@@ -88,6 +88,8 @@ struct ContentSettings::FieldIds {
GetFieldID(env, clazz, "mLoadWithOverviewMode", "Z");
media_playback_requires_user_gesture =
GetFieldID(env, clazz, "mMediaPlaybackRequiresUserGesture", "Z");
+ default_video_poster_url =
+ GetFieldID(env, clazz, "mDefaultVideoPosterURL", kStringClassName);
}
// Field ids
@@ -116,6 +118,7 @@ struct ContentSettings::FieldIds {
jfieldID use_wide_viewport;
jfieldID load_with_overview_mode;
jfieldID media_playback_requires_user_gesture;
+ jfieldID default_video_poster_url;
};
ContentSettings::ContentSettings(JNIEnv* env,
@@ -286,12 +289,17 @@ void ContentSettings::SyncFromNativeImpl() {
obj,
field_ids_->load_with_overview_mode,
prefs.initialize_at_minimum_page_scale);
+ CheckException(env);
env->SetBooleanField(
obj,
field_ids_->media_playback_requires_user_gesture,
prefs.user_gesture_required_for_media_playback);
+ CheckException(env);
+ str.Reset(
+ ConvertUTF8ToJavaString(env, prefs.default_video_poster_url.spec()));
+ env->SetObjectField(obj, field_ids_->default_video_poster_url, str.obj());
CheckException(env);
}
@@ -414,6 +422,11 @@ void ContentSettings::SyncToNativeImpl() {
prefs.user_gesture_required_for_media_playback = env->GetBooleanField(
obj, field_ids_->media_playback_requires_user_gesture);
+ str.Reset(
+ env, static_cast<jstring>(
+ env->GetObjectField(obj, field_ids_->default_video_poster_url)));
+ prefs.default_video_poster_url = GURL(ConvertJavaStringToUTF8(str));
+
render_view_host->UpdateWebkitPreferences(prefs);
}
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java b/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
index 4bd41ac..5f3e8d3 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
@@ -94,6 +94,7 @@ public class ContentSettings {
private boolean mUseWideViewport = false;
private boolean mLoadWithOverviewMode = false;
private boolean mMediaPlaybackRequiresUserGesture = true;
+ private String mDefaultVideoPosterURL;
// Not accessed by the native side.
private boolean mSupportZoom = true;
@@ -1215,6 +1216,30 @@ public class ContentSettings {
}
}
+ /**
+ * Set the default video poster URL.
+ * @param url The url of default video poster.
+ */
+ public void setDefaultVideoPosterURL(String url) {
+ assert mCanModifySettings;
+ synchronized (mContentSettingsLock) {
+ if (mDefaultVideoPosterURL != null && !mDefaultVideoPosterURL.equals(url) ||
+ mDefaultVideoPosterURL == null && url != null) {
+ mDefaultVideoPosterURL = url;
+ mEventHandler.syncSettingsLocked();
+ }
+ }
+ }
+
+ /**
+ * Get the default video poster URL.
+ */
+ public String getDefaultVideoPosterURL() {
+ synchronized (mContentSettingsLock) {
+ return mDefaultVideoPosterURL;
+ }
+ }
+
private int clipFontSize(int size) {
if (size < MINIMUM_FONT_SIZE) {
return MINIMUM_FONT_SIZE;
@@ -1263,6 +1288,7 @@ public class ContentSettings {
setBuiltInZoomControls(settings.getBuiltInZoomControls());
setDisplayZoomControls(settings.getDisplayZoomControls());
setMediaPlaybackRequiresUserGesture(settings.getMediaPlaybackRequiresUserGesture());
+ setDefaultVideoPosterURL(settings.getDefaultVideoPosterURL());
}
/**
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h
index 37e078e..8694ec3 100644
--- a/content/public/common/common_param_traits_macros.h
+++ b/content/public/common/common_param_traits_macros.h
@@ -202,6 +202,7 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebPreferences)
IPC_STRUCT_TRAITS_MEMBER(force_enable_zoom)
IPC_STRUCT_TRAITS_MEMBER(double_tap_to_zoom_enabled)
IPC_STRUCT_TRAITS_MEMBER(user_gesture_required_for_media_playback)
+ IPC_STRUCT_TRAITS_MEMBER(default_video_poster_url)
#endif
IPC_STRUCT_TRAITS_END()