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" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const BookmarkNode* GetNodeForButtonAtModelIndex(const gfx::Point& loc, | 113 const BookmarkNode* GetNodeForButtonAtModelIndex(const gfx::Point& loc, |
114 int* model_start_index); | 114 int* model_start_index); |
115 | 115 |
116 // Returns the MenuButton for node. | 116 // Returns the MenuButton for node. |
117 views::MenuButton* GetMenuButtonForNode(const BookmarkNode* node); | 117 views::MenuButton* GetMenuButtonForNode(const BookmarkNode* node); |
118 | 118 |
119 // Returns the position to anchor the menu for |button| at. | 119 // Returns the position to anchor the menu for |button| at. |
120 void GetAnchorPositionForButton(views::MenuButton* button, | 120 void GetAnchorPositionForButton(views::MenuButton* button, |
121 views::MenuAnchorPosition* anchor); | 121 views::MenuAnchorPosition* anchor); |
122 | 122 |
123 // Returns the button responsible for showing bookmarks in the other bookmark | 123 // Returns the button responsible for showing bookmarks in the |
124 // folder. | 124 // "Other Bookmarks" folder. |
125 views::MenuButton* other_bookmarked_button() const { | 125 views::MenuButton* other_bookmarks_button() const { |
126 return other_bookmarked_button_; | 126 return other_bookmarks_button_; |
127 } | 127 } |
128 | 128 |
129 // Returns the button used when not all the items on the bookmark bar fit. | 129 // Returns the button used when not all the items on the bookmark bar fit. |
130 views::MenuButton* overflow_button() const { return overflow_button_; } | 130 views::MenuButton* overflow_button() const { return overflow_button_; } |
131 | 131 |
132 // Returns the active MenuItemView, or NULL if a menu isn't showing. | 132 // Returns the active MenuItemView, or NULL if a menu isn't showing. |
133 views::MenuItemView* GetMenu(); | 133 views::MenuItemView* GetMenu(); |
134 | 134 |
135 // Returns the context menu, or null if one isn't showing. | 135 // Returns the context menu, or null if one isn't showing. |
136 views::MenuItemView* GetContextMenu(); | 136 views::MenuItemView* GetContextMenu(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 views::LabelButton* GetBookmarkButton(int index); | 283 views::LabelButton* GetBookmarkButton(int index); |
284 | 284 |
285 // Returns BOOKMARK_LAUNCH_LOCATION_DETACHED_BAR or | 285 // Returns BOOKMARK_LAUNCH_LOCATION_DETACHED_BAR or |
286 // BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state. | 286 // BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state. |
287 BookmarkLaunchLocation GetBookmarkLaunchLocation() const; | 287 BookmarkLaunchLocation GetBookmarkLaunchLocation() const; |
288 | 288 |
289 // Returns the index of the first hidden bookmark button. If all buttons are | 289 // Returns the index of the first hidden bookmark button. If all buttons are |
290 // visible, this returns GetBookmarkButtonCount(). | 290 // visible, this returns GetBookmarkButtonCount(). |
291 int GetFirstHiddenNodeIndex(); | 291 int GetFirstHiddenNodeIndex(); |
292 | 292 |
293 // Creates the button showing the other bookmarked items. | 293 // Creates the button showing the "Other Bookmarks" folder. |
294 views::MenuButton* CreateOtherBookmarkedButton(); | 294 views::MenuButton* CreateOtherBookmarksButton(); |
295 | 295 |
296 // Creates the button showing the managed bookmarks items. | 296 // Creates the button showing the "Managed Bookmarks" folder. |
297 views::MenuButton* CreateManagedBookmarksButton(); | 297 views::MenuButton* CreateManagedBookmarksButton(); |
298 | 298 |
299 // Creates the button used when not all bookmark buttons fit. | 299 // Creates the button used when not all bookmark buttons fit. |
300 views::MenuButton* CreateOverflowButton(); | 300 views::MenuButton* CreateOverflowButton(); |
301 | 301 |
302 // Creates the button for rendering the specified bookmark node. | 302 // Creates the button for rendering the specified bookmark node. |
303 views::View* CreateBookmarkButton(const BookmarkNode* node); | 303 views::View* CreateBookmarkButton(const BookmarkNode* node); |
304 | 304 |
305 // Creates the button for rendering the apps page shortcut. | 305 // Creates the button for rendering the apps page shortcut. |
306 views::LabelButton* CreateAppsPageShortcutButton(); | 306 views::LabelButton* CreateAppsPageShortcutButton(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // Returns the view to throb when a node is removed. |parent| is the parent of | 352 // Returns the view to throb when a node is removed. |parent| is the parent of |
353 // the node that was removed, and |old_index| the index of the node that was | 353 // the node that was removed, and |old_index| the index of the node that was |
354 // removed. | 354 // removed. |
355 views::CustomButton* DetermineViewToThrobFromRemove( | 355 views::CustomButton* DetermineViewToThrobFromRemove( |
356 const BookmarkNode* parent, | 356 const BookmarkNode* parent, |
357 int old_index); | 357 int old_index); |
358 | 358 |
359 // Updates the colors for all the child objects in the bookmarks bar. | 359 // Updates the colors for all the child objects in the bookmarks bar. |
360 void UpdateColors(); | 360 void UpdateColors(); |
361 | 361 |
362 // Updates the visibility of |other_bookmarked_button_| and | 362 // Updates the visibility of |other_bookmarks_button_| and |
363 // |managed_bookmarks_button_|. Also shows or hides the separator if required. | 363 // |managed_bookmarks_button_|. Also shows or hides the separator if required. |
364 // Returns true if something changed and a LayoutAndPaint() is needed. | 364 // Returns true if something changed and a LayoutAndPaint() is needed. |
365 bool UpdateOtherAndManagedButtonsVisibility(); | 365 bool UpdateOtherAndManagedButtonsVisibility(); |
366 | 366 |
367 // Updates the visibility of |bookmarks_separator_view_|. | 367 // Updates the visibility of |bookmarks_separator_view_|. |
368 void UpdateBookmarksSeparatorVisibility(); | 368 void UpdateBookmarksSeparatorVisibility(); |
369 | 369 |
370 // Updates the visibility of the apps shortcut based on the pref value. | 370 // Updates the visibility of the apps shortcut based on the pref value. |
371 void OnAppsPageShortcutVisibilityPrefChanged(); | 371 void OnAppsPageShortcutVisibilityPrefChanged(); |
372 | 372 |
(...skipping 23 matching lines...) Expand all Loading... |
396 | 396 |
397 // Used when showing a menu for drag and drop. That is, if the user drags | 397 // Used when showing a menu for drag and drop. That is, if the user drags |
398 // over a folder this becomes non-null and manages the menu showing the | 398 // over a folder this becomes non-null and manages the menu showing the |
399 // contents of the node. | 399 // contents of the node. |
400 BookmarkMenuController* bookmark_drop_menu_; | 400 BookmarkMenuController* bookmark_drop_menu_; |
401 | 401 |
402 // If non-NULL we're showing a context menu for one of the items on the | 402 // If non-NULL we're showing a context menu for one of the items on the |
403 // bookmark bar. | 403 // bookmark bar. |
404 scoped_ptr<BookmarkContextMenu> context_menu_; | 404 scoped_ptr<BookmarkContextMenu> context_menu_; |
405 | 405 |
406 // Shows the other bookmark entries. | 406 // Shows the "Other Bookmarks" folder button. |
407 views::MenuButton* other_bookmarked_button_; | 407 views::MenuButton* other_bookmarks_button_; |
408 | 408 |
409 // Shows the managed bookmarks entries. | 409 // Shows the managed bookmarks entries. |
410 views::MenuButton* managed_bookmarks_button_; | 410 views::MenuButton* managed_bookmarks_button_; |
411 | 411 |
412 // Shows the Apps page shortcut. | 412 // Shows the Apps page shortcut. |
413 views::LabelButton* apps_page_shortcut_; | 413 views::LabelButton* apps_page_shortcut_; |
414 | 414 |
415 // Used to track drops on the bookmark bar view. | 415 // Used to track drops on the bookmark bar view. |
416 scoped_ptr<DropInfo> drop_info_; | 416 scoped_ptr<DropInfo> drop_info_; |
417 | 417 |
418 // Visible if not all the bookmark buttons fit. | 418 // Visible if not all the bookmark buttons fit. |
419 views::MenuButton* overflow_button_; | 419 views::MenuButton* overflow_button_; |
420 | 420 |
421 // Shows a text and a link to import bookmarks if there are no bookmarks in | 421 // Shows a text and a link to import bookmarks if there are no bookmarks in |
422 // the Bookmarks Bar. | 422 // the Bookmarks Bar. |
423 views::View* instructions_; | 423 views::View* instructions_; |
424 | 424 |
425 ButtonSeparatorView* bookmarks_separator_view_; | 425 ButtonSeparatorView* bookmarks_separator_view_; |
426 | 426 |
427 Browser* browser_; | 427 Browser* browser_; |
428 BrowserView* browser_view_; | 428 BrowserView* browser_view_; |
429 | 429 |
430 // True if the owning browser is showing an infobar. | 430 // True if the owning browser is showing an infobar. |
431 bool infobar_visible_; | 431 bool infobar_visible_; |
432 | 432 |
433 // Animation controlling showing and hiding of the bar. | 433 // Animation controlling showing and hiding of the bar. |
434 scoped_ptr<gfx::SlideAnimation> size_animation_; | 434 scoped_ptr<gfx::SlideAnimation> size_animation_; |
435 | 435 |
436 // If the bookmark bubble is showing, this is the visible ancestor of the URL. | 436 // If the bookmark bubble is showing, this is the visible ancestor of the URL. |
437 // The visible ancestor is either the other_bookmarked_button_, | 437 // The visible ancestor is either the |other_bookmarks_button_|, |
438 // overflow_button_ or a button on the bar. | 438 // |overflow_button_| or a button on the bar. |
439 views::CustomButton* throbbing_view_; | 439 views::CustomButton* throbbing_view_; |
440 | 440 |
441 BookmarkBar::State bookmark_bar_state_; | 441 BookmarkBar::State bookmark_bar_state_; |
442 | 442 |
443 // Are we animating to or from the detached state? | 443 // Are we animating to or from the detached state? |
444 bool animating_detached_; | 444 bool animating_detached_; |
445 | 445 |
446 ObserverList<BookmarkBarViewObserver> observers_; | 446 ObserverList<BookmarkBarViewObserver> observers_; |
447 | 447 |
448 // Factory used to delay showing of the drop menu. | 448 // Factory used to delay showing of the drop menu. |
449 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; | 449 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; |
450 | 450 |
451 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 451 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
452 }; | 452 }; |
453 | 453 |
454 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 454 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |