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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ui/gfx/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_types.h" | 28 #include "ui/views/controls/menu/menu_types.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 class ChromeBookmarkClient; |
34 class Profile; | 35 class Profile; |
35 | 36 |
36 namespace content { | 37 namespace content { |
37 class PageNavigator; | 38 class PageNavigator; |
38 } | 39 } |
39 | 40 |
40 namespace gfx { | 41 namespace gfx { |
41 class SlideAnimation; | 42 class SlideAnimation; |
42 } | 43 } |
43 | 44 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state. | 295 // BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state. |
295 BookmarkLaunchLocation GetBookmarkLaunchLocation() const; | 296 BookmarkLaunchLocation GetBookmarkLaunchLocation() const; |
296 | 297 |
297 // Returns the index of the first hidden bookmark button. If all buttons are | 298 // Returns the index of the first hidden bookmark button. If all buttons are |
298 // visible, this returns GetBookmarkButtonCount(). | 299 // visible, this returns GetBookmarkButtonCount(). |
299 int GetFirstHiddenNodeIndex(); | 300 int GetFirstHiddenNodeIndex(); |
300 | 301 |
301 // Creates the button showing the other bookmarked items. | 302 // Creates the button showing the other bookmarked items. |
302 views::MenuButton* CreateOtherBookmarkedButton(); | 303 views::MenuButton* CreateOtherBookmarkedButton(); |
303 | 304 |
| 305 // Creates the button showing the managed bookmarks items. |
| 306 views::MenuButton* CreateManagedBookmarksButton(); |
| 307 |
304 // Creates the button used when not all bookmark buttons fit. | 308 // Creates the button used when not all bookmark buttons fit. |
305 views::MenuButton* CreateOverflowButton(); | 309 views::MenuButton* CreateOverflowButton(); |
306 | 310 |
307 // Creates the button for rendering the specified bookmark node. | 311 // Creates the button for rendering the specified bookmark node. |
308 views::View* CreateBookmarkButton(const BookmarkNode* node); | 312 views::View* CreateBookmarkButton(const BookmarkNode* node); |
309 | 313 |
310 // Creates the button for rendering the apps page shortcut. | 314 // Creates the button for rendering the apps page shortcut. |
311 views::TextButton* CreateAppsPageShortcutButton(); | 315 views::TextButton* CreateAppsPageShortcutButton(); |
312 | 316 |
313 // Configures the button from the specified node. This sets the text, | 317 // Configures the button from the specified node. This sets the text, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // Returns the view to throb when a node is removed. |parent| is the parent of | 359 // Returns the view to throb when a node is removed. |parent| is the parent of |
356 // the node that was removed, and |old_index| the index of the node that was | 360 // the node that was removed, and |old_index| the index of the node that was |
357 // removed. | 361 // removed. |
358 views::CustomButton* DetermineViewToThrobFromRemove( | 362 views::CustomButton* DetermineViewToThrobFromRemove( |
359 const BookmarkNode* parent, | 363 const BookmarkNode* parent, |
360 int old_index); | 364 int old_index); |
361 | 365 |
362 // Updates the colors for all the child objects in the bookmarks bar. | 366 // Updates the colors for all the child objects in the bookmarks bar. |
363 void UpdateColors(); | 367 void UpdateColors(); |
364 | 368 |
365 // Updates the visibility of |other_bookmarked_button_|. Also shows or hide | 369 // Updates the visibility of |other_bookmarked_button_| and |
366 // the separator if required. | 370 // |managed_bookmarks_button_|. Also shows or hides the separator if required. |
367 void UpdateOtherBookmarksVisibility(); | 371 void UpdateButtonsVisibility(); |
368 | 372 |
369 // Updates the visibility of |bookmarks_separator_view_|. | 373 // Updates the visibility of |bookmarks_separator_view_|. |
370 void UpdateBookmarksSeparatorVisibility(); | 374 void UpdateBookmarksSeparatorVisibility(); |
371 | 375 |
372 // This method computes the bounds for the bookmark bar items. | 376 // This method computes the bounds for the bookmark bar items. |
373 void LayoutItems(); | 377 void LayoutItems(); |
374 | 378 |
375 // Updates the visibility of the apps shortcut based on the pref value. | 379 // Updates the visibility of the apps shortcut based on the pref value. |
376 void OnAppsPageShortcutVisibilityPrefChanged(); | 380 void OnAppsPageShortcutVisibilityPrefChanged(); |
377 | 381 |
378 // Needed to react to kShowAppsShortcutInBookmarkBar changes. | 382 // Needed to react to kShowAppsShortcutInBookmarkBar changes. |
379 PrefChangeRegistrar profile_pref_registrar_; | 383 PrefChangeRegistrar profile_pref_registrar_; |
380 | 384 |
381 // Used for opening urls. | 385 // Used for opening urls. |
382 content::PageNavigator* page_navigator_; | 386 content::PageNavigator* page_navigator_; |
383 | 387 |
384 // Model providing details as to the starred entries/folders that should be | 388 // Model providing details as to the starred entries/folders that should be |
385 // shown. This is owned by the Profile. | 389 // shown. This is owned by the Profile. |
386 BookmarkModel* model_; | 390 BookmarkModel* model_; |
387 | 391 |
| 392 // The ChromeBookmarkClient that owns the |model_|. |
| 393 ChromeBookmarkClient* client_; |
| 394 |
388 // Used to manage showing a Menu, either for the most recently bookmarked | 395 // Used to manage showing a Menu, either for the most recently bookmarked |
389 // entries, or for the starred folder. | 396 // entries, or for the starred folder. |
390 BookmarkMenuController* bookmark_menu_; | 397 BookmarkMenuController* bookmark_menu_; |
391 | 398 |
392 // Used when showing a menu for drag and drop. That is, if the user drags | 399 // Used when showing a menu for drag and drop. That is, if the user drags |
393 // over a folder this becomes non-null and manages the menu showing the | 400 // over a folder this becomes non-null and manages the menu showing the |
394 // contents of the node. | 401 // contents of the node. |
395 BookmarkMenuController* bookmark_drop_menu_; | 402 BookmarkMenuController* bookmark_drop_menu_; |
396 | 403 |
397 // If non-NULL we're showing a context menu for one of the items on the | 404 // If non-NULL we're showing a context menu for one of the items on the |
398 // bookmark bar. | 405 // bookmark bar. |
399 scoped_ptr<BookmarkContextMenu> context_menu_; | 406 scoped_ptr<BookmarkContextMenu> context_menu_; |
400 | 407 |
401 // Shows the other bookmark entries. | 408 // Shows the other bookmark entries. |
402 views::MenuButton* other_bookmarked_button_; | 409 views::MenuButton* other_bookmarked_button_; |
403 | 410 |
| 411 // Shows the managed bookmarks entries. |
| 412 views::MenuButton* managed_bookmarks_button_; |
| 413 |
404 // Shows the Apps page shortcut. | 414 // Shows the Apps page shortcut. |
405 views::TextButton* apps_page_shortcut_; | 415 views::TextButton* apps_page_shortcut_; |
406 | 416 |
407 // Task used to delay showing of the drop menu. | 417 // Task used to delay showing of the drop menu. |
408 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; | 418 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; |
409 | 419 |
410 // Used to track drops on the bookmark bar view. | 420 // Used to track drops on the bookmark bar view. |
411 scoped_ptr<DropInfo> drop_info_; | 421 scoped_ptr<DropInfo> drop_info_; |
412 | 422 |
413 // Visible if not all the bookmark buttons fit. | 423 // Visible if not all the bookmark buttons fit. |
(...skipping 21 matching lines...) Expand all Loading... |
435 | 445 |
436 BookmarkBar::State bookmark_bar_state_; | 446 BookmarkBar::State bookmark_bar_state_; |
437 | 447 |
438 // Are we animating to or from the detached state? | 448 // Are we animating to or from the detached state? |
439 bool animating_detached_; | 449 bool animating_detached_; |
440 | 450 |
441 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 451 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
442 }; | 452 }; |
443 | 453 |
444 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 454 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |