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_UI_VIEWS_BOOKMARK_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARK_BAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARK_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARK_BAR_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "app/animation_delegate.h" | |
12 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 11 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
13 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
14 #include "chrome/browser/sync/profile_sync_service.h" | 13 #include "chrome/browser/sync/profile_sync_service.h" |
15 #include "chrome/browser/views/bookmark_bar_instructions_view.h" | 14 #include "chrome/browser/views/bookmark_bar_instructions_view.h" |
16 #include "chrome/browser/views/bookmark_menu_controller_views.h" | 15 #include "chrome/browser/views/bookmark_menu_controller_views.h" |
17 #include "chrome/browser/views/detachable_toolbar_view.h" | 16 #include "chrome/browser/views/detachable_toolbar_view.h" |
18 #include "chrome/common/notification_registrar.h" | 17 #include "chrome/common/notification_registrar.h" |
| 18 #include "ui/base/animation/animation_delegate.h" |
19 #include "views/controls/button/button.h" | 19 #include "views/controls/button/button.h" |
20 #include "views/controls/menu/view_menu_delegate.h" | 20 #include "views/controls/menu/view_menu_delegate.h" |
21 | 21 |
22 class Browser; | 22 class Browser; |
23 class PageNavigator; | 23 class PageNavigator; |
24 class PrefService; | 24 class PrefService; |
| 25 |
| 26 namespace ui { |
25 class SlideAnimation; | 27 class SlideAnimation; |
| 28 } |
26 | 29 |
27 namespace views { | 30 namespace views { |
28 class CustomButton; | 31 class CustomButton; |
29 class MenuButton; | 32 class MenuButton; |
30 class MenuItemView; | 33 class MenuItemView; |
31 class TextButton; | 34 class TextButton; |
32 } | 35 } |
33 | 36 |
34 // BookmarkBarView renders the BookmarkModel. Each starred entry on the | 37 // BookmarkBarView renders the BookmarkModel. Each starred entry on the |
35 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to | 38 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to |
36 // the right allows the user to quickly see recently starred entries. | 39 // the right allows the user to quickly see recently starred entries. |
37 // | 40 // |
38 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView | 41 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView |
39 // waits until the HistoryService for the profile has been loaded before | 42 // waits until the HistoryService for the profile has been loaded before |
40 // creating the BookmarkModel. | 43 // creating the BookmarkModel. |
41 class BookmarkBarView : public DetachableToolbarView, | 44 class BookmarkBarView : public DetachableToolbarView, |
42 public ProfileSyncServiceObserver, | 45 public ProfileSyncServiceObserver, |
43 public BookmarkModelObserver, | 46 public BookmarkModelObserver, |
44 public views::ViewMenuDelegate, | 47 public views::ViewMenuDelegate, |
45 public views::ButtonListener, | 48 public views::ButtonListener, |
46 public NotificationObserver, | 49 public NotificationObserver, |
47 public views::ContextMenuController, | 50 public views::ContextMenuController, |
48 public views::DragController, | 51 public views::DragController, |
49 public AnimationDelegate, | 52 public ui::AnimationDelegate, |
50 public BookmarkMenuController::Observer, | 53 public BookmarkMenuController::Observer, |
51 public BookmarkBarInstructionsView::Delegate { | 54 public BookmarkBarInstructionsView::Delegate { |
52 friend class ShowFolderMenuTask; | 55 friend class ShowFolderMenuTask; |
53 | 56 |
54 public: | 57 public: |
55 // Constants used in Browser View, as well as here. | 58 // Constants used in Browser View, as well as here. |
56 // How inset the bookmarks bar is when displayed on the new tab page. | 59 // How inset the bookmarks bar is when displayed on the new tab page. |
57 static const int kNewtabHorizontalPadding; | 60 static const int kNewtabHorizontalPadding; |
58 static const int kNewtabVerticalPadding; | 61 static const int kNewtabVerticalPadding; |
59 | 62 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 bool OnNewTabPage() const; | 176 bool OnNewTabPage() const; |
174 | 177 |
175 // How much we want the bookmark bar to overlap the toolbar. If |return_max| | 178 // How much we want the bookmark bar to overlap the toolbar. If |return_max| |
176 // is true, we return the maximum overlap rather than the current overlap. | 179 // is true, we return the maximum overlap rather than the current overlap. |
177 int GetToolbarOverlap(bool return_max) const; | 180 int GetToolbarOverlap(bool return_max) const; |
178 | 181 |
179 // Whether or not we are animating. | 182 // Whether or not we are animating. |
180 bool is_animating(); | 183 bool is_animating(); |
181 | 184 |
182 // SlideAnimationDelegate implementation. | 185 // SlideAnimationDelegate implementation. |
183 void AnimationProgressed(const Animation* animation); | 186 void AnimationProgressed(const ui::Animation* animation); |
184 void AnimationEnded(const Animation* animation); | 187 void AnimationEnded(const ui::Animation* animation); |
185 | 188 |
186 // BookmarkMenuController::Observer | 189 // BookmarkMenuController::Observer |
187 virtual void BookmarkMenuDeleted(BookmarkMenuController* controller); | 190 virtual void BookmarkMenuDeleted(BookmarkMenuController* controller); |
188 | 191 |
189 // Returns the button at the specified index. | 192 // Returns the button at the specified index. |
190 views::TextButton* GetBookmarkButton(int index); | 193 views::TextButton* GetBookmarkButton(int index); |
191 | 194 |
192 // Returns the button responsible for showing bookmarks in the other bookmark | 195 // Returns the button responsible for showing bookmarks in the other bookmark |
193 // folder. | 196 // folder. |
194 views::MenuButton* other_bookmarked_button() const { | 197 views::MenuButton* other_bookmarked_button() const { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 487 |
485 ButtonSeparatorView* bookmarks_separator_view_; | 488 ButtonSeparatorView* bookmarks_separator_view_; |
486 | 489 |
487 // Owning browser. This is NULL during testing. | 490 // Owning browser. This is NULL during testing. |
488 Browser* browser_; | 491 Browser* browser_; |
489 | 492 |
490 // True if the owning browser is showing an infobar. | 493 // True if the owning browser is showing an infobar. |
491 bool infobar_visible_; | 494 bool infobar_visible_; |
492 | 495 |
493 // Animation controlling showing and hiding of the bar. | 496 // Animation controlling showing and hiding of the bar. |
494 scoped_ptr<SlideAnimation> size_animation_; | 497 scoped_ptr<ui::SlideAnimation> size_animation_; |
495 | 498 |
496 // If the bookmark bubble is showing, this is the visible ancestor of the URL. | 499 // If the bookmark bubble is showing, this is the visible ancestor of the URL. |
497 // The visible ancestor is either the other_bookmarked_button_, | 500 // The visible ancestor is either the other_bookmarked_button_, |
498 // overflow_button_ or a button on the bar. | 501 // overflow_button_ or a button on the bar. |
499 views::CustomButton* throbbing_view_; | 502 views::CustomButton* throbbing_view_; |
500 | 503 |
501 // Background for extension toolstrips. | 504 // Background for extension toolstrips. |
502 SkBitmap toolstrip_background_; | 505 SkBitmap toolstrip_background_; |
503 | 506 |
504 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 507 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
505 }; | 508 }; |
506 | 509 |
507 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_BAR_VIEW_H_ | 510 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |