[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame^] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
[email protected] | 4c2aa39 | 2012-09-03 01:29:42 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame^] | 5 | #ifndef CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ |
| 6 | #define CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ |
[email protected] | 4c2aa39 | 2012-09-03 01:29:42 | [diff] [blame] | 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: |
[email protected] | f56c787 | 2013-06-18 12:31:57 | [diff] [blame] | 25 | virtual void ShowContextMenu(const ContextMenuParams& params) OVERRIDE; |
[email protected] | 4c2aa39 | 2012-09-03 01:29:42 | [diff] [blame] | 26 | virtual WebDragDestDelegate* GetDragDestDelegate() OVERRIDE; |
| 27 | |
| 28 | #if defined(TOOLKIT_GTK) |
| 29 | virtual void Initialize(GtkWidget* expanded_container, |
| 30 | ui::FocusStoreGtk* focus_store) OVERRIDE; |
| 31 | virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 32 | virtual void Focus() OVERRIDE; |
| 33 | virtual gboolean OnNativeViewFocusEvent(GtkWidget* widget, |
| 34 | GtkDirectionType type, |
| 35 | gboolean* return_value) OVERRIDE; |
[email protected] | dcbe5fe3 | 2012-09-10 10:18:32 | [diff] [blame] | 36 | #elif defined(OS_MACOSX) |
| 37 | virtual NSObject<RenderWidgetHostViewMacDelegate>* |
| 38 | CreateRenderWidgetHostViewDelegate( |
| 39 | RenderWidgetHost* render_widget_host) OVERRIDE; |
| 40 | void ActionPerformed(int id); |
[email protected] | 4c9bf348 | 2012-09-12 14:35:35 | [diff] [blame] | 41 | #elif defined(OS_WIN) |
| 42 | virtual void StoreFocus() OVERRIDE; |
| 43 | virtual void RestoreFocus() OVERRIDE; |
| 44 | virtual bool Focus() OVERRIDE; |
| 45 | virtual void TakeFocus(bool reverse) OVERRIDE; |
| 46 | virtual void SizeChanged(const gfx::Size& size) OVERRIDE; |
| 47 | void MenuItemSelected(int selection); |
[email protected] | 4c2aa39 | 2012-09-03 01:29:42 | [diff] [blame] | 48 | #endif |
| 49 | |
| 50 | private: |
| 51 | WebContents* web_contents_; |
| 52 | ContextMenuParams params_; |
| 53 | |
| 54 | #if defined(TOOLKIT_GTK) |
| 55 | ui::OwnedWidgetGtk floating_; |
| 56 | GtkWidget* expanded_container_; |
| 57 | |
| 58 | CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void, |
| 59 | OnBackMenuActivated); |
| 60 | CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void, |
| 61 | OnForwardMenuActivated); |
| 62 | CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void, |
| 63 | OnReloadMenuActivated); |
| 64 | CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void, |
| 65 | OnOpenURLMenuActivated); |
| 66 | CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void, |
| 67 | OnCutMenuActivated); |
| 68 | CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void, |
| 69 | OnCopyMenuActivated); |
| 70 | CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void, |
| 71 | OnPasteMenuActivated); |
| 72 | CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void, |
| 73 | OnDeleteMenuActivated); |
| 74 | CHROMEGTK_CALLBACK_0(ShellWebContentsViewDelegate, void, |
| 75 | OnInspectMenuActivated); |
| 76 | #endif |
| 77 | |
| 78 | DISALLOW_COPY_AND_ASSIGN(ShellWebContentsViewDelegate); |
| 79 | }; |
| 80 | |
| 81 | } // namespace content |
| 82 | |
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame^] | 83 | #endif // CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ |