X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fxwalk%2Fruntime%2Fbrowser%2Fandroid%2Fxwalk_web_contents_delegate.cc;h=10e63c30769499b541d7ece5c046d32a3d04418e;hb=6a7f56377067e5178d0a481bd2e56d781bd4eaf2;hp=d0845545159f5447e107159e42a988b82490c639;hpb=d41e52f18cc3fee3627acf2db026b2a86c2a9d18;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc b/src/xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc index d084554..10e63c3 100644 --- a/src/xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc +++ b/src/xwalk/runtime/browser/android/xwalk_web_contents_delegate.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "xwalk/runtime/browser/android/xwalk_content.h" #include "xwalk/runtime/browser/android/xwalk_web_contents_delegate.h" #include @@ -46,13 +47,27 @@ void XWalkWebContentsDelegate::AddNewContents( bool user_gesture, bool* was_blocked) { JNIEnv* env = AttachCurrentThread(); + bool is_dialog = disposition == NEW_POPUP; ScopedJavaLocalRef java_delegate = GetJavaDelegate(env); + bool create_popup = false; if (java_delegate.obj()) { - Java_XWalkWebContentsDelegate_addNewContents(env, + create_popup = Java_XWalkWebContentsDelegate_addNewContents(env, java_delegate.obj(), is_dialog, user_gesture); } + + if (create_popup) { + XWalkContent::FromWebContents(source)->SetPendingWebContentsForPopup( + make_scoped_ptr(new_contents)); + new_contents->WasHidden(); + } else { + base::MessageLoop::current()->DeleteSoon(FROM_HERE, new_contents); + } + + if (was_blocked) { + *was_blocked = !create_popup; + } } void XWalkWebContentsDelegate::CloseContents(content::WebContents* source) {