| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ |
| 6 #define CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ | 6 #define CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 #include "content/public/browser/web_contents_view_delegate.h" | 9 #include "content/public/browser/web_contents_view_delegate.h" |
| 10 #include "content/public/common/context_menu_params.h" | 10 #include "content/public/common/context_menu_params.h" |
| 11 | 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 { | 12 namespace content { |
| 18 | 13 |
| 19 class ShellWebContentsViewDelegate : public WebContentsViewDelegate { | 14 class ShellWebContentsViewDelegate : public WebContentsViewDelegate { |
| 20 public: | 15 public: |
| 21 explicit ShellWebContentsViewDelegate(WebContents* web_contents); | 16 explicit ShellWebContentsViewDelegate(WebContents* web_contents); |
| 22 virtual ~ShellWebContentsViewDelegate(); | 17 virtual ~ShellWebContentsViewDelegate(); |
| 23 | 18 |
| 24 // Overridden from WebContentsViewDelegate: | 19 // Overridden from WebContentsViewDelegate: |
| 25 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, | 20 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, |
| 26 const ContextMenuParams& params) OVERRIDE; | 21 const ContextMenuParams& params) OVERRIDE; |
| 27 virtual WebDragDestDelegate* GetDragDestDelegate() OVERRIDE; | 22 virtual WebDragDestDelegate* GetDragDestDelegate() OVERRIDE; |
| 28 | 23 |
| 29 #if defined(TOOLKIT_GTK) | 24 #if defined(OS_MACOSX) |
| 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>* | 25 virtual NSObject<RenderWidgetHostViewMacDelegate>* |
| 39 CreateRenderWidgetHostViewDelegate( | 26 CreateRenderWidgetHostViewDelegate( |
| 40 RenderWidgetHost* render_widget_host) OVERRIDE; | 27 RenderWidgetHost* render_widget_host) OVERRIDE; |
| 41 void ActionPerformed(int id); | 28 void ActionPerformed(int id); |
| 42 #elif defined(OS_WIN) | 29 #elif defined(OS_WIN) |
| 43 virtual void StoreFocus() OVERRIDE; | 30 virtual void StoreFocus() OVERRIDE; |
| 44 virtual void RestoreFocus() OVERRIDE; | 31 virtual void RestoreFocus() OVERRIDE; |
| 45 virtual bool Focus() OVERRIDE; | 32 virtual bool Focus() OVERRIDE; |
| 46 virtual void TakeFocus(bool reverse) OVERRIDE; | 33 virtual void TakeFocus(bool reverse) OVERRIDE; |
| 47 virtual void SizeChanged(const gfx::Size& size) OVERRIDE; | 34 virtual void SizeChanged(const gfx::Size& size) OVERRIDE; |
| 48 void MenuItemSelected(int selection); | 35 void MenuItemSelected(int selection); |
| 49 #endif | 36 #endif |
| 50 | 37 |
| 51 private: | 38 private: |
| 52 WebContents* web_contents_; | 39 WebContents* web_contents_; |
| 53 ContextMenuParams params_; | 40 ContextMenuParams params_; |
| 54 | 41 |
| 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); | 42 DISALLOW_COPY_AND_ASSIGN(ShellWebContentsViewDelegate); |
| 80 }; | 43 }; |
| 81 | 44 |
| 82 } // namespace content | 45 } // namespace content |
| 83 | 46 |
| 84 #endif // CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ | 47 #endif // CONTENT_SHELL_BROWSER_SHELL_WEB_CONTENTS_VIEW_DELEGATE_H_ |
| OLD | NEW |