OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 static const char kViewClassName[]; | 63 static const char kViewClassName[]; |
64 | 64 |
65 // Constants used in Browser View, as well as here. | 65 // Constants used in Browser View, as well as here. |
66 // How inset the bookmarks bar is when displayed on the new tab page. | 66 // How inset the bookmarks bar is when displayed on the new tab page. |
67 static const int kNewtabHorizontalPadding; | 67 static const int kNewtabHorizontalPadding; |
68 static const int kNewtabVerticalPadding; | 68 static const int kNewtabVerticalPadding; |
69 | 69 |
70 // Maximum size of buttons on the bookmark bar. | 70 // Maximum size of buttons on the bookmark bar. |
71 static const int kMaxButtonWidth; | 71 static const int kMaxButtonWidth; |
72 | 72 |
73 BookmarkBarView(Profile* profile, Browser* browser); | 73 explicit BookmarkBarView(Browser* browser); |
74 virtual ~BookmarkBarView(); | 74 virtual ~BookmarkBarView(); |
75 | 75 |
76 // Resets the profile. This removes any buttons for the current profile and | |
77 // recreates the models. | |
78 void SetProfile(Profile* profile); | |
79 | |
80 // Returns the current browser. | 76 // Returns the current browser. |
81 Browser* browser() const { return browser_; } | 77 Browser* browser() const { return browser_; } |
82 | 78 |
83 // Sets the PageNavigator that is used when the user selects an entry on | 79 // Sets the PageNavigator that is used when the user selects an entry on |
84 // the bookmark bar. | 80 // the bookmark bar. |
85 void SetPageNavigator(PageNavigator* navigator); | 81 void SetPageNavigator(PageNavigator* navigator); |
86 | 82 |
87 // Sets whether the containing browser is showing an infobar. This affects | 83 // Sets whether the containing browser is showing an infobar. This affects |
88 // layout during animation. | 84 // layout during animation. |
89 void set_infobar_visible(bool infobar_visible) { | 85 void set_infobar_visible(bool infobar_visible) { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 void UpdateOtherBookmarksVisibility(); | 351 void UpdateOtherBookmarksVisibility(); |
356 | 352 |
357 // This method computes the bounds for the bookmark bar items. If | 353 // This method computes the bounds for the bookmark bar items. If |
358 // |compute_bounds_only| = TRUE, the bounds for the items are just computed, | 354 // |compute_bounds_only| = TRUE, the bounds for the items are just computed, |
359 // but are not set. This mode is used by GetPreferredSize() to obtain the | 355 // but are not set. This mode is used by GetPreferredSize() to obtain the |
360 // desired bounds. If |compute_bounds_only| = FALSE, the bounds are set. | 356 // desired bounds. If |compute_bounds_only| = FALSE, the bounds are set. |
361 gfx::Size LayoutItems(bool compute_bounds_only); | 357 gfx::Size LayoutItems(bool compute_bounds_only); |
362 | 358 |
363 NotificationRegistrar registrar_; | 359 NotificationRegistrar registrar_; |
364 | 360 |
365 Profile* profile_; | |
366 | |
367 // Used for opening urls. | 361 // Used for opening urls. |
368 PageNavigator* page_navigator_; | 362 PageNavigator* page_navigator_; |
369 | 363 |
370 // Model providing details as to the starred entries/folders that should be | 364 // Model providing details as to the starred entries/folders that should be |
371 // shown. This is owned by the Profile. | 365 // shown. This is owned by the Profile. |
372 BookmarkModel* model_; | 366 BookmarkModel* model_; |
373 | 367 |
374 // Used to manage showing a Menu, either for the most recently bookmarked | 368 // Used to manage showing a Menu, either for the most recently bookmarked |
375 // entries, or for the starred folder. | 369 // entries, or for the starred folder. |
376 BookmarkMenuController* bookmark_menu_; | 370 BookmarkMenuController* bookmark_menu_; |
(...skipping 21 matching lines...) Expand all Loading... | |
398 | 392 |
399 // Visible if not all the bookmark buttons fit. | 393 // Visible if not all the bookmark buttons fit. |
400 views::MenuButton* overflow_button_; | 394 views::MenuButton* overflow_button_; |
401 | 395 |
402 // BookmarkBarInstructionsView that is visible if there are no bookmarks on | 396 // BookmarkBarInstructionsView that is visible if there are no bookmarks on |
403 // the bookmark bar. | 397 // the bookmark bar. |
404 views::View* instructions_; | 398 views::View* instructions_; |
405 | 399 |
406 ButtonSeparatorView* bookmarks_separator_view_; | 400 ButtonSeparatorView* bookmarks_separator_view_; |
407 | 401 |
408 // Owning browser. This is NULL during testing. | 402 // Owning browser. This is NULL during testing. |
sky
2011/08/08 16:02:29
Is the comment about NULL during testing applicabl
Peter Kasting
2011/08/08 17:52:07
No.
| |
409 Browser* browser_; | 403 Browser* browser_; |
410 | 404 |
411 // True if the owning browser is showing an infobar. | 405 // True if the owning browser is showing an infobar. |
412 bool infobar_visible_; | 406 bool infobar_visible_; |
413 | 407 |
414 // Animation controlling showing and hiding of the bar. | 408 // Animation controlling showing and hiding of the bar. |
415 scoped_ptr<ui::SlideAnimation> size_animation_; | 409 scoped_ptr<ui::SlideAnimation> size_animation_; |
416 | 410 |
417 // If the bookmark bubble is showing, this is the visible ancestor of the URL. | 411 // If the bookmark bubble is showing, this is the visible ancestor of the URL. |
418 // The visible ancestor is either the other_bookmarked_button_, | 412 // The visible ancestor is either the other_bookmarked_button_, |
419 // overflow_button_ or a button on the bar. | 413 // overflow_button_ or a button on the bar. |
420 views::CustomButton* throbbing_view_; | 414 views::CustomButton* throbbing_view_; |
421 | 415 |
422 BookmarkBar::State bookmark_bar_state_; | 416 BookmarkBar::State bookmark_bar_state_; |
423 | 417 |
424 // Are we animating to or from the detached state? | 418 // Are we animating to or from the detached state? |
425 bool animating_detached_; | 419 bool animating_detached_; |
426 | 420 |
427 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 421 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
428 }; | 422 }; |
429 | 423 |
430 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 424 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |