OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_UI_GTK_TAB_CONTENTS_CONTAINER_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_TAB_CONTENTS_CONTAINER_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_TAB_CONTENTS_CONTAINER_GTK_H_ | 6 #define CHROME_BROWSER_UI_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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 explicit TabContentsContainerGtk(StatusBubbleGtk* status_bubble); | 29 explicit TabContentsContainerGtk(StatusBubbleGtk* status_bubble); |
30 virtual ~TabContentsContainerGtk(); | 30 virtual ~TabContentsContainerGtk(); |
31 | 31 |
32 void Init(); | 32 void Init(); |
33 | 33 |
34 // Make the specified tab visible. | 34 // Make the specified tab visible. |
35 void SetTab(content::WebContents* tab); | 35 void SetTab(content::WebContents* tab); |
36 content::WebContents* tab() const { return tab_; } | 36 content::WebContents* tab() const { return tab_; } |
37 | 37 |
38 void SetPreview(content::WebContents* preview); | 38 void SetOverlay(content::WebContents* overlay); |
39 bool HasPreview() const { return preview_ != NULL; } | 39 bool HasOverlay() const { return overlay_ != NULL; } |
40 | 40 |
41 // Returns the WebContents currently displayed. | 41 // Returns the WebContents currently displayed. |
42 content::WebContents* GetVisibleTab() const { | 42 content::WebContents* GetVisibleTab() const { |
43 return preview_ ? preview_ : tab_; | 43 return overlay_ ? overlay_ : tab_; |
44 } | 44 } |
45 | 45 |
46 // Remove the tab from the hierarchy. | 46 // Remove the tab from the hierarchy. |
47 void DetachTab(content::WebContents* tab); | 47 void DetachTab(content::WebContents* tab); |
48 | 48 |
49 // content::NotificationObserver implementation. | 49 // content::NotificationObserver implementation. |
50 virtual void Observe(int type, | 50 virtual void Observe(int type, |
51 const content::NotificationSource& source, | 51 const content::NotificationSource& source, |
52 const content::NotificationDetails& details) OVERRIDE; | 52 const content::NotificationDetails& details) OVERRIDE; |
53 | 53 |
(...skipping 14 matching lines...) Expand all Loading... |
68 GtkFloatingContainer* container, GtkAllocation* allocation, | 68 GtkFloatingContainer* container, GtkAllocation* allocation, |
69 TabContentsContainerGtk* tab_contents_container); | 69 TabContentsContainerGtk* tab_contents_container); |
70 | 70 |
71 // Adds |tab| to the container and starts showing it. | 71 // Adds |tab| to the container and starts showing it. |
72 void PackTab(content::WebContents* tab); | 72 void PackTab(content::WebContents* tab); |
73 | 73 |
74 // Stops showing |tab|. | 74 // Stops showing |tab|. |
75 void HideTab(content::WebContents* tab); | 75 void HideTab(content::WebContents* tab); |
76 | 76 |
77 // Handle focus traversal on the tab contents container. Focus should not | 77 // Handle focus traversal on the tab contents container. Focus should not |
78 // traverse to the preview contents. | 78 // traverse to the overlay contents. |
79 CHROMEGTK_CALLBACK_1(TabContentsContainerGtk, gboolean, OnFocus, | 79 CHROMEGTK_CALLBACK_1(TabContentsContainerGtk, gboolean, OnFocus, |
80 GtkDirectionType); | 80 GtkDirectionType); |
81 | 81 |
82 content::NotificationRegistrar registrar_; | 82 content::NotificationRegistrar registrar_; |
83 | 83 |
84 // The WebContents for the currently selected tab. This will be showing | 84 // The WebContents for the currently selected tab. This will be showing |
85 // unless there is a preview contents. | 85 // unless there is an overlay contents. |
86 content::WebContents* tab_; | 86 content::WebContents* tab_; |
87 | 87 |
88 // The current preview contents (for instant). If non-NULL, it will be | 88 // The current overlay contents (for Instant). If non-NULL, it will be |
89 // visible. | 89 // visible. |
90 content::WebContents* preview_; | 90 content::WebContents* overlay_; |
91 | 91 |
92 // The status bubble manager. Always non-NULL. | 92 // The status bubble manager. Always non-NULL. |
93 StatusBubbleGtk* status_bubble_; | 93 StatusBubbleGtk* status_bubble_; |
94 | 94 |
95 // Top of the TabContentsContainerGtk widget hierarchy. A cross between a | 95 // Top of the TabContentsContainerGtk widget hierarchy. A cross between a |
96 // GtkBin and a GtkFixed, |floating_| has |expanded_| as its one "real" child, | 96 // GtkBin and a GtkFixed, |floating_| has |expanded_| as its one "real" child, |
97 // and the various things that hang off the bottom (status bubble, etc) have | 97 // and the various things that hang off the bottom (status bubble, etc) have |
98 // their positions manually set in OnSetFloatingPosition. | 98 // their positions manually set in OnSetFloatingPosition. |
99 ui::OwnedWidgetGtk floating_; | 99 ui::OwnedWidgetGtk floating_; |
100 | 100 |
101 // We insert and remove WebContents GtkWidgets into this expanded_. This | 101 // We insert and remove WebContents GtkWidgets into this expanded_. This |
102 // should not be a GtkVBox since there were errors with timing where the vbox | 102 // should not be a GtkVBox since there were errors with timing where the vbox |
103 // was horizontally split with the top half displaying the current WebContents | 103 // was horizontally split with the top half displaying the current WebContents |
104 // and bottom half displaying the loading page. | 104 // and bottom half displaying the loading page. |
105 GtkWidget* expanded_; | 105 GtkWidget* expanded_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk); | 107 DISALLOW_COPY_AND_ASSIGN(TabContentsContainerGtk); |
108 }; | 108 }; |
109 | 109 |
110 #endif // CHROME_BROWSER_UI_GTK_TAB_CONTENTS_CONTAINER_GTK_H_ | 110 #endif // CHROME_BROWSER_UI_GTK_TAB_CONTENTS_CONTAINER_GTK_H_ |
OLD | NEW |