| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/views/bookmark_bar_view.h" | 5 #include "chrome/browser/views/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 Loaded(model_); | 453 Loaded(model_); |
| 454 // else case: we'll receive notification back from the BookmarkModel when done | 454 // else case: we'll receive notification back from the BookmarkModel when done |
| 455 // loading, then we'll populate the bar. | 455 // loading, then we'll populate the bar. |
| 456 } | 456 } |
| 457 | 457 |
| 458 void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { | 458 void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { |
| 459 page_navigator_ = navigator; | 459 page_navigator_ = navigator; |
| 460 } | 460 } |
| 461 | 461 |
| 462 gfx::Size BookmarkBarView::GetPreferredSize() { | 462 gfx::Size BookmarkBarView::GetPreferredSize() { |
| 463 // Extension apps don't show the bookmark bar. | 463 return LayoutItems(true); |
| 464 if (!OnAppsPage()) | |
| 465 return LayoutItems(true); | |
| 466 else | |
| 467 return gfx::Size(); | |
| 468 } | 464 } |
| 469 | 465 |
| 470 gfx::Size BookmarkBarView::GetMinimumSize() { | 466 gfx::Size BookmarkBarView::GetMinimumSize() { |
| 471 // The minimum width of the bookmark bar should at least contain the overflow | 467 // The minimum width of the bookmark bar should at least contain the overflow |
| 472 // button, by which one can access all the Bookmark Bar items, and the "Other | 468 // button, by which one can access all the Bookmark Bar items, and the "Other |
| 473 // Bookmarks" folder, along with appropriate margins and button padding. | 469 // Bookmarks" folder, along with appropriate margins and button padding. |
| 474 int width = kLeftMargin; | 470 int width = kLeftMargin; |
| 475 | 471 |
| 476 if (OnNewTabPage()) { | 472 if (OnNewTabPage()) { |
| 477 double current_state = 1 - size_animation_->GetCurrentValue(); | 473 double current_state = 1 - size_animation_->GetCurrentValue(); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 | 745 |
| 750 bool BookmarkBarView::IsAlwaysShown() const { | 746 bool BookmarkBarView::IsAlwaysShown() const { |
| 751 return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); | 747 return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); |
| 752 } | 748 } |
| 753 | 749 |
| 754 bool BookmarkBarView::OnNewTabPage() const { | 750 bool BookmarkBarView::OnNewTabPage() const { |
| 755 return (browser_ && browser_->GetSelectedTabContents() && | 751 return (browser_ && browser_->GetSelectedTabContents() && |
| 756 browser_->GetSelectedTabContents()->ShouldShowBookmarkBar()); | 752 browser_->GetSelectedTabContents()->ShouldShowBookmarkBar()); |
| 757 } | 753 } |
| 758 | 754 |
| 759 bool BookmarkBarView::OnAppsPage() const { | |
| 760 return (browser_ && browser_->GetSelectedTabContents() && | |
| 761 browser_->GetSelectedTabContents()->is_app()); | |
| 762 } | |
| 763 | |
| 764 int BookmarkBarView::GetToolbarOverlap(bool return_max) { | 755 int BookmarkBarView::GetToolbarOverlap(bool return_max) { |
| 765 return static_cast<int>(kToolbarOverlap * | 756 return static_cast<int>(kToolbarOverlap * |
| 766 (return_max ? 1.0 : size_animation_->GetCurrentValue())); | 757 (return_max ? 1.0 : size_animation_->GetCurrentValue())); |
| 767 } | 758 } |
| 768 | 759 |
| 769 void BookmarkBarView::AnimationProgressed(const Animation* animation) { | 760 void BookmarkBarView::AnimationProgressed(const Animation* animation) { |
| 770 if (browser_) | 761 if (browser_) |
| 771 browser_->ToolbarSizeChanged(true); | 762 browser_->ToolbarSizeChanged(true); |
| 772 } | 763 } |
| 773 | 764 |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 // The tooltip is the only way we have to display text explaining the error | 1709 // The tooltip is the only way we have to display text explaining the error |
| 1719 // to the user. | 1710 // to the user. |
| 1720 sync_error_button->SetTooltipText( | 1711 sync_error_button->SetTooltipText( |
| 1721 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); | 1712 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); |
| 1722 sync_error_button->SetAccessibleName( | 1713 sync_error_button->SetAccessibleName( |
| 1723 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); | 1714 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
| 1724 sync_error_button->SetIcon( | 1715 sync_error_button->SetIcon( |
| 1725 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); | 1716 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
| 1726 return sync_error_button; | 1717 return sync_error_button; |
| 1727 } | 1718 } |
| OLD | NEW |