OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_TAB_CONTENTS_CHROME_TAB_CONTENTS_VIEW_WRAPPER_GTK_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_CHROME_TAB_CONTENTS_VIEW_WRAPPER_GTK_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/browser/tab_contents/tab_contents_view_wrapper_gtk.h" | 11 #include "content/public/browser/web_contents_view_gtk_delegate.h" |
12 #include "ui/base/gtk/gtk_signal.h" | 12 #include "ui/base/gtk/gtk_signal.h" |
13 #include "ui/base/gtk/owned_widget_gtk.h" | 13 #include "ui/base/gtk/owned_widget_gtk.h" |
14 | 14 |
15 class ConstrainedWindowGtk; | 15 class ConstrainedWindowGtk; |
16 class RenderViewContextMenuGtk; | 16 class RenderViewContextMenuGtk; |
17 class TabContents; | 17 class TabContents; |
18 class WebDragBookmarkHandlerGtk; | 18 class WebDragBookmarkHandlerGtk; |
19 | 19 |
20 // A chrome/ specific class that extends TabContentsViewGtk with features like | 20 // A chrome/ specific class that extends TabContentsViewGtk with features like |
21 // constrained windows, which live in chrome/. | 21 // constrained windows, which live in chrome/. |
22 class ChromeTabContentsViewWrapperGtk | 22 class ChromeWebContentsViewGtkDelegate |
23 : public content::TabContentsViewWrapperGtk { | 23 : public content::WebContentsViewGtkDelegate { |
24 public: | 24 public: |
25 ChromeTabContentsViewWrapperGtk(); | 25 ChromeWebContentsViewGtkDelegate(); |
26 virtual ~ChromeTabContentsViewWrapperGtk(); | 26 virtual ~ChromeWebContentsViewGtkDelegate(); |
27 | 27 |
28 // Unlike Windows, ConstrainedWindows need to collaborate with the | 28 // Unlike Windows, ConstrainedWindows need to collaborate with the |
29 // TabContentsViewGtk to position the dialogs. | 29 // TabContentsViewGtk to position the dialogs. |
30 void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window); | 30 void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window); |
31 void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window); | 31 void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window); |
32 | 32 |
33 // Overridden from TabContentsViewGtkWrapper: | 33 // Overridden from WebContentsViewGtkDelegate: |
34 virtual void WrapView(content::TabContentsViewGtk* view) OVERRIDE; | 34 virtual void WrapView(content::TabContentsViewGtk* view) OVERRIDE; |
35 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 35 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
36 virtual void OnCreateViewForWidget() OVERRIDE; | 36 virtual void OnCreateViewForWidget() OVERRIDE; |
37 virtual void Focus() OVERRIDE; | 37 virtual void Focus() OVERRIDE; |
38 virtual gboolean OnNativeViewFocusEvent(GtkWidget* widget, | 38 virtual gboolean OnNativeViewFocusEvent(GtkWidget* widget, |
39 GtkDirectionType type, | 39 GtkDirectionType type, |
40 gboolean* return_value) OVERRIDE; | 40 gboolean* return_value) OVERRIDE; |
41 virtual void ShowContextMenu( | 41 virtual void ShowContextMenu( |
42 const content::ContextMenuParams& params) OVERRIDE; | 42 const content::ContextMenuParams& params) OVERRIDE; |
43 | 43 |
44 private: | 44 private: |
45 // Sets the location of the constrained windows. | 45 // Sets the location of the constrained windows. |
46 CHROMEGTK_CALLBACK_1(ChromeTabContentsViewWrapperGtk, void, | 46 CHROMEGTK_CALLBACK_1(ChromeWebContentsViewGtkDelegate, void, |
47 OnSetFloatingPosition, | 47 OnSetFloatingPosition, |
48 GtkAllocation*); | 48 GtkAllocation*); |
49 | 49 |
50 // Contains |expanded_| as its GtkBin member. | 50 // Contains |expanded_| as its GtkBin member. |
51 ui::OwnedWidgetGtk floating_; | 51 ui::OwnedWidgetGtk floating_; |
52 | 52 |
53 // Our owner. Also owns our child widgets. | 53 // Our owner. Also owns our child widgets. |
54 content::TabContentsViewGtk* view_; | 54 content::TabContentsViewGtk* view_; |
55 | 55 |
56 // The UI for the constrained dialog currently displayed. This is owned by | 56 // The UI for the constrained dialog currently displayed. This is owned by |
57 // TabContents, not the view. | 57 // TabContents, not the view. |
58 ConstrainedWindowGtk* constrained_window_; | 58 ConstrainedWindowGtk* constrained_window_; |
59 | 59 |
60 // The context menu is reset every time we show it, but we keep a pointer to | 60 // The context menu is reset every time we show it, but we keep a pointer to |
61 // between uses so that it won't go out of scope before we're done with it. | 61 // between uses so that it won't go out of scope before we're done with it. |
62 scoped_ptr<RenderViewContextMenuGtk> context_menu_; | 62 scoped_ptr<RenderViewContextMenuGtk> context_menu_; |
63 | 63 |
64 // The chrome specific delegate that receives events from WebDragDestGtk. | 64 // The chrome specific delegate that receives events from WebDragDestGtk. |
65 scoped_ptr<WebDragBookmarkHandlerGtk> bookmark_handler_gtk_; | 65 scoped_ptr<WebDragBookmarkHandlerGtk> bookmark_handler_gtk_; |
66 }; | 66 }; |
67 | 67 |
68 #endif // CHROME_BROWSER_TAB_CONTENTS_CHROME_TAB_CONTENTS_VIEW_WRAPPER_GTK_H_ | 68 #endif // CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_ |
OLD | NEW |