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_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
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/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/prefs/pref_change_registrar.h" | 15 #include "base/prefs/pref_change_registrar.h" |
16 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
17 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 17 #include "chrome/browser/bookmarks/bookmark_node_data.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/views/bookmarks/bookmark_bubble_view_observer.h" | 21 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" |
22 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_observer.h" | 22 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_observer.h" |
23 #include "chrome/browser/ui/views/detachable_toolbar_view.h" | 23 #include "chrome/browser/ui/views/detachable_toolbar_view.h" |
24 #include "ui/base/animation/animation_delegate.h" | 24 #include "ui/gfx/animation/animation_delegate.h" |
25 #include "ui/views/context_menu_controller.h" | 25 #include "ui/views/context_menu_controller.h" |
26 #include "ui/views/controls/button/button.h" | 26 #include "ui/views/controls/button/button.h" |
27 #include "ui/views/controls/button/menu_button_listener.h" | 27 #include "ui/views/controls/button/menu_button_listener.h" |
28 #include "ui/views/controls/menu/menu_item_view.h" | 28 #include "ui/views/controls/menu/menu_item_view.h" |
29 #include "ui/views/drag_controller.h" | 29 #include "ui/views/drag_controller.h" |
30 | 30 |
31 class BookmarkContextMenu; | 31 class BookmarkContextMenu; |
32 class Browser; | 32 class Browser; |
33 class BrowserView; | 33 class BrowserView; |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 class PageNavigator; | 36 class PageNavigator; |
37 } | 37 } |
38 | 38 |
39 namespace ui { | 39 namespace gfx { |
40 class SlideAnimation; | 40 class SlideAnimation; |
41 } | 41 } |
42 | 42 |
43 namespace views { | 43 namespace views { |
44 class CustomButton; | 44 class CustomButton; |
45 class MenuButton; | 45 class MenuButton; |
46 class TextButton; | 46 class TextButton; |
47 } | 47 } |
48 | 48 |
49 // BookmarkBarView renders the BookmarkModel. Each starred entry on the | 49 // BookmarkBarView renders the BookmarkModel. Each starred entry on the |
50 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to | 50 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to |
51 // the right allows the user to quickly see recently starred entries. | 51 // the right allows the user to quickly see recently starred entries. |
52 // | 52 // |
53 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView | 53 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView |
54 // waits until the HistoryService for the profile has been loaded before | 54 // waits until the HistoryService for the profile has been loaded before |
55 // creating the BookmarkModel. | 55 // creating the BookmarkModel. |
56 class BookmarkBarView : public DetachableToolbarView, | 56 class BookmarkBarView : public DetachableToolbarView, |
57 public BookmarkModelObserver, | 57 public BookmarkModelObserver, |
58 public views::MenuButtonListener, | 58 public views::MenuButtonListener, |
59 public views::ButtonListener, | 59 public views::ButtonListener, |
60 public views::ContextMenuController, | 60 public views::ContextMenuController, |
61 public views::DragController, | 61 public views::DragController, |
62 public ui::AnimationDelegate, | 62 public gfx::AnimationDelegate, |
63 public BookmarkMenuControllerObserver, | 63 public BookmarkMenuControllerObserver, |
64 public BookmarkBarInstructionsDelegate, | 64 public BookmarkBarInstructionsDelegate, |
65 public BookmarkBubbleViewObserver { | 65 public BookmarkBubbleViewObserver { |
66 public: | 66 public: |
67 // The internal view class name. | 67 // The internal view class name. |
68 static const char kViewClassName[]; | 68 static const char kViewClassName[]; |
69 | 69 |
70 // Constant used in Browser View, as well as here. | 70 // Constant used in Browser View, as well as here. |
71 // How inset the bookmarks bar is when displayed on the new tab page. | 71 // How inset the bookmarks bar is when displayed on the new tab page. |
72 static const int kNewtabHorizontalPadding; | 72 static const int kNewtabHorizontalPadding; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; | 177 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
178 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 178 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
179 virtual void OnDragExited() OVERRIDE; | 179 virtual void OnDragExited() OVERRIDE; |
180 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 180 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
181 virtual void OnThemeChanged() OVERRIDE; | 181 virtual void OnThemeChanged() OVERRIDE; |
182 virtual const char* GetClassName() const OVERRIDE; | 182 virtual const char* GetClassName() const OVERRIDE; |
183 | 183 |
184 // AccessiblePaneView: | 184 // AccessiblePaneView: |
185 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 185 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
186 | 186 |
187 // ui::AnimationDelegate: | 187 // gfx::AnimationDelegate: |
188 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 188 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
189 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 189 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
190 | 190 |
191 // BookmarkMenuControllerObserver: | 191 // BookmarkMenuControllerObserver: |
192 virtual void BookmarkMenuControllerDeleted( | 192 virtual void BookmarkMenuControllerDeleted( |
193 BookmarkMenuController* controller) OVERRIDE; | 193 BookmarkMenuController* controller) OVERRIDE; |
194 | 194 |
195 // BookmarkBarInstructionsDelegate: | 195 // BookmarkBarInstructionsDelegate: |
196 virtual void ShowImportDialog() OVERRIDE; | 196 virtual void ShowImportDialog() OVERRIDE; |
197 | 197 |
198 // BookmarkBubbleViewObserver: | 198 // BookmarkBubbleViewObserver: |
199 virtual void OnBookmarkBubbleShown(const GURL& url) OVERRIDE; | 199 virtual void OnBookmarkBubbleShown(const GURL& url) OVERRIDE; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 414 |
415 ButtonSeparatorView* bookmarks_separator_view_; | 415 ButtonSeparatorView* bookmarks_separator_view_; |
416 | 416 |
417 Browser* browser_; | 417 Browser* browser_; |
418 BrowserView* browser_view_; | 418 BrowserView* browser_view_; |
419 | 419 |
420 // True if the owning browser is showing an infobar. | 420 // True if the owning browser is showing an infobar. |
421 bool infobar_visible_; | 421 bool infobar_visible_; |
422 | 422 |
423 // Animation controlling showing and hiding of the bar. | 423 // Animation controlling showing and hiding of the bar. |
424 scoped_ptr<ui::SlideAnimation> size_animation_; | 424 scoped_ptr<gfx::SlideAnimation> size_animation_; |
425 | 425 |
426 // If the bookmark bubble is showing, this is the visible ancestor of the URL. | 426 // If the bookmark bubble is showing, this is the visible ancestor of the URL. |
427 // The visible ancestor is either the other_bookmarked_button_, | 427 // The visible ancestor is either the other_bookmarked_button_, |
428 // overflow_button_ or a button on the bar. | 428 // overflow_button_ or a button on the bar. |
429 views::CustomButton* throbbing_view_; | 429 views::CustomButton* throbbing_view_; |
430 | 430 |
431 BookmarkBar::State bookmark_bar_state_; | 431 BookmarkBar::State bookmark_bar_state_; |
432 | 432 |
433 // Are we animating to or from the detached state? | 433 // Are we animating to or from the detached state? |
434 bool animating_detached_; | 434 bool animating_detached_; |
435 | 435 |
436 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 436 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
437 }; | 437 }; |
438 | 438 |
439 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 439 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |