Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / shell / browser / shell_web_contents_view_delegate.h
1 // Copyright 2013 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.
4
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_
7
8 #include "content/public/browser/web_contents.h"
9 #include "content/public/browser/web_contents_view_delegate.h"
10 #include "content/public/common/context_menu_params.h"
11
12 #if defined(TOOLKIT_GTK)
13 #include "ui/base/gtk/gtk_signal.h"
14 #include "ui/base/gtk/owned_widget_gtk.h"
15 #endif
16
17 namespace content {
18
19 class ShellWebContentsViewDelegate : public WebContentsViewDelegate {
20  public:
21   explicit ShellWebContentsViewDelegate(WebContents* web_contents);
22   virtual ~ShellWebContentsViewDelegate();
23
24   // Overridden from WebContentsViewDelegate:
25   virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
26                                const ContextMenuParams& params) OVERRIDE;
27   virtual WebDragDestDelegate* GetDragDestDelegate() OVERRIDE;
28
29 #if defined(TOOLKIT_GTK)
30   virtual void Initialize(GtkWidget* expanded_container,
31                           ui::FocusStoreGtk* focus_store) OVERRIDE;
32   virtual gfx::NativeView GetNativeView() const OVERRIDE;
33   virtual void Focus() OVERRIDE;
34   virtual gboolean OnNativeViewFocusEvent(GtkWidget* widget,
35                                           GtkDirectionType type,
36                                           gboolean* return_value) OVERRIDE;
37 #elif defined(OS_MACOSX)
38   virtual NSObject<RenderWidgetHostViewMacDelegate>*
39       CreateRenderWidgetHostViewDelegate(
40           RenderWidgetHost* render_widget_host) OVERRIDE;
41   void ActionPerformed(int id);
42 #elif defined(OS_WIN)
43   virtual void StoreFocus() OVERRIDE;
44   virtual void RestoreFocus() OVERRIDE;
45   virtual bool Focus() OVERRIDE;
46   virtual void TakeFocus(bool reverse) OVERRIDE;
47   virtual void SizeChanged(const gfx::Size& size) OVERRIDE;
48   void MenuItemSelected(int selection);
49 #endif
50
51  private:
52   WebContents* web_contents_;
53   ContextMenuParams params_;
54
55 #if defined(TOOLKIT_GTK)
56   ui::OwnedWidgetGtk floating_;
57   GtkWidget* expanded_container_;
58
59   CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void,
60                        OnBackMenuActivated);
61   CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void,
62                        OnForwardMenuActivated);
63   CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void,
64                        OnReloadMenuActivated);
65   CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void,
66                        OnOpenURLMenuActivated);
67   CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void,
68                        OnCutMenuActivated);
69   CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void,
70                        OnCopyMenuActivated);
71   CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void,
72                        OnPasteMenuActivated);
73   CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void,
74                        OnDeleteMenuActivated);
75   CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void,
76                        OnInspectMenuActivated);
77 #endif
78
79   DISALLOW_COPY_AND_ASSIGN(ShellWebContentsViewDelegate);
80 };
81
82 }  // namespace content
83
84 #endif // CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_