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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 overflow_button_ = CreateOverflowButton(); | 1127 overflow_button_ = CreateOverflowButton(); |
1128 AddChildView(overflow_button_); | 1128 AddChildView(overflow_button_); |
1129 | 1129 |
1130 other_bookmarked_button_ = CreateOtherBookmarkedButton(); | 1130 other_bookmarked_button_ = CreateOtherBookmarkedButton(); |
1131 // We'll re-enable when the model is loaded. | 1131 // We'll re-enable when the model is loaded. |
1132 other_bookmarked_button_->SetEnabled(false); | 1132 other_bookmarked_button_->SetEnabled(false); |
1133 AddChildView(other_bookmarked_button_); | 1133 AddChildView(other_bookmarked_button_); |
1134 | 1134 |
1135 bookmarks_separator_view_ = new ButtonSeparatorView(); | 1135 bookmarks_separator_view_ = new ButtonSeparatorView(); |
1136 AddChildView(bookmarks_separator_view_); | 1136 AddChildView(bookmarks_separator_view_); |
| 1137 #if defined(USE_ASH) |
| 1138 // Ash does not paint the bookmarks separator line because it looks odd on |
| 1139 // the flat background. We keep it present for layout, but don't draw it. |
| 1140 bookmarks_separator_view_->SetVisible(false); |
| 1141 #endif |
1137 | 1142 |
1138 instructions_ = new BookmarkBarInstructionsView(this); | 1143 instructions_ = new BookmarkBarInstructionsView(this); |
1139 AddChildView(instructions_); | 1144 AddChildView(instructions_); |
1140 | 1145 |
1141 set_context_menu_controller(this); | 1146 set_context_menu_controller(this); |
1142 | 1147 |
1143 size_animation_.reset(new ui::SlideAnimation(this)); | 1148 size_animation_.reset(new ui::SlideAnimation(this)); |
1144 | 1149 |
1145 Profile* profile = browser_->profile(); | 1150 Profile* profile = browser_->profile(); |
1146 content::Source<Profile> ns_source(profile->GetOriginalProfile()); | 1151 content::Source<Profile> ns_source(profile->GetOriginalProfile()); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 for (int i = 0; i < GetBookmarkButtonCount(); ++i) | 1535 for (int i = 0; i < GetBookmarkButtonCount(); ++i) |
1531 GetBookmarkButton(i)->SetEnabledColor(text_color); | 1536 GetBookmarkButton(i)->SetEnabledColor(text_color); |
1532 other_bookmarked_button()->SetEnabledColor(text_color); | 1537 other_bookmarked_button()->SetEnabledColor(text_color); |
1533 } | 1538 } |
1534 | 1539 |
1535 void BookmarkBarView::UpdateOtherBookmarksVisibility() { | 1540 void BookmarkBarView::UpdateOtherBookmarksVisibility() { |
1536 bool has_other_children = !model_->other_node()->empty(); | 1541 bool has_other_children = !model_->other_node()->empty(); |
1537 if (has_other_children == other_bookmarked_button_->visible()) | 1542 if (has_other_children == other_bookmarked_button_->visible()) |
1538 return; | 1543 return; |
1539 other_bookmarked_button_->SetVisible(has_other_children); | 1544 other_bookmarked_button_->SetVisible(has_other_children); |
| 1545 #if !defined(USE_ASH) |
1540 bookmarks_separator_view_->SetVisible(has_other_children); | 1546 bookmarks_separator_view_->SetVisible(has_other_children); |
| 1547 #endif |
1541 Layout(); | 1548 Layout(); |
1542 SchedulePaint(); | 1549 SchedulePaint(); |
1543 } | 1550 } |
1544 | 1551 |
1545 gfx::Size BookmarkBarView::LayoutItems(bool compute_bounds_only) { | 1552 gfx::Size BookmarkBarView::LayoutItems(bool compute_bounds_only) { |
1546 gfx::Size prefsize; | 1553 gfx::Size prefsize; |
1547 if (!parent() && !compute_bounds_only) | 1554 if (!parent() && !compute_bounds_only) |
1548 return prefsize; | 1555 return prefsize; |
1549 | 1556 |
1550 int x = kLeftMargin; | 1557 int x = kLeftMargin; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 (1 - size_animation_->GetCurrentValue()))); | 1670 (1 - size_animation_->GetCurrentValue()))); |
1664 } else { | 1671 } else { |
1665 prefsize.set_height( | 1672 prefsize.set_height( |
1666 static_cast<int>( | 1673 static_cast<int>( |
1667 browser_defaults::kBookmarkBarHeight * | 1674 browser_defaults::kBookmarkBarHeight * |
1668 size_animation_->GetCurrentValue())); | 1675 size_animation_->GetCurrentValue())); |
1669 } | 1676 } |
1670 } | 1677 } |
1671 return prefsize; | 1678 return prefsize; |
1672 } | 1679 } |
OLD | NEW |