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