Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: chrome/browser/gtk/tab_contents_container_gtk.h

Issue 115835: Implement GtkFloatingContainer (Closed)
Patch Set: Cleanups Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_GTK_TAB_CONTENTS_CONTAINER_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_TAB_CONTENTS_CONTAINER_GTK_H_
6 #define CHROME_BROWSER_GTK_TAB_CONTENTS_CONTAINER_GTK_H_ 6 #define CHROME_BROWSER_GTK_TAB_CONTENTS_CONTAINER_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/common/notification_registrar.h" 11 #include "chrome/common/notification_registrar.h"
12 12
13 class RenderViewHost; 13 class RenderViewHost;
14 class StatusBubbleGtk; 14 class StatusBubbleGtk;
15 class TabContents; 15 class TabContents;
16 16
17 typedef struct _GtkFloatingContainer GtkFloatingContainer;
18
17 class TabContentsContainerGtk : public NotificationObserver { 19 class TabContentsContainerGtk : public NotificationObserver {
18 public: 20 public:
19 explicit TabContentsContainerGtk(StatusBubbleGtk* status_bubble); 21 explicit TabContentsContainerGtk(StatusBubbleGtk* status_bubble);
20 ~TabContentsContainerGtk(); 22 ~TabContentsContainerGtk();
21 23
24 void Init();
25
22 // Inserts our GtkWidget* hierarchy into a GtkBox managed by our owner. 26 // Inserts our GtkWidget* hierarchy into a GtkBox managed by our owner.
23 void AddContainerToBox(GtkWidget* widget); 27 void AddContainerToBox(GtkWidget* widget);
24 28
25 // Make the specified tab visible. 29 // Make the specified tab visible.
26 void SetTabContents(TabContents* tab_contents); 30 void SetTabContents(TabContents* tab_contents);
27 TabContents* GetTabContents() const { return tab_contents_; } 31 TabContents* GetTabContents() const { return tab_contents_; }
28 32
29 // Remove the tab from the hierarchy. 33 // Remove the tab from the hierarchy.
30 void DetachTabContents(TabContents* tab_contents); 34 void DetachTabContents(TabContents* tab_contents);
31 35
(...skipping 19 matching lines...) Expand all
51 55
52 // Implements our hack around a GtkFixed. The entire size of the GtkFixed is 56 // Implements our hack around a GtkFixed. The entire size of the GtkFixed is
53 // allocated to normal tab contents views, while the status bubble is 57 // allocated to normal tab contents views, while the status bubble is
54 // informed of its parent and its parent's allocation (it makes a decision 58 // informed of its parent and its parent's allocation (it makes a decision
55 // about layout later.) 59 // about layout later.)
56 static void OnFixedSizeAllocate( 60 static void OnFixedSizeAllocate(
57 GtkWidget* fixed, 61 GtkWidget* fixed,
58 GtkAllocation* allocation, 62 GtkAllocation* allocation,
59 TabContentsContainerGtk* container); 63 TabContentsContainerGtk* container);
60 64
65 // Handler for |floating_|'s "set-floating-position" signal. During this
66 // callback, we manually set the position of the status bubble.
67 static void OnSetFloatingPosition(
68 GtkFloatingContainer* container, GtkAllocation* allocation,
69 TabContentsContainerGtk* tab_contents_container);
70
61 NotificationRegistrar registrar_; 71 NotificationRegistrar registrar_;
62 72
63 // The currently visible TabContents. 73 // The currently visible TabContents.
64 TabContents* tab_contents_; 74 TabContents* tab_contents_;
65 75
66 // The status bubble manager. Always non-NULL. 76 // The status bubble manager. Always non-NULL.
67 StatusBubbleGtk* status_bubble_; 77 StatusBubbleGtk* status_bubble_;
68 78
69 // We keep a GtkFixed which is inserted into this object's owner's GtkWidget 79 // Top of the TabContentsContainerGtk widget hierarchy. A cross between a
70 // hierarchy. We then insert and remove TabContents GtkWidgets into this 80 // GtkBin and a GtkFixed, |floating_| has |fixed_| as its one "real" child,
71 // fixed_. This should not be a GtkVBox since there were errors with timing 81 // and the various things that hang off the bottom (status bubble, etc) have
72 // where the vbox was horizontally split with the top half displaying the 82 // their positions manually set in OnSetFloatingPosition.
73 // current TabContents and bottom half displaying the loading page. In 83 GtkWidget* floating_;
74 // addition, we need to position the status bubble on top of the currently 84
75 // displayed TabContents so we put that in this part of the hierarchy. 85 // We insert and remove TabContents GtkWidgets into this fixed_. This should
86 // not be a GtkVBox since there were errors with timing where the vbox was
87 // horizontally split with the top half displaying the current TabContents
88 // and bottom half displaying the loading page.
76 GtkWidget* fixed_; 89 GtkWidget* fixed_;
77 90
78 DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk); 91 DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk);
79 }; 92 };
80 93
81 #endif // CHROME_BROWSER_GTK_TAB_CONTENTS_CONTAINER_GTK_H_ 94 #endif // CHROME_BROWSER_GTK_TAB_CONTENTS_CONTAINER_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/status_bubble_gtk.cc ('k') | chrome/browser/gtk/tab_contents_container_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698