| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_TAB_CONTENTS_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "chrome/browser/gtk/focus_store_gtk.h" | 11 #include "chrome/browser/gtk/focus_store_gtk.h" |
| 12 #include "chrome/browser/tab_contents/tab_contents_view.h" | 12 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 13 #include "chrome/common/notification_observer.h" | 13 #include "chrome/common/notification_observer.h" |
| 14 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
| 15 #include "chrome/common/owned_widget_gtk.h" | 15 #include "chrome/common/owned_widget_gtk.h" |
| 16 | 16 |
| 17 class BlockedPopupContainerViewGtk; |
| 17 class RenderViewContextMenuGtk; | 18 class RenderViewContextMenuGtk; |
| 18 class SadTabGtk; | 19 class SadTabGtk; |
| 20 typedef struct _GtkFloatingContainer GtkFloatingContainer; |
| 19 | 21 |
| 20 class TabContentsViewGtk : public TabContentsView, | 22 class TabContentsViewGtk : public TabContentsView, |
| 21 public NotificationObserver { | 23 public NotificationObserver { |
| 22 public: | 24 public: |
| 23 // The corresponding TabContents is passed in the constructor, and manages our | 25 // The corresponding TabContents is passed in the constructor, and manages our |
| 24 // lifetime. This doesn't need to be the case, but is this way currently | 26 // lifetime. This doesn't need to be the case, but is this way currently |
| 25 // because that's what was easiest when they were split. | 27 // because that's what was easiest when they were split. |
| 26 explicit TabContentsViewGtk(TabContents* tab_contents); | 28 explicit TabContentsViewGtk(TabContents* tab_contents); |
| 27 virtual ~TabContentsViewGtk(); | 29 virtual ~TabContentsViewGtk(); |
| 28 | 30 |
| 31 // Unlike Windows, the BlockedPopupContainerView needs to collaborate with |
| 32 // the TabContentsViewGtk to position the notification. |
| 33 void AttachBlockedPopupView(BlockedPopupContainerViewGtk* popup_view); |
| 34 void RemoveBlockedPopupView(BlockedPopupContainerViewGtk* popup_view); |
| 35 |
| 29 // TabContentsView implementation -------------------------------------------- | 36 // TabContentsView implementation -------------------------------------------- |
| 30 | 37 |
| 31 virtual void CreateView(); | 38 virtual void CreateView(); |
| 32 virtual RenderWidgetHostView* CreateViewForWidget( | 39 virtual RenderWidgetHostView* CreateViewForWidget( |
| 33 RenderWidgetHost* render_widget_host); | 40 RenderWidgetHost* render_widget_host); |
| 34 | 41 |
| 35 virtual gfx::NativeView GetNativeView() const; | 42 virtual gfx::NativeView GetNativeView() const; |
| 36 virtual gfx::NativeView GetContentNativeView() const; | 43 virtual gfx::NativeView GetContentNativeView() const; |
| 37 virtual gfx::NativeWindow GetTopLevelNativeWindow() const; | 44 virtual gfx::NativeWindow GetTopLevelNativeWindow() const; |
| 38 virtual void GetContainerBounds(gfx::Rect* out) const; | 45 virtual void GetContainerBounds(gfx::Rect* out) const; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 | 74 |
| 68 // We keep track of the timestamp of the latest mousedown event. | 75 // We keep track of the timestamp of the latest mousedown event. |
| 69 static gboolean OnMouseDown(GtkWidget* widget, | 76 static gboolean OnMouseDown(GtkWidget* widget, |
| 70 GdkEventButton* event, TabContentsViewGtk* view); | 77 GdkEventButton* event, TabContentsViewGtk* view); |
| 71 | 78 |
| 72 // Used to propagate size changes on |fixed_| to its children. | 79 // Used to propagate size changes on |fixed_| to its children. |
| 73 static gboolean OnSizeAllocate(GtkWidget* widget, | 80 static gboolean OnSizeAllocate(GtkWidget* widget, |
| 74 GtkAllocation* config, | 81 GtkAllocation* config, |
| 75 TabContentsViewGtk* view); | 82 TabContentsViewGtk* view); |
| 76 | 83 |
| 84 static void OnSetFloatingPosition( |
| 85 GtkFloatingContainer* floating_container, GtkAllocation* allocation, |
| 86 TabContentsViewGtk* tab_contents_view); |
| 87 |
| 88 // Contains |fixed_| as its GtkBin member and a possible floating widget from |
| 89 // |popup_view_|. |
| 90 OwnedWidgetGtk floating_; |
| 91 |
| 77 // This container holds the tab's web page views. It is a GtkFixed so that we | 92 // This container holds the tab's web page views. It is a GtkFixed so that we |
| 78 // can control the size of the web pages. | 93 // can control the size of the web pages. |
| 79 OwnedWidgetGtk fixed_; | 94 GtkWidget* fixed_; |
| 80 | 95 |
| 81 // The context menu is reset every time we show it, but we keep a pointer to | 96 // The context menu is reset every time we show it, but we keep a pointer to |
| 82 // between uses so that it won't go out of scope before we're done with it. | 97 // between uses so that it won't go out of scope before we're done with it. |
| 83 scoped_ptr<RenderViewContextMenuGtk> context_menu_; | 98 scoped_ptr<RenderViewContextMenuGtk> context_menu_; |
| 84 | 99 |
| 85 // The event time for the last mouse down we handled. We need this to properly | 100 // The event time for the last mouse down we handled. We need this to properly |
| 86 // show context menus. | 101 // show context menus. |
| 87 guint32 last_mouse_down_time_; | 102 guint32 last_mouse_down_time_; |
| 88 | 103 |
| 89 // Used to get notifications about renderers coming and going. | 104 // Used to get notifications about renderers coming and going. |
| 90 NotificationRegistrar registrar_; | 105 NotificationRegistrar registrar_; |
| 91 | 106 |
| 92 scoped_ptr<SadTabGtk> sad_tab_; | 107 scoped_ptr<SadTabGtk> sad_tab_; |
| 93 | 108 |
| 94 FocusStoreGtk focus_store_; | 109 FocusStoreGtk focus_store_; |
| 95 | 110 |
| 111 BlockedPopupContainerViewGtk* popup_view_; |
| 112 |
| 96 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); | 113 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); |
| 97 }; | 114 }; |
| 98 | 115 |
| 99 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ | 116 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| OLD | NEW |