| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "content/public/browser/web_contents_view_gtk_delegate.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 ChromeWebContentsViewGtkDelegate | |
| 23 : public content::WebContentsViewGtkDelegate { | |
| 24 public: | |
| 25 ChromeWebContentsViewGtkDelegate(); | |
| 26 virtual ~ChromeWebContentsViewGtkDelegate(); | |
| 27 | |
| 28 // Unlike Windows, ConstrainedWindows need to collaborate with the | |
| 29 // TabContentsViewGtk to position the dialogs. | |
| 30 void AttachConstrainedWindow(ConstrainedWindowGtk* constrained_window); | |
| 31 void RemoveConstrainedWindow(ConstrainedWindowGtk* constrained_window); | |
| 32 | |
| 33 // Overridden from WebContentsViewGtkDelegate: | |
| 34 virtual void WrapView(content::TabContentsViewGtk* view) OVERRIDE; | |
| 35 virtual gfx::NativeView GetNativeView() const OVERRIDE; | |
| 36 virtual void OnCreateViewForWidget() OVERRIDE; | |
| 37 virtual void Focus() OVERRIDE; | |
| 38 virtual gboolean OnNativeViewFocusEvent(GtkWidget* widget, | |
| 39 GtkDirectionType type, | |
| 40 gboolean* return_value) OVERRIDE; | |
| 41 virtual void ShowContextMenu( | |
| 42 const content::ContextMenuParams& params) OVERRIDE; | |
| 43 | |
| 44 private: | |
| 45 // Sets the location of the constrained windows. | |
| 46 CHROMEGTK_CALLBACK_1(ChromeWebContentsViewGtkDelegate, void, | |
| 47 OnSetFloatingPosition, | |
| 48 GtkAllocation*); | |
| 49 | |
| 50 // Contains |expanded_| as its GtkBin member. | |
| 51 ui::OwnedWidgetGtk floating_; | |
| 52 | |
| 53 // Our owner. Also owns our child widgets. | |
| 54 content::TabContentsViewGtk* view_; | |
| 55 | |
| 56 // The UI for the constrained dialog currently displayed. This is owned by | |
| 57 // TabContents, not the view. | |
| 58 ConstrainedWindowGtk* constrained_window_; | |
| 59 | |
| 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. | |
| 62 scoped_ptr<RenderViewContextMenuGtk> context_menu_; | |
| 63 | |
| 64 // The chrome specific delegate that receives events from WebDragDestGtk. | |
| 65 scoped_ptr<WebDragBookmarkHandlerGtk> bookmark_handler_gtk_; | |
| 66 }; | |
| 67 | |
| 68 #endif // CHROME_BROWSER_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_GTK_DELEGATE_H_ | |
| OLD | NEW |