OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // A helper class that contains the gtk widgets that make up the titlebar. The | 5 // A helper class that contains the gtk widgets that make up the titlebar. The |
6 // titlebar consists of the tabstrip and if the custom chrome frame is turned | 6 // titlebar consists of the tabstrip and if the custom chrome frame is turned |
7 // on, it includes the taller titlebar and minimize, restore, maximize, and | 7 // on, it includes the taller titlebar and minimize, restore, maximize, and |
8 // close buttons. | 8 // close buttons. |
9 | 9 |
10 #ifndef CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_ | 10 #ifndef CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_ |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // | 84 // |
85 // Opened a gtk bug for this - | 85 // Opened a gtk bug for this - |
86 // https://bugzilla.gnome.org/show_bug.cgi?id=667841 | 86 // https://bugzilla.gnome.org/show_bug.cgi?id=667841 |
87 void SendEnterNotifyToCloseButtonIfUnderMouse(); | 87 void SendEnterNotifyToCloseButtonIfUnderMouse(); |
88 | 88 |
89 // Returns the window width to display just the icon. | 89 // Returns the window width to display just the icon. |
90 int IconOnlyWidth(); | 90 int IconOnlyWidth(); |
91 | 91 |
92 AvatarMenuButtonGtk* avatar_button() { return avatar_button_.get(); } | 92 AvatarMenuButtonGtk* avatar_button() { return avatar_button_.get(); } |
93 | 93 |
| 94 protected: |
| 95 // Builds the button as denoted by |button_token|. Returns true if the button |
| 96 // is created successfully. |
| 97 virtual bool BuildButton(const std::string& button_token, bool left_side); |
| 98 |
| 99 // Show the menu that the user gets from left-clicking the favicon. |
| 100 virtual void ShowFaviconMenu(GdkEventButton* event); |
| 101 |
94 private: | 102 private: |
95 // A helper class to keep track of which frame of the throbber animation | 103 // A helper class to keep track of which frame of the throbber animation |
96 // we're showing. | 104 // we're showing. |
97 class Throbber { | 105 class Throbber { |
98 public: | 106 public: |
99 Throbber() : current_frame_(0), current_waiting_frame_(0) {} | 107 Throbber() : current_frame_(0), current_waiting_frame_(0) {} |
100 | 108 |
101 // Get the next frame in the animation. The image is owned by the throbber | 109 // Get the next frame in the animation. The image is owned by the throbber |
102 // so the caller doesn't need to unref. |is_waiting| is true if we're | 110 // so the caller doesn't need to unref. |is_waiting| is true if we're |
103 // still waiting for a response. | 111 // still waiting for a response. |
(...skipping 20 matching lines...) Expand all Loading... |
124 void Init(); | 132 void Init(); |
125 | 133 |
126 // Lazily builds and returns |titlebar_{left,right}_buttons_vbox_| and their | 134 // Lazily builds and returns |titlebar_{left,right}_buttons_vbox_| and their |
127 // subtrees. We do this lazily because in most situations, only one of them | 135 // subtrees. We do this lazily because in most situations, only one of them |
128 // is allocated (though the user can (and do) manually mess with their gconf | 136 // is allocated (though the user can (and do) manually mess with their gconf |
129 // settings to get absolutely horrid combinations of buttons on both sides. | 137 // settings to get absolutely horrid combinations of buttons on both sides. |
130 GtkWidget* GetButtonHBox(bool left_side); | 138 GtkWidget* GetButtonHBox(bool left_side); |
131 | 139 |
132 // Constructs a CustomDraw button given 3 image ids (IDR_), the box to place | 140 // Constructs a CustomDraw button given 3 image ids (IDR_), the box to place |
133 // the button into, and a tooltip id (IDS_). | 141 // the button into, and a tooltip id (IDS_). |
134 CustomDrawButton* BuildTitlebarButton(int image, int image_pressed, | 142 CustomDrawButton* CreateTitlebarButton(int image, int image_pressed, |
135 int image_hot, GtkWidget* box, | 143 int image_hot, GtkWidget* box, |
136 bool start, int tooltip); | 144 int tooltip); |
137 | 145 |
138 // Update the titlebar spacing based on the custom frame and maximized state. | 146 // Update the titlebar spacing based on the custom frame and maximized state. |
139 void UpdateTitlebarAlignment(); | 147 void UpdateTitlebarAlignment(); |
140 | 148 |
141 // Updates the color of the title bar. Called whenever we have a state | 149 // Updates the color of the title bar. Called whenever we have a state |
142 // change in the window. | 150 // change in the window. |
143 void UpdateTextColor(); | 151 void UpdateTextColor(); |
144 | 152 |
145 // Updates the avatar image displayed, either a multi-profile avatar or the | 153 // Updates the avatar image displayed, either a multi-profile avatar or the |
146 // incognito spy guy. | 154 // incognito spy guy. |
147 void UpdateAvatar(); | 155 void UpdateAvatar(); |
148 | 156 |
149 // Show the menu that the user gets from left-clicking the favicon. | |
150 void ShowFaviconMenu(GdkEventButton* event); | |
151 | |
152 // The maximize button was clicked, take an action depending on which mouse | 157 // The maximize button was clicked, take an action depending on which mouse |
153 // button the user pressed. | 158 // button the user pressed. |
154 void MaximizeButtonClicked(); | 159 void MaximizeButtonClicked(); |
155 | 160 |
156 // Updates the visibility of the maximize and restore buttons; only one can | 161 // Updates the visibility of the maximize and restore buttons; only one can |
157 // be visible at a time. | 162 // be visible at a time. |
158 void UpdateMaximizeRestoreVisibility(); | 163 void UpdateMaximizeRestoreVisibility(); |
159 | 164 |
160 // Callback for changes to window state. This includes | 165 // Callback for changes to window state. This includes |
161 // maximizing/restoring/minimizing the window. | 166 // maximizing/restoring/minimizing the window. |
(...skipping 22 matching lines...) Expand all Loading... |
184 ui::Accelerator* accelerator) OVERRIDE; | 189 ui::Accelerator* accelerator) OVERRIDE; |
185 | 190 |
186 // Overridden from content::NotificationObserver: | 191 // Overridden from content::NotificationObserver: |
187 virtual void Observe(int type, | 192 virtual void Observe(int type, |
188 const content::NotificationSource& source, | 193 const content::NotificationSource& source, |
189 const content::NotificationDetails& details) OVERRIDE; | 194 const content::NotificationDetails& details) OVERRIDE; |
190 | 195 |
191 // Overriden from ActiveWindowWatcherXObserver. | 196 // Overriden from ActiveWindowWatcherXObserver. |
192 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; | 197 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; |
193 | 198 |
194 bool IsTypePanel(); | |
195 | |
196 // Whether to display the avatar image. | 199 // Whether to display the avatar image. |
197 bool ShouldDisplayAvatar(); | 200 bool ShouldDisplayAvatar(); |
198 | 201 |
199 // Returns true if the profile associated with this BrowserWindow is off the | 202 // Returns true if the profile associated with this BrowserWindow is off the |
200 // record. | 203 // record. |
201 bool IsOffTheRecord(); | 204 bool IsOffTheRecord(); |
202 | 205 |
203 // Pointers to the browser window that owns us and its GtkWindow. | 206 // Pointers to the browser window that owns us and its GtkWindow. |
204 BrowserWindowGtk* browser_window_; | 207 BrowserWindowGtk* browser_window_; |
205 GtkWindow* window_; | 208 GtkWindow* window_; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // The avatar button. | 283 // The avatar button. |
281 scoped_ptr<AvatarMenuButtonGtk> avatar_button_; | 284 scoped_ptr<AvatarMenuButtonGtk> avatar_button_; |
282 | 285 |
283 // Theme provider for building buttons. | 286 // Theme provider for building buttons. |
284 ThemeServiceGtk* theme_service_; | 287 ThemeServiceGtk* theme_service_; |
285 | 288 |
286 content::NotificationRegistrar registrar_; | 289 content::NotificationRegistrar registrar_; |
287 }; | 290 }; |
288 | 291 |
289 #endif // CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_ | 292 #endif // CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_ |
OLD | NEW |