| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/gtk_signal.h" |
| 10 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 11 #include "chrome/browser/gtk/focus_store_gtk.h" | 12 #include "chrome/browser/gtk/focus_store_gtk.h" |
| 12 #include "chrome/browser/tab_contents/tab_contents_view.h" | 13 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 13 #include "chrome/common/notification_observer.h" | 14 #include "chrome/common/notification_observer.h" |
| 14 #include "chrome/common/notification_registrar.h" | 15 #include "chrome/common/notification_registrar.h" |
| 15 #include "chrome/common/owned_widget_gtk.h" | 16 #include "chrome/common/owned_widget_gtk.h" |
| 16 | 17 |
| 17 class ConstrainedWindowGtk; | 18 class ConstrainedWindowGtk; |
| 18 class GtkThemeProperties; | 19 class GtkThemeProperties; |
| 19 class RenderViewContextMenuGtk; | 20 class RenderViewContextMenuGtk; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 private: | 72 private: |
| 72 // Insert the given widget into the content area. Should only be used for | 73 // Insert the given widget into the content area. Should only be used for |
| 73 // web pages and the like (including interstitials and sad tab). Note that | 74 // web pages and the like (including interstitials and sad tab). Note that |
| 74 // this will be perfectly happy to insert overlapping render views, so care | 75 // this will be perfectly happy to insert overlapping render views, so care |
| 75 // should be taken that the correct one is hidden/shown. | 76 // should be taken that the correct one is hidden/shown. |
| 76 void InsertIntoContentArea(GtkWidget* widget); | 77 void InsertIntoContentArea(GtkWidget* widget); |
| 77 | 78 |
| 78 void CancelDragIfAny(); | 79 void CancelDragIfAny(); |
| 79 | 80 |
| 80 // We keep track of the timestamp of the latest mousedown event. | 81 // We keep track of the timestamp of the latest mousedown event. |
| 81 static gboolean OnMouseDown(GtkWidget* widget, | 82 CHROMEGTK_CALLBACK_1(TabContentsViewGtk, gboolean, OnMouseDown, |
| 82 GdkEventButton* event, TabContentsViewGtk* view); | 83 GdkEventButton*); |
| 83 | 84 |
| 84 // Used to adjust the size of its children when the size of |expanded_| is | 85 // Used to adjust the size of its children when the size of |expanded_| is |
| 85 // changed. | 86 // changed. |
| 86 static void OnChildSizeRequest(GtkWidget* widget, | 87 CHROMEGTK_CALLBACK_2(TabContentsViewGtk, void, OnChildSizeRequest, |
| 87 GtkWidget* child, | 88 GtkWidget*, GtkRequisition*); |
| 88 GtkRequisition* requisition, | |
| 89 TabContentsViewGtk* view); | |
| 90 | 89 |
| 91 // Used to propagate the size change of |expanded_| to our RWHV to resize the | 90 // Used to propagate the size change of |expanded_| to our RWHV to resize the |
| 92 // renderer content. | 91 // renderer content. |
| 93 static void OnSizeAllocate(GtkWidget* widget, | 92 CHROMEGTK_CALLBACK_1(TabContentsViewGtk, void, OnSizeAllocate, |
| 94 GtkAllocation* allocation, | 93 GtkAllocation*); |
| 95 TabContentsViewGtk* view); | |
| 96 | 94 |
| 97 static void OnSetFloatingPosition( | 95 CHROMEGTK_CALLBACK_1(TabContentsViewGtk, void, OnSetFloatingPosition, |
| 98 GtkFloatingContainer* floating_container, GtkAllocation* allocation, | 96 GtkAllocation*); |
| 99 TabContentsViewGtk* tab_contents_view); | |
| 100 | 97 |
| 101 // Contains |expanded_| as its GtkBin member. | 98 // Contains |expanded_| as its GtkBin member. |
| 102 OwnedWidgetGtk floating_; | 99 OwnedWidgetGtk floating_; |
| 103 | 100 |
| 104 // This container holds the tab's web page views. It is a GtkExpandedContainer | 101 // This container holds the tab's web page views. It is a GtkExpandedContainer |
| 105 // so that we can control the size of the web pages. | 102 // so that we can control the size of the web pages. |
| 106 GtkWidget* expanded_; | 103 GtkWidget* expanded_; |
| 107 | 104 |
| 108 // The context menu is reset every time we show it, but we keep a pointer to | 105 // The context menu is reset every time we show it, but we keep a pointer to |
| 109 // between uses so that it won't go out of scope before we're done with it. | 106 // between uses so that it won't go out of scope before we're done with it. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 132 scoped_ptr<TabContentsDragSource> drag_source_; | 129 scoped_ptr<TabContentsDragSource> drag_source_; |
| 133 | 130 |
| 134 // The size we want the tab contents view to be. We keep this in a separate | 131 // The size we want the tab contents view to be. We keep this in a separate |
| 135 // variable because resizing in GTK+ is async. | 132 // variable because resizing in GTK+ is async. |
| 136 gfx::Size requested_size_; | 133 gfx::Size requested_size_; |
| 137 | 134 |
| 138 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); | 135 DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk); |
| 139 }; | 136 }; |
| 140 | 137 |
| 141 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ | 138 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_GTK_H_ |
| OLD | NEW |