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

Side by Side Diff: chrome/browser/ui/gtk/browser_titlebar.h

Issue 10169019: Add PanelBrowserTitlebarGtk for panels on GTK. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Patch to land Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/browser_titlebar.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window); 44 BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window);
45 virtual ~BrowserTitlebar(); 45 virtual ~BrowserTitlebar();
46 46
47 GtkWidget* widget() { 47 GtkWidget* widget() {
48 return container_; 48 return container_;
49 } 49 }
50 50
51 void set_window(GtkWindow* window) { window_ = window; } 51 void set_window(GtkWindow* window) { window_ = window; }
52 52
53 // Build the titlebar, the space above the tab strip, and (maybe) the min,
54 // max, close buttons. |container_| is the gtk container that we put the
55 // widget into.
56 void Init();
57
53 // Builds the buttons based on the metacity |button_string|. 58 // Builds the buttons based on the metacity |button_string|.
54 void BuildButtons(const std::string& button_string); 59 void BuildButtons(const std::string& button_string);
55 60
56 // Updates the theme supplied background color and image. 61 // Updates the theme supplied background color and image.
57 void UpdateButtonBackground(CustomDrawButton* button); 62 void UpdateButtonBackground(CustomDrawButton* button);
58 63
59 // Update the appearance of the title bar based on whether we're showing a 64 // Update the appearance of the title bar based on whether we're showing a
60 // custom frame or not. If |use_custom_frame| is true, we show an extra 65 // custom frame or not. If |use_custom_frame| is true, we show an extra
61 // tall titlebar and the min/max/close buttons. 66 // tall titlebar and the min/max/close buttons.
62 void UpdateCustomFrame(bool use_custom_frame); 67 void UpdateCustomFrame(bool use_custom_frame);
(...skipping 21 matching lines...) Expand all
84 // 89 //
85 // Opened a gtk bug for this - 90 // Opened a gtk bug for this -
86 // https://bugzilla.gnome.org/show_bug.cgi?id=667841 91 // https://bugzilla.gnome.org/show_bug.cgi?id=667841
87 void SendEnterNotifyToCloseButtonIfUnderMouse(); 92 void SendEnterNotifyToCloseButtonIfUnderMouse();
88 93
89 // Returns the window width to display just the icon. 94 // Returns the window width to display just the icon.
90 int IconOnlyWidth(); 95 int IconOnlyWidth();
91 96
92 AvatarMenuButtonGtk* avatar_button() { return avatar_button_.get(); } 97 AvatarMenuButtonGtk* avatar_button() { return avatar_button_.get(); }
93 98
99 protected:
100 // Builds the button as denoted by |button_token|. Returns true if the button
101 // is created successfully.
102 virtual bool BuildButton(const std::string& button_token, bool left_side);
103
104 // Show the menu that the user gets from left-clicking the favicon.
105 virtual void ShowFaviconMenu(GdkEventButton* event);
106
94 private: 107 private:
95 // A helper class to keep track of which frame of the throbber animation 108 // A helper class to keep track of which frame of the throbber animation
96 // we're showing. 109 // we're showing.
97 class Throbber { 110 class Throbber {
98 public: 111 public:
99 Throbber() : current_frame_(0), current_waiting_frame_(0) {} 112 Throbber() : current_frame_(0), current_waiting_frame_(0) {}
100 113
101 // Get the next frame in the animation. The image is owned by the throbber 114 // 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 115 // so the caller doesn't need to unref. |is_waiting| is true if we're
103 // still waiting for a response. 116 // still waiting for a response.
104 GdkPixbuf* GetNextFrame(bool is_waiting); 117 GdkPixbuf* GetNextFrame(bool is_waiting);
105 118
106 // Reset back to the first frame. 119 // Reset back to the first frame.
107 void Reset(); 120 void Reset();
108 private: 121 private:
109 // Make sure the frames are loaded. 122 // Make sure the frames are loaded.
110 static void InitFrames(); 123 static void InitFrames();
111 124
112 int current_frame_; 125 int current_frame_;
113 int current_waiting_frame_; 126 int current_waiting_frame_;
114 }; 127 };
115 128
116 class ContextMenuModel : public ui::SimpleMenuModel { 129 class ContextMenuModel : public ui::SimpleMenuModel {
117 public: 130 public:
118 explicit ContextMenuModel(ui::SimpleMenuModel::Delegate* delegate); 131 explicit ContextMenuModel(ui::SimpleMenuModel::Delegate* delegate);
119 }; 132 };
120 133
121 // Build the titlebar, the space above the tab strip, and (maybe) the min,
122 // max, close buttons. |container_| is the gtk container that we put the
123 // widget into.
124 void Init();
125
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/browser_titlebar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698