Chromium Code Reviews

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

Issue 113590: Quick reimplementation of StatusBubbleGtk to not suck as much. (Closed)
Patch Set: (git cl uploads dirty tree state!?) Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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_observer.h" 11 #include "chrome/common/notification_observer.h"
12 12
13 class RenderViewHost; 13 class RenderViewHost;
14 class StatusBubbleGtk;
14 class TabContents; 15 class TabContents;
15 16
16 class TabContentsContainerGtk : public NotificationObserver { 17 class TabContentsContainerGtk : public NotificationObserver {
17 public: 18 public:
18 TabContentsContainerGtk(); 19 explicit TabContentsContainerGtk(StatusBubbleGtk* status_bubble);
19 ~TabContentsContainerGtk(); 20 ~TabContentsContainerGtk();
20 21
21 // Inserts our GtkWidget* hierarchy into a GtkBox managed by our owner. 22 // Inserts our GtkWidget* hierarchy into a GtkBox managed by our owner.
22 void AddContainerToBox(GtkWidget* widget); 23 void AddContainerToBox(GtkWidget* widget);
23 24
24 // Make the specified tab visible. 25 // Make the specified tab visible.
25 void SetTabContents(TabContents* tab_contents); 26 void SetTabContents(TabContents* tab_contents);
26 TabContents* GetTabContents() const { return tab_contents_; } 27 TabContents* GetTabContents() const { return tab_contents_; }
27 28
28 // Remove the tab from the hierarchy. 29 // Remove the tab from the hierarchy.
(...skipping 12 matching lines...)
41 // Called when the RenderViewHost of the hosted TabContents has changed, e.g. 42 // Called when the RenderViewHost of the hosted TabContents has changed, e.g.
42 // to show an interstitial page. 43 // to show an interstitial page.
43 void RenderViewHostChanged(RenderViewHost* old_host, 44 void RenderViewHostChanged(RenderViewHost* old_host,
44 RenderViewHost* new_host); 45 RenderViewHost* new_host);
45 46
46 // Called when a TabContents is destroyed. This gives us a chance to clean 47 // Called when a TabContents is destroyed. This gives us a chance to clean
47 // up our internal state if the TabContents is somehow destroyed before we 48 // up our internal state if the TabContents is somehow destroyed before we
48 // get notified. 49 // get notified.
49 void TabContentsDestroyed(TabContents* contents); 50 void TabContentsDestroyed(TabContents* contents);
50 51
52 // 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
54 // informed of its parent and its parent's allocation (it makes a decision
55 // about layout later.)
56 static void OnFixedSizeAllocate(
57 GtkWidget* fixed,
58 GtkAllocation* allocation,
59 TabContentsContainerGtk* container);
60
51 // The currently visible TabContents. 61 // The currently visible TabContents.
52 TabContents* tab_contents_; 62 TabContents* tab_contents_;
53 63
54 // We keep a GtkVBox which is inserted into this object's owner's GtkWidget 64 // The status bubble manager. Always non-NULL.
65 StatusBubbleGtk* status_bubble_;
66
67 // We keep a GtkFixed which is inserted into this object's owner's GtkWidget
55 // hierarchy. We then insert and remove TabContents GtkWidgets into this 68 // hierarchy. We then insert and remove TabContents GtkWidgets into this
56 // vbox_. 69 // fixed_. This should not be a GtkVBox since there were errors with timing
57 GtkWidget* vbox_; 70 // where the vbox was horizontally split with the top half displaying the
71 // current TabContents and bottom half displaying the loading page. In
72 // addition, we need to position the status bubble on top of the currently
73 // displayed TabContents so we put that in this part of the hierarchy.
74 GtkWidget* fixed_;
58 75
59 DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk); 76 DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk);
60 }; 77 };
61 78
62 #endif // CHROME_BROWSER_GTK_TAB_CONTENTS_CONTAINER_GTK_H_ 79 #endif // CHROME_BROWSER_GTK_TAB_CONTENTS_CONTAINER_GTK_H_
OLDNEW

Powered by Google App Engine