Chromium Code Reviews| 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/public/pref_change_registrar.h" | |
| 15 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 17 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 17 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 18 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
| 18 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" | 19 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" |
| 19 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" | 20 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" |
| 20 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" | 21 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" |
| 21 #include "chrome/browser/ui/views/detachable_toolbar_view.h" | 22 #include "chrome/browser/ui/views/detachable_toolbar_view.h" |
| 22 #include "ui/base/animation/animation_delegate.h" | 23 #include "ui/base/animation/animation_delegate.h" |
| 23 #include "ui/views/context_menu_controller.h" | 24 #include "ui/views/context_menu_controller.h" |
| 24 #include "ui/views/controls/button/button.h" | 25 #include "ui/views/controls/button/button.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 | 283 |
| 283 // Creates the button showing the other bookmarked items. | 284 // Creates the button showing the other bookmarked items. |
| 284 views::MenuButton* CreateOtherBookmarkedButton(); | 285 views::MenuButton* CreateOtherBookmarkedButton(); |
| 285 | 286 |
| 286 // Creates the button used when not all bookmark buttons fit. | 287 // Creates the button used when not all bookmark buttons fit. |
| 287 views::MenuButton* CreateOverflowButton(); | 288 views::MenuButton* CreateOverflowButton(); |
| 288 | 289 |
| 289 // Creates the button for rendering the specified bookmark node. | 290 // Creates the button for rendering the specified bookmark node. |
| 290 views::View* CreateBookmarkButton(const BookmarkNode* node); | 291 views::View* CreateBookmarkButton(const BookmarkNode* node); |
| 291 | 292 |
| 293 // Creates the button for rendering the apps page shortcut. | |
| 294 views::TextButton* CreateAppsPageShortcutButton(); | |
| 295 | |
| 292 // Configures the button from the specified node. This sets the text, | 296 // Configures the button from the specified node. This sets the text, |
| 293 // and icon. | 297 // and icon. |
| 294 void ConfigureButton(const BookmarkNode* node, views::TextButton* button); | 298 void ConfigureButton(const BookmarkNode* node, views::TextButton* button); |
| 295 | 299 |
| 296 // Implementation for BookmarkNodeAddedImpl. | 300 // Implementation for BookmarkNodeAddedImpl. |
| 297 void BookmarkNodeAddedImpl(BookmarkModel* model, | 301 void BookmarkNodeAddedImpl(BookmarkModel* model, |
| 298 const BookmarkNode* parent, | 302 const BookmarkNode* parent, |
| 299 int index); | 303 int index); |
| 300 | 304 |
| 301 // Implementation for BookmarkNodeRemoved. | 305 // Implementation for BookmarkNodeRemoved. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 // Updates the visibility of |other_bookmarked_button_| and | 348 // Updates the visibility of |other_bookmarked_button_| and |
| 345 // |bookmarks_separator_view_|. | 349 // |bookmarks_separator_view_|. |
| 346 void UpdateOtherBookmarksVisibility(); | 350 void UpdateOtherBookmarksVisibility(); |
| 347 | 351 |
| 348 // This method computes the bounds for the bookmark bar items. If | 352 // This method computes the bounds for the bookmark bar items. If |
| 349 // |compute_bounds_only| = TRUE, the bounds for the items are just computed, | 353 // |compute_bounds_only| = TRUE, the bounds for the items are just computed, |
| 350 // but are not set. This mode is used by GetPreferredSize() to obtain the | 354 // but are not set. This mode is used by GetPreferredSize() to obtain the |
| 351 // desired bounds. If |compute_bounds_only| = FALSE, the bounds are set. | 355 // desired bounds. If |compute_bounds_only| = FALSE, the bounds are set. |
| 352 gfx::Size LayoutItems(bool compute_bounds_only); | 356 gfx::Size LayoutItems(bool compute_bounds_only); |
| 353 | 357 |
| 358 // Returns true is we should show the apps shortcut. | |
| 359 bool ShouldShowAppsShortcut(); | |
|
Alexei Svitkine (slow)
2013/02/25 21:13:29
Can this be const?
MAD
2013/02/25 21:41:01
Done.
| |
| 360 | |
| 361 // Updates the visibility of the apps shortcut based on the pref value. | |
| 362 void OnAppsPageShortcutVisibilityChanged(); | |
| 363 | |
| 364 PrefChangeRegistrar profile_pref_registrar_; | |
|
Alexei Svitkine (slow)
2013/02/25 21:13:29
Comment mentioning which pref this is for.
MAD
2013/02/25 21:41:01
Done.
| |
| 365 | |
| 354 // Used for opening urls. | 366 // Used for opening urls. |
| 355 content::PageNavigator* page_navigator_; | 367 content::PageNavigator* page_navigator_; |
| 356 | 368 |
| 357 // Model providing details as to the starred entries/folders that should be | 369 // Model providing details as to the starred entries/folders that should be |
| 358 // shown. This is owned by the Profile. | 370 // shown. This is owned by the Profile. |
| 359 BookmarkModel* model_; | 371 BookmarkModel* model_; |
| 360 | 372 |
| 361 // Used to manage showing a Menu, either for the most recently bookmarked | 373 // Used to manage showing a Menu, either for the most recently bookmarked |
| 362 // entries, or for the starred folder. | 374 // entries, or for the starred folder. |
| 363 BookmarkMenuController* bookmark_menu_; | 375 BookmarkMenuController* bookmark_menu_; |
| 364 | 376 |
| 365 // Used when showing a menu for drag and drop. That is, if the user drags | 377 // Used when showing a menu for drag and drop. That is, if the user drags |
| 366 // over a folder this becomes non-null and manages the menu showing the | 378 // over a folder this becomes non-null and manages the menu showing the |
| 367 // contents of the node. | 379 // contents of the node. |
| 368 BookmarkMenuController* bookmark_drop_menu_; | 380 BookmarkMenuController* bookmark_drop_menu_; |
| 369 | 381 |
| 370 // If non-NULL we're showing a context menu for one of the items on the | 382 // If non-NULL we're showing a context menu for one of the items on the |
| 371 // bookmark bar. | 383 // bookmark bar. |
| 372 scoped_ptr<BookmarkContextMenu> context_menu_; | 384 scoped_ptr<BookmarkContextMenu> context_menu_; |
| 373 | 385 |
| 374 // Shows the other bookmark entries. | 386 // Shows the other bookmark entries. |
| 375 views::MenuButton* other_bookmarked_button_; | 387 views::MenuButton* other_bookmarked_button_; |
| 376 | 388 |
| 389 // Shows the Apps page shortcut. | |
| 390 views::TextButton* apps_page_shortcut_; | |
| 391 | |
| 377 // Task used to delay showing of the drop menu. | 392 // Task used to delay showing of the drop menu. |
| 378 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; | 393 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; |
| 379 | 394 |
| 380 // Used to track drops on the bookmark bar view. | 395 // Used to track drops on the bookmark bar view. |
| 381 scoped_ptr<DropInfo> drop_info_; | 396 scoped_ptr<DropInfo> drop_info_; |
| 382 | 397 |
| 383 // Visible if not all the bookmark buttons fit. | 398 // Visible if not all the bookmark buttons fit. |
| 384 views::MenuButton* overflow_button_; | 399 views::MenuButton* overflow_button_; |
| 385 | 400 |
| 386 // BookmarkBarInstructionsView that is visible if there are no bookmarks on | 401 // BookmarkBarInstructionsView that is visible if there are no bookmarks on |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 405 | 420 |
| 406 BookmarkBar::State bookmark_bar_state_; | 421 BookmarkBar::State bookmark_bar_state_; |
| 407 | 422 |
| 408 // Are we animating to or from the detached state? | 423 // Are we animating to or from the detached state? |
| 409 bool animating_detached_; | 424 bool animating_detached_; |
| 410 | 425 |
| 411 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 426 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
| 412 }; | 427 }; |
| 413 | 428 |
| 414 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 429 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
| OLD | NEW |