Upstream version 11.39.244.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / tizen / xwalk_web_contents_view_delegate.h
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Copyright (c) 2014 Intel Corporation. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #ifndef XWALK_RUNTIME_BROWSER_TIZEN_XWALK_WEB_CONTENTS_VIEW_DELEGATE_H_
7 #define XWALK_RUNTIME_BROWSER_TIZEN_XWALK_WEB_CONTENTS_VIEW_DELEGATE_H_
8
9 #include "content/public/browser/web_drag_dest_delegate.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view_delegate.h"
12 #include "content/public/common/context_menu_params.h"
13 #include "ui/views/widget/widget.h"
14 #include "xwalk/application/browser/application_service.h"
15 #include "xwalk/runtime/browser/tizen/render_view_context_menu_impl.h"
16
17 namespace xwalk {
18
19 class XWalkWebContentsViewDelegate : public content::WebContentsViewDelegate {
20  public:
21   XWalkWebContentsViewDelegate(
22       content::WebContents* web_contents,
23       xwalk::application::ApplicationService* app_service);
24   virtual ~XWalkWebContentsViewDelegate();
25
26   // Overridden from WebContentsViewDelegate:
27   void ShowContextMenu(content::RenderFrameHost* render_frame_host,
28                        const content::ContextMenuParams& params) override;
29   content::WebDragDestDelegate* GetDragDestDelegate() override;
30   void StoreFocus() override;
31   void RestoreFocus() override;
32   bool Focus() override;
33   void TakeFocus(bool reverse) override;
34   void SizeChanged(const gfx::Size& size) override;
35   virtual void* CreateRenderWidgetHostViewDelegate(
36       content::RenderWidgetHost* render_widget_host);
37
38 #if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
39   void ShowDisambiguationPopup(
40       const gfx::Rect& target_rect,
41       const SkBitmap& zoomed_bitmap,
42       const gfx::NativeView content,
43       const base::Callback<void(ui::GestureEvent*)>& gesture_cb,
44       const base::Callback<void(ui::MouseEvent*)>& mouse_cb) override {
45     NOTIMPLEMENTED();
46   }
47
48   void HideDisambiguationPopup() override { NOTIMPLEMENTED(); }
49 #endif
50
51  private:
52   aura::Window* GetActiveNativeView();
53   views::Widget* GetTopLevelWidget();
54   views::FocusManager* GetFocusManager();
55   void SetInitialFocus();
56   void ShowMenu(scoped_ptr<RenderViewContextMenuImpl> menu);
57
58   content::WebContents* web_contents_;
59   xwalk::application::ApplicationService* app_service_;
60   scoped_ptr<RenderViewContextMenuImpl> context_menu_;
61
62   DISALLOW_COPY_AND_ASSIGN(XWalkWebContentsViewDelegate);
63 };
64 }  // namespace xwalk
65
66 #endif  // XWALK_RUNTIME_BROWSER_TIZEN_XWALK_WEB_CONTENTS_VIEW_DELEGATE_H_