#include "content/browser/dom_storage/session_storage_namespace_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_view.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager.h"
#include "content/public/browser/content_browser_client.h"
-#include "content/public/browser/browser_context.h"
-#include "content/public/browser/web_contents_delegate.h"
-#include "content/public/browser/user_metrics.h"
#include "content/public/browser/storage_partition.h"
+#include "content/public/browser/user_metrics.h"
+#include "content/public/browser/web_contents_delegate.h"
+#include "content/public/browser/web_contents_efl_delegate.h"
#include "content/public/common/result_codes.h"
// Majority of the code in this file was taken directly from
namespace content {
-WebContentsImpl* WebContentsImpl::CreateWithOpener(
- const WebContents::CreateParams& params,
- WebContentsImpl* opener) {
- TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener");
- // XXX: Compared to original this one creates WebContentsImplEfl
- WebContentsImpl* new_contents = new WebContentsImplEfl(
- params.browser_context, opener, params.platform_data);
-
- new_contents->Init(params);
- return new_contents;
-}
-
-WebContents* WebContents::CreateWithSessionStorage(
- const WebContents::CreateParams& params,
- const SessionStorageNamespaceMap& session_storage_namespace_map) {
- // XXX: Compared to original this one creates WebContentsImplEfl
- WebContentsImpl* new_contents = new WebContentsImplEfl(
- params.browser_context, NULL, params.platform_data);
-
- for (SessionStorageNamespaceMap::const_iterator it =
- session_storage_namespace_map.begin();
- it != session_storage_namespace_map.end();
- ++it) {
- new_contents->GetController()
- .SetSessionStorageNamespace(it->first, it->second.get());
- }
-
- new_contents->Init(params);
- return new_contents;
-}
-
WebContentsImplEfl::WebContentsImplEfl(BrowserContext* browser_context,
WebContentsImpl* opener,
void* platform_data)
, platform_data_(platform_data) {
}
+void WebContentsImplEfl::SetEflDelegate(WebContentsEflDelegate* delegate) {
+ efl_delegate_.reset(delegate);
+}
+
+WebContents* WebContentsImplEfl::Clone() {
+ NOTREACHED() << "Cloning WebContents is not supported in EFL port";
+ return NULL;
+}
+
void WebContentsImplEfl::CreateNewWindow(
int render_process_id,
int route_id,
&WebContentsImplEfl::HandleNewWindowRequest,
base::Unretained(this), render_process_id, route_id,
main_frame_route_id, params, ssn);
- if (delegate_ && delegate_->ShouldCreateWebContentsAsync(callback, params.target_url))
+ if (efl_delegate_ &&
+ efl_delegate_->ShouldCreateWebContentsAsync(callback, params.target_url))
return;
// End of EFL port specific code.
if (create) {
scoped_refptr<SessionStorageNamespace> ssn = session_storage_namespace;
- WebContentsDelegate::WebContentsCreateCallback callback = base::Bind(
+ WebContentsEflDelegate::WebContentsCreateCallback callback = base::Bind(
&WebContentsImplEfl::HandleNewWebContentsCreate,
base::Unretained(this), render_process_id, route_id,
main_frame_route_id, params, ssn);
- if (delegate_ && delegate_->WebContentsCreateAsync(callback))
+ if (efl_delegate_ && efl_delegate_->WebContentsCreateAsync(callback))
return;
callback.Run(NULL);
create_params.main_frame_routing_id = main_frame_route_id;
create_params.opener = this;
create_params.opener_suppressed = params.opener_suppressed;
- create_params.platform_data = platform_data;
if (params.disposition == NEW_BACKGROUND_TAB)
create_params.initially_hidden = true;
new_contents->RenderViewCreated(new_contents->GetRenderViewHost());
// Added for EFL port
- new_contents->SetPlatformData(platform_data);
+ new_contents->platform_data_ = platform_data;
// Added for EFL port
// Save the window for later if we're not suppressing the opener (since it
namespace content {
+class WebContentsEflDelegate;
+
class WebContentsImplEfl : public WebContentsImpl {
public:
+ // See WebContents::Create for a description of these parameters.
+ WebContentsImplEfl(BrowserContext* browser_context,
+ WebContentsImpl* opener,
+ void* platform_data);
+
void CreateNewWindow(
int render_process_id,
int route_id,
SessionStorageNamespace* session_storage_namespace) override;
void* GetPlatformData() const { return platform_data_; };
- void SetPlatformData(void* data) { platform_data_ = data; };
+
+ void SetEflDelegate(WebContentsEflDelegate*);
+
+ // Overrides for WebContents
+ WebContents* Clone() override;
private:
// Needed to access private WebContentsImplEfl constructor from
friend class WebContentsImpl;
friend class WebContents;
- // See WebContents::Create for a description of these parameters.
- WebContentsImplEfl(BrowserContext* browser_context,
- WebContentsImpl* opener,
- void* ewk_view);
-
void CancelWindowRequest(
int render_process_id,
int route_id,
int main_frame_route_id,
const ViewHostMsg_CreateWindow_Params& params,
SessionStorageNamespace* session_storage_namespace,
- void* ewk_view);
+ void* platform_data);
void* platform_data_;
+ scoped_ptr<WebContentsEflDelegate> efl_delegate_;
+
DISALLOW_COPY_AND_ASSIGN(WebContentsImplEfl);
};
'browser/renderer_host/render_widget_host_view_efl.cc',
'browser/renderer_host/web_event_factory_efl.h',
'browser/renderer_host/web_event_factory_efl.cc',
- 'public/browser/web_contents_delegate_efl.cc',
+ 'public/browser/web_contents_efl_delegate.h',
'public/browser/web_contents_view_efl_delegate.h',
],
'sources/': [
+++ /dev/null
-// Copyright 2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/public/browser/web_contents_delegate.h"
-
-namespace content {
-
-bool WebContentsDelegate::ShouldCreateWebContentsAsync(
- NewWindowDecideCallback, const GURL&) {
- return false;
-};
-
-bool WebContentsDelegate::WebContentsCreateAsync(
- WebContentsCreateCallback) {
- return false;
-};
-
-} // namespace content
--- /dev/null
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_EFL_DELEGATE_H_
+#define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_EFL_DELEGATE_H_
+
+#include "base/callback.h"
+#include "content/common/content_export.h"
+
+class GURL;
+
+namespace content {
+
+class WebContents;
+
+class CONTENT_EXPORT WebContentsEflDelegate {
+ public:
+ // Callback function allowing the embedder to create new web contents object
+ // in an asynchronous manner. The callback takes one opaque parameter
+ // intended to pass platform specific data to WebContents constructor. It
+ // returns a pointer to new WebContents created by the function. The caller
+ // is expected to take ownership of the returned object.
+ typedef base::Callback<WebContents*(void*)> WebContentsCreateCallback;
+
+ // Callback allowing the embedder to resume or block new window request. The
+ // argument specifies if the request should be allowed (true) or blocked
+ // (false).
+ typedef base::Callback<void(bool)> NewWindowDecideCallback;
+
+ // Allows delegate to asynchronously control whether a WebContents should be
+ // created. The function should return true if the implementation intends to
+ // use this functionality. In such case the synchronous version of this
+ // function ShouldCreateWebContents will not be called. The embedder must
+ // call the callback function at some point.
+ virtual bool ShouldCreateWebContentsAsync(NewWindowDecideCallback,
+ const GURL&) = 0;
+
+ // Allows the delegate to control new web contents creation in an
+ // asynchronous manner. The function is called with a callback object the
+ // delegate may keep if it wants to delay creation of new web contents. In
+ // such case the function should return true. Returning false means new web
+ // contents creation should be handled in normal, synchronous manner.
+ virtual bool WebContentsCreateAsync(WebContentsCreateCallback) = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_EFL_DELEGATE_H_
'selection_magnifier_efl.h',
'url_request_context_getter_efl.cc',
'url_request_context_getter_efl.h',
+ 'web_contents_efl_delegate_ewk.cc',
+ 'web_contents_efl_delegate_ewk.h',
'web_contents_delegate_efl.cc',
'web_contents_delegate_efl.h',
'web_contents_view_delegate_ewk.cc',
#include "content/browser/renderer_host/web_event_factory_efl.h"
#include "content/browser/renderer_host/ui_events_helper.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/browser/web_contents/web_contents_impl_efl.h"
#include "content/browser/web_contents/web_contents_view.h"
#include "content/browser/web_contents/web_contents_view_efl.h"
#include "content/public/browser/browser_message_filter.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "ui/events/event_switches.h"
+#include "web_contents_efl_delegate_ewk.h"
#include "web_contents_view_efl_delegate_ewk.h"
#if defined(OS_TIZEN_MOBILE)
#include "browser/motion/wkext_motion.h"
};
int EWebView::find_request_id_counter_ = 0;
-content::WebContentsDelegate::WebContentsCreateCallback
+content::WebContentsEflDelegate::WebContentsCreateCallback
EWebView::create_new_window_web_contents_cb_ =
base::Bind(&NullCreateWebContents);
}
void EWebView::CreateNewWindow(
- content::WebContentsDelegate::WebContentsCreateCallback cb) {
+ content::WebContentsEflDelegate::WebContentsCreateCallback cb) {
create_new_window_web_contents_cb_ = cb;
Evas_Object* new_object = NULL;
SmartCallback<EWebViewCallbacks::CreateNewWindow>().call(&new_object);
if (!new_contents) {
WebContents::CreateParams params(context_->browser_context());
params.initial_size = gfx::Size(width, height);
- params.platform_data = this;
- web_contents_.reset(WebContents::Create(params));
- LOG(INFO) << "Initial WebContents size: " << params.initial_size.ToString();
+ web_contents_.reset(new WebContentsImplEfl(
+ context_->browser_context(), NULL, this));
+ static_cast<WebContentsImpl*>(web_contents_.get())->Init(params);
+ VLOG(1) << "Initial WebContents size: " << params.initial_size.ToString();
} else {
web_contents_.reset(new_contents);
}
web_contents_->SetDelegate(web_contents_delegate_.get());
GetWebContentsViewEfl()->SetEflDelegate(
new WebContentsViewEflDelegateEwk(this));
+ WebContentsImplEfl* wc_efl = static_cast<WebContentsImplEfl*>(
+ web_contents_.get());
+ wc_efl->SetEflDelegate(new WebContentsEflDelegateEwk(this));
back_forward_list_.reset(new _Ewk_Back_Forward_List(
web_contents_->GetController()));
back_forward_list_.reset(
#include "content/common/input/input_event_ack_state.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents_delegate.h"
+#include "content/public/browser/web_contents_efl_delegate.h"
#include "content/public/common/menu_item.h"
#include "base/id_map.h"
#include "context_menu_controller_efl.h"
// call this once after created and before use
void Initialize();
- void CreateNewWindow(content::WebContentsDelegate::WebContentsCreateCallback);
+ void CreateNewWindow(content::WebContentsEflDelegate::WebContentsCreateCallback);
static Evas_Object* GetHostWindowDelegate(const content::WebContents*);
tizen_webview::WebView* GetPublicWebView();
scoped_ptr<_Ewk_Back_Forward_List> back_forward_list_;
- static content::WebContentsDelegate::WebContentsCreateCallback
+ static content::WebContentsEflDelegate::WebContentsCreateCallback
create_new_window_web_contents_cb_;
private:
}
_Ewk_Policy_Decision::_Ewk_Policy_Decision(EWebView* view,
- content::WebContentsDelegate::NewWindowDecideCallback callback)
+ content::WebContentsEflDelegate::NewWindowDecideCallback callback)
: web_view_(view)
, window_create_callback_(callback)
, responseHeaders_(NULL)
#include "base/memory/scoped_ptr.h"
#include "browser/navigation_policy_handler_efl.h"
#include "browser/policy_response_delegate_efl.h"
-#include "content/public/browser/web_contents_delegate.h"
+#include "content/public/browser/web_contents_efl_delegate.h"
#include "content/public/common/resource_type.h"
#include "public/ewk_policy_decision.h"
#include "third_party/WebKit/public/web/WebViewModeEnums.h"
* Constructs _Ewk_Policy_Decision with navigation type POLICY_NEWWINDOW
*/
explicit _Ewk_Policy_Decision(EWebView* view,
- content::WebContentsDelegate::NewWindowDecideCallback);
+ content::WebContentsEflDelegate::NewWindowDecideCallback);
~_Ewk_Policy_Decision();
scoped_refptr<PolicyResponseDelegateEfl> policy_response_delegate_;
scoped_ptr<NavigationPolicyHandlerEfl> navigation_policy_handler_;
scoped_ptr<_Ewk_Frame> frame_;
- content::WebContentsDelegate::NewWindowDecideCallback window_create_callback_;
+ content::WebContentsEflDelegate::NewWindowDecideCallback window_create_callback_;
std::string cookie_;
std::string url_;
std::string httpMethod_;
return false;
}
-bool WebContentsDelegateEfl::ShouldCreateWebContentsAsync(
- NewWindowDecideCallback callback, const GURL& target_url) {
- // this method is called ONLY when creating new window - no matter what type
- scoped_ptr<_Ewk_Policy_Decision> pd(
- new _Ewk_Policy_Decision(web_view_, callback));
- pd->ParseUrl(target_url);
- web_view_->SmartCallback<EWebViewCallbacks::NewWindowPolicyDecision>().call(pd.get());
-
- if (pd->isSuspended()) {
- // it will be deleted later after it's used/ignored/downloaded
- pd.release();
- } else if (!pd->isDecided()) {
- pd->Use();
- }
- return true;
-}
-
-bool WebContentsDelegateEfl::WebContentsCreateAsync(
- WebContentsCreateCallback callback) {
- web_view_->CreateNewWindow(callback);
- return true;
-}
-
void WebContentsDelegateEfl::CloseContents(WebContents* source) {
web_view_->SmartCallback<EWebViewCallbacks::WindowClosed>().call();
}
const std::string& partition_id,
SessionStorageNamespace* session_storage_namespace) override;
- bool ShouldCreateWebContentsAsync(NewWindowDecideCallback, const GURL&) override;
-
- bool WebContentsCreateAsync(WebContentsCreateCallback) override;
-
virtual void CloseContents(WebContents* source) override;
void EnterFullscreenModeForTab(content::WebContents* web_contents,
--- /dev/null
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "web_contents_efl_delegate_ewk.h"
+
+#include "eweb_view.h"
+
+WebContentsEflDelegateEwk::WebContentsEflDelegateEwk(EWebView* wv)
+ : web_view_(wv) {
+}
+
+bool WebContentsEflDelegateEwk::ShouldCreateWebContentsAsync(
+ content::WebContentsEflDelegate::NewWindowDecideCallback callback,
+ const GURL& target_url) {
+ // this method is called ONLY when creating new window - no matter what type
+ scoped_ptr<_Ewk_Policy_Decision> pd(
+ new _Ewk_Policy_Decision(web_view_, callback));
+ pd->ParseUrl(target_url);
+ web_view_->SmartCallback<EWebViewCallbacks::NewWindowPolicyDecision>().call(pd.get());
+
+ if (pd->isSuspended()) {
+ // it will be deleted later after it's used/ignored/downloaded
+ pd.release();
+ } else if (!pd->isDecided()) {
+ pd->Use();
+ }
+ return true;
+}
+
+bool WebContentsEflDelegateEwk::WebContentsCreateAsync(
+ content::WebContentsEflDelegate::WebContentsCreateCallback callback) {
+ web_view_->CreateNewWindow(callback);
+ return true;
+}
--- /dev/null
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_EFL_DELEGATE_EWK_H_
+#define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_EFL_DELEGATE_EWK_H_
+
+#include "content/public/browser/web_contents_efl_delegate.h"
+
+class EWebView;
+
+class WebContentsEflDelegateEwk : public content::WebContentsEflDelegate {
+ public:
+ WebContentsEflDelegateEwk(EWebView*);
+
+ bool ShouldCreateWebContentsAsync(
+ NewWindowDecideCallback, const GURL&) override;
+
+ bool WebContentsCreateAsync(WebContentsCreateCallback) override;
+
+ private:
+ EWebView* web_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebContentsEflDelegateEwk);
+};
+
+#endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_EFL_DELEGATE_EWK_H_