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.
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_
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"
12 #if defined(TOOLKIT_GTK)
13 #include "ui/base/gtk/gtk_signal.h"
14 #include "ui/base/gtk/owned_widget_gtk.h"
19 class ShellWebContentsViewDelegate
: public WebContentsViewDelegate
{
21 explicit ShellWebContentsViewDelegate(WebContents
* web_contents
);
22 virtual ~ShellWebContentsViewDelegate();
24 // Overridden from WebContentsViewDelegate:
25 virtual void ShowContextMenu(RenderFrameHost
* render_frame_host
,
26 const ContextMenuParams
& params
) OVERRIDE
;
27 virtual WebDragDestDelegate
* GetDragDestDelegate() OVERRIDE
;
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
);
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
);
52 WebContents
* web_contents_
;
53 ContextMenuParams params_
;
55 #if defined(TOOLKIT_GTK)
56 ui::OwnedWidgetGtk floating_
;
57 GtkWidget
* expanded_container_
;
59 CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate
, void,
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,
69 CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate
, void,
71 CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate
, void,
72 OnPasteMenuActivated
);
73 CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate
, void,
74 OnDeleteMenuActivated
);
75 CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate
, void,
76 OnInspectMenuActivated
);
79 DISALLOW_COPY_AND_ASSIGN(ShellWebContentsViewDelegate
);
82 } // namespace content
84 #endif // CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_