1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "web_contents_efl_delegate_ewk.h"
9 WebContentsEflDelegateEwk::WebContentsEflDelegateEwk(EWebView* wv)
13 bool WebContentsEflDelegateEwk::ShouldCreateWebContentsAsync(
14 content::WebContentsEflDelegate::NewWindowDecideCallback callback,
15 const GURL& target_url) {
16 // this method is called ONLY when creating new window - no matter what type
17 scoped_ptr<_Ewk_Policy_Decision> pd(
18 new _Ewk_Policy_Decision(web_view_, callback));
19 pd->ParseUrl(target_url);
20 web_view_->SmartCallback<EWebViewCallbacks::NewWindowPolicyDecision>().call(pd.get());
22 if (pd->isSuspended()) {
23 // it will be deleted later after it's used/ignored/downloaded
24 ignore_result(pd.release());
25 } else if (!pd->isDecided()) {
31 bool WebContentsEflDelegateEwk::WebContentsCreateAsync(
32 content::WebContentsEflDelegate::WebContentsCreateCallback callback) {
33 web_view_->CreateNewWindow(callback);
37 void WebContentsEflDelegateEwk::SetUpSmartObject(void* platform_data, void* native_view) {
38 EWebView* new_web_view = static_cast<EWebView*>(platform_data);
39 Evas_Object* _native_view = static_cast<Evas_Object*>(native_view);
40 evas_object_smart_member_add(_native_view, new_web_view->evas_object());