| 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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/observer_list.h" |
| 14 #include "base/prefs/pref_change_registrar.h" | 15 #include "base/prefs/pref_change_registrar.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_stats.h" | 16 #include "chrome/browser/bookmarks/bookmark_stats.h" |
| 16 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 17 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
| 17 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" | 18 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" |
| 18 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" | 19 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" |
| 19 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_observer.h" | 20 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_observer.h" |
| 20 #include "chrome/browser/ui/views/detachable_toolbar_view.h" | 21 #include "chrome/browser/ui/views/detachable_toolbar_view.h" |
| 21 #include "components/bookmarks/browser/bookmark_model_observer.h" | 22 #include "components/bookmarks/browser/bookmark_model_observer.h" |
| 22 #include "components/bookmarks/browser/bookmark_node_data.h" | 23 #include "components/bookmarks/browser/bookmark_node_data.h" |
| 23 #include "ui/gfx/animation/animation_delegate.h" | 24 #include "ui/gfx/animation/animation_delegate.h" |
| 24 #include "ui/views/context_menu_controller.h" | 25 #include "ui/views/context_menu_controller.h" |
| 25 #include "ui/views/controls/button/button.h" | 26 #include "ui/views/controls/button/button.h" |
| 26 #include "ui/views/controls/button/menu_button_listener.h" | 27 #include "ui/views/controls/button/menu_button_listener.h" |
| 27 #include "ui/views/controls/menu/menu_types.h" | 28 #include "ui/views/controls/menu/menu_types.h" |
| 28 #include "ui/views/drag_controller.h" | 29 #include "ui/views/drag_controller.h" |
| 29 | 30 |
| 31 class BookmarkBarViewObserver; |
| 30 class BookmarkContextMenu; | 32 class BookmarkContextMenu; |
| 31 class BookmarkModel; | 33 class BookmarkModel; |
| 32 class Browser; | 34 class Browser; |
| 33 class BrowserView; | 35 class BrowserView; |
| 34 class ChromeBookmarkClient; | 36 class ChromeBookmarkClient; |
| 35 class Profile; | 37 class Profile; |
| 36 | 38 |
| 37 namespace content { | 39 namespace content { |
| 38 class PageNavigator; | 40 class PageNavigator; |
| 39 } | 41 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 84 |
| 83 // |browser_view| can be NULL during tests. | 85 // |browser_view| can be NULL during tests. |
| 84 BookmarkBarView(Browser* browser, BrowserView* browser_view); | 86 BookmarkBarView(Browser* browser, BrowserView* browser_view); |
| 85 virtual ~BookmarkBarView(); | 87 virtual ~BookmarkBarView(); |
| 86 | 88 |
| 87 static void DisableAnimationsForTesting(bool disabled); | 89 static void DisableAnimationsForTesting(bool disabled); |
| 88 | 90 |
| 89 // Returns the current browser. | 91 // Returns the current browser. |
| 90 Browser* browser() const { return browser_; } | 92 Browser* browser() const { return browser_; } |
| 91 | 93 |
| 94 void AddObserver(BookmarkBarViewObserver* observer); |
| 95 void RemoveObserver(BookmarkBarViewObserver* observer); |
| 96 |
| 92 // Sets the PageNavigator that is used when the user selects an entry on | 97 // Sets the PageNavigator that is used when the user selects an entry on |
| 93 // the bookmark bar. | 98 // the bookmark bar. |
| 94 void SetPageNavigator(content::PageNavigator* navigator); | 99 void SetPageNavigator(content::PageNavigator* navigator); |
| 95 | 100 |
| 96 // Sets whether the containing browser is showing an infobar. This affects | 101 // Sets whether the containing browser is showing an infobar. This affects |
| 97 // layout during animation. | 102 // layout during animation. |
| 98 void set_infobar_visible(bool infobar_visible) { | 103 void set_infobar_visible(bool infobar_visible) { |
| 99 infobar_visible_ = infobar_visible; | 104 infobar_visible_ = infobar_visible; |
| 100 } | 105 } |
| 101 | 106 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 int* formats, | 182 int* formats, |
| 178 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 183 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; |
| 179 virtual bool AreDropTypesRequired() OVERRIDE; | 184 virtual bool AreDropTypesRequired() OVERRIDE; |
| 180 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; | 185 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; |
| 181 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; | 186 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
| 182 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 187 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
| 183 virtual void OnDragExited() OVERRIDE; | 188 virtual void OnDragExited() OVERRIDE; |
| 184 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 189 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
| 185 virtual void OnThemeChanged() OVERRIDE; | 190 virtual void OnThemeChanged() OVERRIDE; |
| 186 virtual const char* GetClassName() const OVERRIDE; | 191 virtual const char* GetClassName() const OVERRIDE; |
| 192 virtual void SetVisible(bool visible) OVERRIDE; |
| 187 | 193 |
| 188 // AccessiblePaneView: | 194 // AccessiblePaneView: |
| 189 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 195 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
| 190 | 196 |
| 191 // gfx::AnimationDelegate: | 197 // gfx::AnimationDelegate: |
| 192 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 198 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
| 193 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 199 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
| 194 | 200 |
| 195 // BookmarkMenuControllerObserver: | 201 // BookmarkMenuControllerObserver: |
| 196 virtual void BookmarkMenuControllerDeleted( | 202 virtual void BookmarkMenuControllerDeleted( |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 413 |
| 408 // Shows the other bookmark entries. | 414 // Shows the other bookmark entries. |
| 409 views::MenuButton* other_bookmarked_button_; | 415 views::MenuButton* other_bookmarked_button_; |
| 410 | 416 |
| 411 // Shows the managed bookmarks entries. | 417 // Shows the managed bookmarks entries. |
| 412 views::MenuButton* managed_bookmarks_button_; | 418 views::MenuButton* managed_bookmarks_button_; |
| 413 | 419 |
| 414 // Shows the Apps page shortcut. | 420 // Shows the Apps page shortcut. |
| 415 views::LabelButton* apps_page_shortcut_; | 421 views::LabelButton* apps_page_shortcut_; |
| 416 | 422 |
| 417 // Task used to delay showing of the drop menu. | |
| 418 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; | |
| 419 | |
| 420 // Used to track drops on the bookmark bar view. | 423 // Used to track drops on the bookmark bar view. |
| 421 scoped_ptr<DropInfo> drop_info_; | 424 scoped_ptr<DropInfo> drop_info_; |
| 422 | 425 |
| 423 // Visible if not all the bookmark buttons fit. | 426 // Visible if not all the bookmark buttons fit. |
| 424 views::MenuButton* overflow_button_; | 427 views::MenuButton* overflow_button_; |
| 425 | 428 |
| 426 // Shows a text and a link to import bookmarks if there are no bookmarks in | 429 // Shows a text and a link to import bookmarks if there are no bookmarks in |
| 427 // the Bookmarks Bar. | 430 // the Bookmarks Bar. |
| 428 views::View* instructions_; | 431 views::View* instructions_; |
| 429 | 432 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 441 // If the bookmark bubble is showing, this is the visible ancestor of the URL. | 444 // If the bookmark bubble is showing, this is the visible ancestor of the URL. |
| 442 // The visible ancestor is either the other_bookmarked_button_, | 445 // The visible ancestor is either the other_bookmarked_button_, |
| 443 // overflow_button_ or a button on the bar. | 446 // overflow_button_ or a button on the bar. |
| 444 views::CustomButton* throbbing_view_; | 447 views::CustomButton* throbbing_view_; |
| 445 | 448 |
| 446 BookmarkBar::State bookmark_bar_state_; | 449 BookmarkBar::State bookmark_bar_state_; |
| 447 | 450 |
| 448 // Are we animating to or from the detached state? | 451 // Are we animating to or from the detached state? |
| 449 bool animating_detached_; | 452 bool animating_detached_; |
| 450 | 453 |
| 454 ObserverList<BookmarkBarViewObserver> observers_; |
| 455 |
| 456 // Factory used to delay showing of the drop menu. |
| 457 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; |
| 458 |
| 451 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 459 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
| 452 }; | 460 }; |
| 453 | 461 |
| 454 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 462 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
| OLD | NEW |