OLD | NEW |
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_BOOKMARK_BAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ |
6 #define CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ | 6 #define CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 15 matching lines...) Expand all Loading... |
26 class BookmarkMenuController; | 26 class BookmarkMenuController; |
27 class Browser; | 27 class Browser; |
28 class BrowserWindowGtk; | 28 class BrowserWindowGtk; |
29 class CustomContainerButton; | 29 class CustomContainerButton; |
30 class PageNavigator; | 30 class PageNavigator; |
31 class Profile; | 31 class Profile; |
32 class TabstripOriginProvider; | 32 class TabstripOriginProvider; |
33 struct GtkThemeProvider; | 33 struct GtkThemeProvider; |
34 | 34 |
35 class BookmarkBarGtk : public AnimationDelegate, | 35 class BookmarkBarGtk : public AnimationDelegate, |
36 #if defined(BROWSER_SYNC) | |
37 public ProfileSyncServiceObserver, | 36 public ProfileSyncServiceObserver, |
38 #endif | |
39 public BookmarkModelObserver, | 37 public BookmarkModelObserver, |
40 public MenuBarHelper::Delegate, | 38 public MenuBarHelper::Delegate, |
41 public NotificationObserver { | 39 public NotificationObserver { |
42 FRIEND_TEST(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty); | 40 FRIEND_TEST(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty); |
43 FRIEND_TEST(BookmarkBarGtkUnittest, HidesHelpMessageWithBookmark); | 41 FRIEND_TEST(BookmarkBarGtkUnittest, HidesHelpMessageWithBookmark); |
44 FRIEND_TEST(BookmarkBarGtkUnittest, BuildsButtons); | 42 FRIEND_TEST(BookmarkBarGtkUnittest, BuildsButtons); |
45 public: | 43 public: |
46 explicit BookmarkBarGtk(BrowserWindowGtk* window, | 44 explicit BookmarkBarGtk(BrowserWindowGtk* window, |
47 Profile* profile, Browser* browser, | 45 Profile* profile, Browser* browser, |
48 TabstripOriginProvider* tabstrip_origin_provider); | 46 TabstripOriginProvider* tabstrip_origin_provider); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 255 |
258 // GtkVSeparator callbacks. | 256 // GtkVSeparator callbacks. |
259 static gboolean OnSeparatorExpose(GtkWidget* widget, GdkEventExpose* event, | 257 static gboolean OnSeparatorExpose(GtkWidget* widget, GdkEventExpose* event, |
260 BookmarkBarGtk* bar); | 258 BookmarkBarGtk* bar); |
261 | 259 |
262 // Callbacks on our parent widget. | 260 // Callbacks on our parent widget. |
263 static void OnParentSizeAllocate(GtkWidget* widget, | 261 static void OnParentSizeAllocate(GtkWidget* widget, |
264 GtkAllocation* allocation, | 262 GtkAllocation* allocation, |
265 BookmarkBarGtk* bar); | 263 BookmarkBarGtk* bar); |
266 | 264 |
267 #if defined(BROWSER_SYNC) | |
268 // ProfileSyncServiceObserver method. | 265 // ProfileSyncServiceObserver method. |
269 virtual void OnStateChanged(); | 266 virtual void OnStateChanged(); |
270 | 267 |
271 // Determines whether the sync error button should appear on the bookmarks | 268 // Determines whether the sync error button should appear on the bookmarks |
272 // bar. | 269 // bar. |
273 bool ShouldShowSyncErrorButton(); | 270 bool ShouldShowSyncErrorButton(); |
274 | 271 |
275 // Creates the sync error button and adds it as a child view. | 272 // Creates the sync error button and adds it as a child view. |
276 GtkWidget* CreateSyncErrorButton(); | 273 GtkWidget* CreateSyncErrorButton(); |
277 #endif | |
278 | 274 |
279 Profile* profile_; | 275 Profile* profile_; |
280 | 276 |
281 // Used for opening urls. | 277 // Used for opening urls. |
282 PageNavigator* page_navigator_; | 278 PageNavigator* page_navigator_; |
283 | 279 |
284 Browser* browser_; | 280 Browser* browser_; |
285 BrowserWindowGtk* window_; | 281 BrowserWindowGtk* window_; |
286 | 282 |
287 // Provides us with the offset into the background theme image. | 283 // Provides us with the offset into the background theme image. |
(...skipping 25 matching lines...) Expand all Loading... |
313 // GtkToolbar which contains all the bookmark buttons. | 309 // GtkToolbar which contains all the bookmark buttons. |
314 OwnedWidgetGtk bookmark_toolbar_; | 310 OwnedWidgetGtk bookmark_toolbar_; |
315 | 311 |
316 // The button that shows extra bookmarks that don't fit on the bookmark | 312 // The button that shows extra bookmarks that don't fit on the bookmark |
317 // bar. | 313 // bar. |
318 GtkWidget* overflow_button_; | 314 GtkWidget* overflow_button_; |
319 | 315 |
320 // The other bookmarks button. | 316 // The other bookmarks button. |
321 GtkWidget* other_bookmarks_button_; | 317 GtkWidget* other_bookmarks_button_; |
322 | 318 |
323 #if defined(BROWSER_SYNC) | |
324 // The sync re-login indicator which appears when the user needs to re-enter | 319 // The sync re-login indicator which appears when the user needs to re-enter |
325 // credentials in order to continue syncing. | 320 // credentials in order to continue syncing. |
326 GtkWidget* sync_error_button_; | 321 GtkWidget* sync_error_button_; |
327 | 322 |
328 // A pointer to the ProfileSyncService instance if one exists. | 323 // A pointer to the ProfileSyncService instance if one exists. |
329 ProfileSyncService* sync_service_; | 324 ProfileSyncService* sync_service_; |
330 #endif | |
331 | 325 |
332 // The BookmarkNode from the model being dragged. NULL when we aren't | 326 // The BookmarkNode from the model being dragged. NULL when we aren't |
333 // dragging. | 327 // dragging. |
334 const BookmarkNode* dragged_node_; | 328 const BookmarkNode* dragged_node_; |
335 | 329 |
336 // We create a GtkToolbarItem from |dragged_node_| ;or display. | 330 // We create a GtkToolbarItem from |dragged_node_| ;or display. |
337 GtkToolItem* toolbar_drop_item_; | 331 GtkToolItem* toolbar_drop_item_; |
338 | 332 |
339 // Theme provider for building buttons. | 333 // Theme provider for building buttons. |
340 GtkThemeProvider* theme_provider_; | 334 GtkThemeProvider* theme_provider_; |
(...skipping 26 matching lines...) Expand all Loading... |
367 | 361 |
368 // The size of the tab contents last time we forced a paint. We keep track | 362 // The size of the tab contents last time we forced a paint. We keep track |
369 // of this so we don't force too many paints. | 363 // of this so we don't force too many paints. |
370 gfx::Size last_tab_contents_size_; | 364 gfx::Size last_tab_contents_size_; |
371 | 365 |
372 // We post delayed paints using this factory. | 366 // We post delayed paints using this factory. |
373 ScopedRunnableMethodFactory<BookmarkBarGtk> event_box_paint_factory_; | 367 ScopedRunnableMethodFactory<BookmarkBarGtk> event_box_paint_factory_; |
374 }; | 368 }; |
375 | 369 |
376 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ | 370 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ |
OLD | NEW |