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 #ifndef CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/prefs/pref_member.h" | 16 #include "base/prefs/pref_member.h" |
17 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 17 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
18 #include "chrome/browser/bookmarks/bookmark_utils.h" | 18 #include "chrome/browser/bookmarks/bookmark_utils.h" |
19 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 19 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
20 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" | 20 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" |
21 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" | 21 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" |
22 #include "chrome/browser/ui/gtk/menu_bar_helper.h" | 22 #include "chrome/browser/ui/gtk/menu_bar_helper.h" |
23 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
24 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
25 #include "ui/base/animation/animation.h" | |
26 #include "ui/base/animation/animation_delegate.h" | |
27 #include "ui/base/animation/slide_animation.h" | |
28 #include "ui/base/gtk/gtk_signal.h" | 25 #include "ui/base/gtk/gtk_signal.h" |
29 #include "ui/base/gtk/owned_widget_gtk.h" | 26 #include "ui/base/gtk/owned_widget_gtk.h" |
| 27 #include "ui/gfx/animation/animation.h" |
| 28 #include "ui/gfx/animation/animation_delegate.h" |
| 29 #include "ui/gfx/animation/slide_animation.h" |
30 #include "ui/gfx/point.h" | 30 #include "ui/gfx/point.h" |
31 #include "ui/gfx/size.h" | 31 #include "ui/gfx/size.h" |
32 | 32 |
33 class BookmarkBarInstructionsGtk; | 33 class BookmarkBarInstructionsGtk; |
34 class BookmarkMenuController; | 34 class BookmarkMenuController; |
35 class Browser; | 35 class Browser; |
36 class BrowserWindowGtk; | 36 class BrowserWindowGtk; |
37 class GtkThemeService; | 37 class GtkThemeService; |
38 class MenuGtk; | 38 class MenuGtk; |
39 class TabstripOriginProvider; | 39 class TabstripOriginProvider; |
40 | 40 |
41 namespace content { | 41 namespace content { |
42 class PageNavigator; | 42 class PageNavigator; |
43 } | 43 } |
44 | 44 |
45 class BookmarkBarGtk : public ui::AnimationDelegate, | 45 class BookmarkBarGtk : public gfx::AnimationDelegate, |
46 public BookmarkModelObserver, | 46 public BookmarkModelObserver, |
47 public MenuBarHelper::Delegate, | 47 public MenuBarHelper::Delegate, |
48 public content::NotificationObserver, | 48 public content::NotificationObserver, |
49 public BookmarkBarInstructionsDelegate, | 49 public BookmarkBarInstructionsDelegate, |
50 public BookmarkContextMenuControllerDelegate { | 50 public BookmarkContextMenuControllerDelegate { |
51 public: | 51 public: |
52 BookmarkBarGtk(BrowserWindowGtk* window, | 52 BookmarkBarGtk(BrowserWindowGtk* window, |
53 Browser* browser, | 53 Browser* browser, |
54 TabstripOriginProvider* tabstrip_origin_provider); | 54 TabstripOriginProvider* tabstrip_origin_provider); |
55 virtual ~BookmarkBarGtk(); | 55 virtual ~BookmarkBarGtk(); |
(...skipping 14 matching lines...) Expand all Loading... |
70 // Changes the state of the bookmark bar. | 70 // Changes the state of the bookmark bar. |
71 void SetBookmarkBarState(BookmarkBar::State state, | 71 void SetBookmarkBarState(BookmarkBar::State state, |
72 BookmarkBar::AnimateChangeType animate_type); | 72 BookmarkBar::AnimateChangeType animate_type); |
73 | 73 |
74 // Get the current height of the bookmark bar. | 74 // Get the current height of the bookmark bar. |
75 int GetHeight(); | 75 int GetHeight(); |
76 | 76 |
77 // Returns true if the bookmark bar is showing an animation. | 77 // Returns true if the bookmark bar is showing an animation. |
78 bool IsAnimating(); | 78 bool IsAnimating(); |
79 | 79 |
80 // ui::AnimationDelegate implementation -------------------------------------- | 80 // gfx::AnimationDelegate implementation ------------------------------------- |
81 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 81 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
82 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 82 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
83 | 83 |
84 // MenuBarHelper::Delegate implementation ------------------------------------ | 84 // MenuBarHelper::Delegate implementation ------------------------------------ |
85 virtual void PopupForButton(GtkWidget* button) OVERRIDE; | 85 virtual void PopupForButton(GtkWidget* button) OVERRIDE; |
86 virtual void PopupForButtonNextTo(GtkWidget* button, | 86 virtual void PopupForButtonNextTo(GtkWidget* button, |
87 GtkMenuDirectionType dir) OVERRIDE; | 87 GtkMenuDirectionType dir) OVERRIDE; |
88 | 88 |
89 // BookmarkContextMenuController::Delegate implementation -------------------- | 89 // BookmarkContextMenuController::Delegate implementation -------------------- |
90 virtual void CloseMenu() OVERRIDE; | 90 virtual void CloseMenu() OVERRIDE; |
91 | 91 |
92 const ui::Animation* animation() { return &slide_animation_; } | 92 const gfx::Animation* animation() { return &slide_animation_; } |
93 | 93 |
94 int max_height() const { return max_height_; } | 94 int max_height() const { return max_height_; } |
95 | 95 |
96 private: | 96 private: |
97 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty); | 97 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty); |
98 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, | 98 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, |
99 HidesHelpMessageWithBookmark); | 99 HidesHelpMessageWithBookmark); |
100 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons); | 100 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons); |
101 | 101 |
102 // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's | 102 // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 // displayed yet. | 385 // displayed yet. |
386 // The controller. | 386 // The controller. |
387 scoped_ptr<BookmarkContextMenuController> current_context_menu_controller_; | 387 scoped_ptr<BookmarkContextMenuController> current_context_menu_controller_; |
388 // The view. | 388 // The view. |
389 scoped_ptr<MenuGtk> current_context_menu_; | 389 scoped_ptr<MenuGtk> current_context_menu_; |
390 | 390 |
391 // The last displayed left click menu, or NULL if no menus have been | 391 // The last displayed left click menu, or NULL if no menus have been |
392 // displayed yet. | 392 // displayed yet. |
393 scoped_ptr<BookmarkMenuController> current_menu_; | 393 scoped_ptr<BookmarkMenuController> current_menu_; |
394 | 394 |
395 ui::SlideAnimation slide_animation_; | 395 gfx::SlideAnimation slide_animation_; |
396 | 396 |
397 // Used to optimize out |bookmark_toolbar_| size-allocate events we don't | 397 // Used to optimize out |bookmark_toolbar_| size-allocate events we don't |
398 // need to respond to. | 398 // need to respond to. |
399 int last_allocation_width_; | 399 int last_allocation_width_; |
400 | 400 |
401 content::NotificationRegistrar registrar_; | 401 content::NotificationRegistrar registrar_; |
402 | 402 |
403 // The size of the web contents last time we forced a paint. We keep track | 403 // The size of the web contents last time we forced a paint. We keep track |
404 // of this so we don't force too many paints. | 404 // of this so we don't force too many paints. |
405 gfx::Size last_web_contents_size_; | 405 gfx::Size last_web_contents_size_; |
(...skipping 16 matching lines...) Expand all Loading... |
422 | 422 |
423 BookmarkBar::State bookmark_bar_state_; | 423 BookmarkBar::State bookmark_bar_state_; |
424 | 424 |
425 // Maximum height of the bookmark bar. | 425 // Maximum height of the bookmark bar. |
426 int max_height_; | 426 int max_height_; |
427 | 427 |
428 DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); | 428 DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); |
429 }; | 429 }; |
430 | 430 |
431 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ | 431 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ |
OLD | NEW |