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 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/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 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 gfx::Size overflow_pref = overflow_button_->GetPreferredSize(); | 1740 gfx::Size overflow_pref = overflow_button_->GetPreferredSize(); |
1741 gfx::Size bookmarks_separator_pref = | 1741 gfx::Size bookmarks_separator_pref = |
1742 bookmarks_separator_view_->GetPreferredSize(); | 1742 bookmarks_separator_view_->GetPreferredSize(); |
1743 gfx::Size apps_page_shortcut_pref = apps_page_shortcut_->visible() ? | 1743 gfx::Size apps_page_shortcut_pref = apps_page_shortcut_->visible() ? |
1744 apps_page_shortcut_->GetPreferredSize() : gfx::Size(); | 1744 apps_page_shortcut_->GetPreferredSize() : gfx::Size(); |
1745 | 1745 |
1746 int max_x = width - overflow_pref.width() - kButtonPadding - | 1746 int max_x = width - overflow_pref.width() - kButtonPadding - |
1747 bookmarks_separator_pref.width(); | 1747 bookmarks_separator_pref.width(); |
1748 if (other_bookmarked_button_->visible()) | 1748 if (other_bookmarked_button_->visible()) |
1749 max_x -= other_bookmarked_pref.width() + kButtonPadding; | 1749 max_x -= other_bookmarked_pref.width() + kButtonPadding; |
1750 if (apps_page_shortcut_->visible()) | |
1751 max_x -= apps_page_shortcut_pref.width() + kButtonPadding; | |
1752 | 1750 |
1753 // Next, layout out the buttons. Any buttons that are placed beyond the | 1751 // Next, layout out the buttons. Any buttons that are placed beyond the |
1754 // visible region and made invisible. | 1752 // visible region and made invisible. |
1755 | 1753 |
1756 // Start with the apps page shortcut button. | 1754 // Start with the apps page shortcut button. |
1757 if (apps_page_shortcut_->visible()) { | 1755 if (apps_page_shortcut_->visible()) { |
1758 if (!compute_bounds_only) { | 1756 if (!compute_bounds_only) { |
1759 apps_page_shortcut_->SetBounds(x, y, apps_page_shortcut_pref.width(), | 1757 apps_page_shortcut_->SetBounds(x, y, apps_page_shortcut_pref.width(), |
1760 height); | 1758 height); |
1761 } | 1759 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 DCHECK(apps_page_shortcut_); | 1856 DCHECK(apps_page_shortcut_); |
1859 // Only perform layout if required. | 1857 // Only perform layout if required. |
1860 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( | 1858 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( |
1861 browser_->profile()); | 1859 browser_->profile()); |
1862 if (apps_page_shortcut_->visible() == visible) | 1860 if (apps_page_shortcut_->visible() == visible) |
1863 return; | 1861 return; |
1864 apps_page_shortcut_->SetVisible(visible); | 1862 apps_page_shortcut_->SetVisible(visible); |
1865 UpdateBookmarksSeparatorVisibility(); | 1863 UpdateBookmarksSeparatorVisibility(); |
1866 Layout(); | 1864 Layout(); |
1867 } | 1865 } |
OLD | NEW |