OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "app/animation_delegate.h" | |
14 #include "app/gtk_signal.h" | 13 #include "app/gtk_signal.h" |
15 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
16 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
17 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h" | 16 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h" |
18 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 17 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
19 #include "chrome/browser/gtk/bookmark_bar_instructions_gtk.h" | 18 #include "chrome/browser/gtk/bookmark_bar_instructions_gtk.h" |
20 #include "chrome/browser/gtk/menu_bar_helper.h" | 19 #include "chrome/browser/gtk/menu_bar_helper.h" |
21 #include "chrome/browser/gtk/owned_widget_gtk.h" | 20 #include "chrome/browser/gtk/owned_widget_gtk.h" |
22 #include "chrome/browser/gtk/view_id_util.h" | 21 #include "chrome/browser/gtk/view_id_util.h" |
23 #include "chrome/browser/sync/profile_sync_service.h" | 22 #include "chrome/browser/sync/profile_sync_service.h" |
24 #include "chrome/common/notification_observer.h" | 23 #include "chrome/common/notification_observer.h" |
25 #include "chrome/common/notification_registrar.h" | 24 #include "chrome/common/notification_registrar.h" |
26 #include "gfx/point.h" | 25 #include "gfx/point.h" |
27 #include "gfx/size.h" | 26 #include "gfx/size.h" |
| 27 #include "ui/base/animation/animation_delegate.h" |
28 | 28 |
29 class BookmarkMenuController; | 29 class BookmarkMenuController; |
30 class Browser; | 30 class Browser; |
31 class BrowserWindowGtk; | 31 class BrowserWindowGtk; |
32 class CustomContainerButton; | 32 class CustomContainerButton; |
33 class GtkThemeProvider; | 33 class GtkThemeProvider; |
34 class MenuGtk; | 34 class MenuGtk; |
35 class PageNavigator; | 35 class PageNavigator; |
36 class Profile; | 36 class Profile; |
37 class SlideAnimation; | |
38 class TabstripOriginProvider; | 37 class TabstripOriginProvider; |
39 | 38 |
40 class BookmarkBarGtk : public AnimationDelegate, | 39 namespace ui { |
| 40 class SlideAnimation; |
| 41 } |
| 42 |
| 43 class BookmarkBarGtk : public ui::AnimationDelegate, |
41 public ProfileSyncServiceObserver, | 44 public ProfileSyncServiceObserver, |
42 public BookmarkModelObserver, | 45 public BookmarkModelObserver, |
43 public MenuBarHelper::Delegate, | 46 public MenuBarHelper::Delegate, |
44 public NotificationObserver, | 47 public NotificationObserver, |
45 public BookmarkBarInstructionsGtk::Delegate, | 48 public BookmarkBarInstructionsGtk::Delegate, |
46 public BookmarkContextMenuControllerDelegate { | 49 public BookmarkContextMenuControllerDelegate { |
47 public: | 50 public: |
48 BookmarkBarGtk(BrowserWindowGtk* window, | 51 BookmarkBarGtk(BrowserWindowGtk* window, |
49 Profile* profile, | 52 Profile* profile, |
50 Browser* browser, | 53 Browser* browser, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 92 |
90 // Get the current height of the bookmark bar. | 93 // Get the current height of the bookmark bar. |
91 int GetHeight(); | 94 int GetHeight(); |
92 | 95 |
93 // Returns true if the bookmark bar is showing an animation. | 96 // Returns true if the bookmark bar is showing an animation. |
94 bool IsAnimating(); | 97 bool IsAnimating(); |
95 | 98 |
96 // Returns true if the bookmarks bar preference is set to 'always show'. | 99 // Returns true if the bookmarks bar preference is set to 'always show'. |
97 bool IsAlwaysShown(); | 100 bool IsAlwaysShown(); |
98 | 101 |
99 // AnimationDelegate implementation ------------------------------------------ | 102 // ui::AnimationDelegate implementation --------------------------------------
---- |
100 virtual void AnimationProgressed(const Animation* animation); | 103 virtual void AnimationProgressed(const ui::Animation* animation); |
101 virtual void AnimationEnded(const Animation* animation); | 104 virtual void AnimationEnded(const ui::Animation* animation); |
102 | 105 |
103 // MenuBarHelper::Delegate implementation ------------------------------------ | 106 // MenuBarHelper::Delegate implementation ------------------------------------ |
104 virtual void PopupForButton(GtkWidget* button); | 107 virtual void PopupForButton(GtkWidget* button); |
105 virtual void PopupForButtonNextTo(GtkWidget* button, | 108 virtual void PopupForButtonNextTo(GtkWidget* button, |
106 GtkMenuDirectionType dir); | 109 GtkMenuDirectionType dir); |
107 | 110 |
108 // The NTP needs to have access to this. | 111 // The NTP needs to have access to this. |
109 static const int kBookmarkBarNTPHeight; | 112 static const int kBookmarkBarNTPHeight; |
110 | 113 |
111 // BookmarkContextMenuController::Delegate implementation -------------------- | 114 // BookmarkContextMenuController::Delegate implementation -------------------- |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // displayed yet. | 363 // displayed yet. |
361 // The controller. | 364 // The controller. |
362 scoped_ptr<BookmarkContextMenuController> current_context_menu_controller_; | 365 scoped_ptr<BookmarkContextMenuController> current_context_menu_controller_; |
363 // The view. | 366 // The view. |
364 scoped_ptr<MenuGtk> current_context_menu_; | 367 scoped_ptr<MenuGtk> current_context_menu_; |
365 | 368 |
366 // The last displayed left click menu, or NULL if no menus have been | 369 // The last displayed left click menu, or NULL if no menus have been |
367 // displayed yet. | 370 // displayed yet. |
368 scoped_ptr<BookmarkMenuController> current_menu_; | 371 scoped_ptr<BookmarkMenuController> current_menu_; |
369 | 372 |
370 scoped_ptr<SlideAnimation> slide_animation_; | 373 scoped_ptr<ui::SlideAnimation> slide_animation_; |
371 | 374 |
372 // Whether we are currently configured as floating (detached from the | 375 // Whether we are currently configured as floating (detached from the |
373 // toolbar). This reflects our actual state, and can be out of sync with | 376 // toolbar). This reflects our actual state, and can be out of sync with |
374 // what ShouldShowFloating() returns. | 377 // what ShouldShowFloating() returns. |
375 bool floating_; | 378 bool floating_; |
376 | 379 |
377 // Used to optimize out |bookmark_toolbar_| size-allocate events we don't | 380 // Used to optimize out |bookmark_toolbar_| size-allocate events we don't |
378 // need to respond to. | 381 // need to respond to. |
379 int last_allocation_width_; | 382 int last_allocation_width_; |
380 | 383 |
381 NotificationRegistrar registrar_; | 384 NotificationRegistrar registrar_; |
382 | 385 |
383 // The size of the tab contents last time we forced a paint. We keep track | 386 // The size of the tab contents last time we forced a paint. We keep track |
384 // of this so we don't force too many paints. | 387 // of this so we don't force too many paints. |
385 gfx::Size last_tab_contents_size_; | 388 gfx::Size last_tab_contents_size_; |
386 | 389 |
387 // The last coordinates recorded by OnButtonPress; used to line up the | 390 // The last coordinates recorded by OnButtonPress; used to line up the |
388 // drag icon during bookmark drags. | 391 // drag icon during bookmark drags. |
389 gfx::Point last_pressed_coordinates_; | 392 gfx::Point last_pressed_coordinates_; |
390 | 393 |
391 // The currently throbbing widget. This is NULL if no widget is throbbing. | 394 // The currently throbbing widget. This is NULL if no widget is throbbing. |
392 // We track it because we only want to allow one widget to throb at a time. | 395 // We track it because we only want to allow one widget to throb at a time. |
393 GtkWidget* throbbing_widget_; | 396 GtkWidget* throbbing_widget_; |
394 | 397 |
395 ScopedRunnableMethodFactory<BookmarkBarGtk> method_factory_; | 398 ScopedRunnableMethodFactory<BookmarkBarGtk> method_factory_; |
396 }; | 399 }; |
397 | 400 |
398 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ | 401 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ |
OLD | NEW |