Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / android_webview / native / aw_web_contents_delegate.cc
index f7aecfe..7572c39 100644 (file)
@@ -47,7 +47,8 @@ base::LazyInstance<AwJavaScriptDialogManager>::Leaky
 AwWebContentsDelegate::AwWebContentsDelegate(
     JNIEnv* env,
     jobject obj)
-    : WebContentsDelegateAndroid(env, obj) {
+    : WebContentsDelegateAndroid(env, obj),
+      is_fullscreen_(false) {
 }
 
 AwWebContentsDelegate::~AwWebContentsDelegate() {
@@ -207,6 +208,25 @@ void AwWebContentsDelegate::RequestMediaAccessPermission(
           new MediaAccessPermissionRequest(request, callback)));
 }
 
+void AwWebContentsDelegate::ToggleFullscreenModeForTab(
+    content::WebContents* web_contents, bool enter_fullscreen) {
+  JNIEnv* env = AttachCurrentThread();
+
+  ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env);
+  if (java_delegate.obj()) {
+    Java_AwWebContentsDelegate_toggleFullscreenModeForTab(
+        env, java_delegate.obj(), enter_fullscreen);
+  }
+  is_fullscreen_ = enter_fullscreen;
+  web_contents->GetRenderViewHost()->WasResized();
+}
+
+bool AwWebContentsDelegate::IsFullscreenForTabOrPending(
+    const content::WebContents* web_contents) const {
+  return is_fullscreen_;
+}
+
+
 static void FilesSelectedInChooser(
     JNIEnv* env, jclass clazz,
     jint process_id, jint render_id, jint mode_flags,