#include "base/strings/utf_string_conversions.h"
#include "content/browser/renderer_host/render_widget_host_view_efl.h"
#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/common/view_messages.h"
-#include "content/public/browser/screen_orientation_dispatcher_host.h"
-#include "content/public/browser/web_contents_view_delegate.h"
#include "content/browser/web_contents/web_drag_dest_efl.h"
#include "content/browser/web_contents/web_drag_source_efl.h"
+#include "content/common/view_messages.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/screen_orientation_dispatcher_host.h"
+#include "content/public/browser/web_contents_view_delegate.h"
+#include "content/public/browser/web_contents_view_efl_delegate.h"
#include "efl/window_factory.h"
#include "ui/events/event_switches.h"
#include "ui/events/platform/platform_event_source.h"
WebContentsViewEfl::~WebContentsViewEfl() {
}
+void WebContentsViewEfl::SetEflDelegate(WebContentsViewEflDelegate* delegate) {
+ efl_delegate_.reset(delegate);
+}
+
void WebContentsViewEfl::CreateView(const gfx::Size& initial_size,
gfx::NativeView context) {
Evas_Object* root_window = efl::WindowFactory::GetHostWindow(web_contents_);
}
void WebContentsViewEfl::SetPageTitle(const base::string16& title) {
- if (delegate_)
- delegate_->SetPageTitle(title);
+ if (efl_delegate_)
+ efl_delegate_->SetPageTitle(title);
}
void WebContentsViewEfl::UpdateDragDest(RenderViewHost* host) {
const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
- if (delegate_)
- delegate_->ShowPopupMenu(render_frame_host, bounds,
+ if (efl_delegate_)
+ efl_delegate_->ShowPopupMenu(render_frame_host, bounds,
item_height, item_font_size, selected_item, items,
right_aligned, allow_multiple_selection);
}
void WebContentsViewEfl::HidePopupMenu() {
- if (delegate_)
- delegate_->HidePopupMenu();
+ if (efl_delegate_)
+ efl_delegate_->HidePopupMenu();
}
void WebContentsViewEfl::StartDragging(
class WebContents;
class WebContentsViewDelegate;
+class WebContentsViewEflDelegate;
class WebDragDestEfl;
class WebDragSourceEfl;
class WebDragDestDelegate;
WebContentsViewDelegate* delegate = NULL);
~WebContentsViewEfl() override;
+ void SetEflDelegate(WebContentsViewEflDelegate*);
+
// content::WebContentsView implementation.
void CreateView(const gfx::Size&, gfx::NativeView context) override;
RenderWidgetHostViewBase* CreateViewForWidget(
void SetPageScaleFactor(float);
private:
- // Our optional views wrapper.
+ // Our optional, generic views wrapper.
scoped_ptr<WebContentsViewDelegate> delegate_;
+ // Delegate specific to EFL port of chromium.
+ // May be NULL in case of non EWK apps.
+ scoped_ptr<WebContentsViewEflDelegate> efl_delegate_;
+
Evas_Object* native_view_;
WebDragDestDelegate* drag_dest_delegate_;
'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_view_efl_delegate.h',
],
'sources/': [
['include', '^browser/renderer_host/ui_events_helper.cc'],
--- /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.
+
+#ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_EFL_DELEGATE_H_
+#define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_EFL_DELEGATE_H_
+
+#include <vector>
+
+#include "content/common/content_export.h"
+#include "content/public/common/menu_item.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace content {
+
+class RenderFrameHost;
+
+class WebContentsViewEflDelegate {
+ public:
+ WebContentsViewEflDelegate() {};
+
+ virtual void ShowPopupMenu(
+ RenderFrameHost* render_frame_host,
+ const gfx::Rect& bounds,
+ int item_height,
+ double item_font_size,
+ int selected_item,
+ const std::vector<MenuItem>& items,
+ bool right_aligned,
+ bool allow_multiple_selection) = 0;
+ virtual void HidePopupMenu() = 0;
+
+ virtual void SetPageTitle(const base::string16& title) = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_EFL_DELEGATE_H_
'web_contents_delegate_efl.h',
'web_contents_view_delegate_ewk.cc',
'web_contents_view_delegate_ewk.h',
+ 'web_contents_view_efl_delegate_ewk.cc',
+ 'web_contents_view_efl_delegate_ewk.h',
'web_process_content_main_delegate_efl.cc',
'web_process_content_main_delegate_efl.h',
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "ui/events/event_switches.h"
+#include "web_contents_view_efl_delegate_ewk.h"
#if defined(OS_TIZEN_MOBILE)
#include "browser/motion/wkext_motion.h"
#endif
}
web_contents_delegate_.reset(new WebContentsDelegateEfl(this));
web_contents_->SetDelegate(web_contents_delegate_.get());
+ GetWebContentsViewEfl()->SetEflDelegate(
+ new WebContentsViewEflDelegateEwk(this));
back_forward_list_.reset(new _Ewk_Back_Forward_List(
web_contents_->GetController()));
-
back_forward_list_.reset(
new _Ewk_Back_Forward_List(web_contents_->GetController()));
}
void WebContentsViewDelegateEwk::ShowContextMenu(
- content::RenderFrameHost* render_frame_host,
- const content::ContextMenuParams& params) {
+ content::RenderFrameHost* render_frame_host,
+ const content::ContextMenuParams& params) {
web_view_->ShowContextMenu(params);
}
-
-void WebContentsViewDelegateEwk::ShowPopupMenu(
- content::RenderFrameHost* render_frame_host,
- const gfx::Rect& bounds,
- int item_height,
- double item_font_size,
- int selected_item,
- const std::vector<content::MenuItem>& items,
- bool right_aligned,
- bool allow_multiple_selection) {
- web_view_->ShowPopupMenu(items, selected_item, allow_multiple_selection);
-}
-
-void WebContentsViewDelegateEwk::HidePopupMenu() {
- web_view_->HidePopupMenu();
-}
-
-void WebContentsViewDelegateEwk::SetPageTitle(const base::string16& title) {
- web_view_->SmartCallback<EWebViewCallbacks::TitleChange>().call(base::UTF16ToUTF8(title).c_str());
-}
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEB_CONTENTS_VIEW_DELEGATE_EFL
-#define WEB_CONTENTS_VIEW_DELEGATE_EFL
+#ifndef WEB_CONTENTS_VIEW_EFL_DELEGATE_EWK
+#define WEB_CONTENTS_VIEW_EFL_DELEGATE_EWK
#include "content/public/browser/web_contents_view_delegate.h"
class RenderFrameHost;
}
-class WebContentsViewDelegateEwk : public content::WebContentsViewDelegate {
+class WebContentsViewDelegateEwk
+ : public content::WebContentsViewDelegate {
public:
WebContentsViewDelegateEwk(EWebView*);
void ShowContextMenu(
content::RenderFrameHost* render_frame_host,
const content::ContextMenuParams& params) override;
- void ShowPopupMenu(
- content::RenderFrameHost* render_frame_host,
- const gfx::Rect& bounds,
- int item_height,
- double item_font_size,
- int selected_item,
- const std::vector<content::MenuItem>& items,
- bool right_aligned,
- bool allow_multiple_selection) override;
- void HidePopupMenu() override;
-
- void SetPageTitle(const base::string16& title) override;
private:
EWebView* web_view_;
};
-#endif // WEB_CONTENTS_VIEW_DELEGATE_EFL
+#endif // WEB_CONTENTS_VIEW_EFL_DELEGATE_EWK
--- /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 "web_contents_view_efl_delegate_ewk.h"
+
+#include "eweb_view.h"
+
+WebContentsViewEflDelegateEwk::WebContentsViewEflDelegateEwk(EWebView* wv)
+ : web_view_(wv) {
+}
+
+void WebContentsViewEflDelegateEwk::ShowPopupMenu(
+ content::RenderFrameHost* render_frame_host,
+ const gfx::Rect& bounds,
+ int item_height,
+ double item_font_size,
+ int selected_item,
+ const std::vector<content::MenuItem>& items,
+ bool right_aligned,
+ bool allow_multiple_selection) {
+ web_view_->ShowPopupMenu(items, selected_item, allow_multiple_selection);
+}
+
+void WebContentsViewEflDelegateEwk::HidePopupMenu() {
+ web_view_->HidePopupMenu();
+}
+
+void WebContentsViewEflDelegateEwk::SetPageTitle(const base::string16& title) {
+ web_view_->SmartCallback<EWebViewCallbacks::TitleChange>().
+ call(base::UTF16ToUTF8(title).c_str());
+}
--- /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.
+
+#ifndef WEB_CONTENTS_VIEW_EFL_DELEGATE_EWK
+#define WEB_CONTENTS_VIEW_EFL_DELEGATE_EWK
+
+#include "content/public/browser/web_contents_view_efl_delegate.h"
+
+#include "content/public/common/menu_item.h"
+
+class EWebView;
+
+namespace content {
+class RenderFrameHost;
+}
+
+class WebContentsViewEflDelegateEwk
+ : public content::WebContentsViewEflDelegate {
+ public:
+ WebContentsViewEflDelegateEwk(EWebView*);
+
+ void ShowPopupMenu(
+ content::RenderFrameHost* render_frame_host,
+ const gfx::Rect& bounds,
+ int item_height,
+ double item_font_size,
+ int selected_item,
+ const std::vector<content::MenuItem>& items,
+ bool right_aligned,
+ bool allow_multiple_selection) override;
+ void HidePopupMenu() override;
+
+ void SetPageTitle(const base::string16& title) override;
+
+ private:
+ EWebView* web_view_;
+};
+
+#endif // WEB_CONTENTS_VIEW_EFL_DELEGATE_EWK
+