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 #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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 model_->GetBookmarkBarNode()->GetChild(bookmark_button_index); | 1140 model_->GetBookmarkBarNode()->GetChild(bookmark_button_index); |
1141 nodes.push_back(node); | 1141 nodes.push_back(node); |
1142 parent = node->parent(); | 1142 parent = node->parent(); |
1143 } else { | 1143 } else { |
1144 parent = model_->GetBookmarkBarNode(); | 1144 parent = model_->GetBookmarkBarNode(); |
1145 nodes.push_back(parent); | 1145 nodes.push_back(parent); |
1146 } | 1146 } |
1147 // Browser may be null during testing. | 1147 // Browser may be null during testing. |
1148 PageNavigator* navigator = | 1148 PageNavigator* navigator = |
1149 browser() ? browser()->GetSelectedTabContents() : NULL; | 1149 browser() ? browser()->GetSelectedTabContents() : NULL; |
| 1150 bool close_on_remove = |
| 1151 (parent == profile_->GetBookmarkModel()->other_node() && |
| 1152 parent->child_count() == 1); |
1150 BookmarkContextMenu controller(GetWindow()->GetNativeWindow(), GetProfile(), | 1153 BookmarkContextMenu controller(GetWindow()->GetNativeWindow(), GetProfile(), |
1151 navigator, parent, nodes); | 1154 navigator, parent, nodes, close_on_remove); |
1152 controller.RunMenuAt(p); | 1155 controller.RunMenuAt(p); |
1153 } | 1156 } |
1154 | 1157 |
1155 void BookmarkBarView::Observe(NotificationType type, | 1158 void BookmarkBarView::Observe(NotificationType type, |
1156 const NotificationSource& source, | 1159 const NotificationSource& source, |
1157 const NotificationDetails& details) { | 1160 const NotificationDetails& details) { |
1158 DCHECK(profile_); | 1161 DCHECK(profile_); |
1159 switch (type.value) { | 1162 switch (type.value) { |
1160 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: | 1163 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: |
1161 if (IsAlwaysShown()) { | 1164 if (IsAlwaysShown()) { |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 prefsize.set_height(kBarHeight + | 1759 prefsize.set_height(kBarHeight + |
1757 static_cast<int>((kNewtabBarHeight - kBarHeight) * | 1760 static_cast<int>((kNewtabBarHeight - kBarHeight) * |
1758 (1 - size_animation_->GetCurrentValue()))); | 1761 (1 - size_animation_->GetCurrentValue()))); |
1759 } else { | 1762 } else { |
1760 prefsize.set_height( | 1763 prefsize.set_height( |
1761 static_cast<int>(kBarHeight * size_animation_->GetCurrentValue())); | 1764 static_cast<int>(kBarHeight * size_animation_->GetCurrentValue())); |
1762 } | 1765 } |
1763 } | 1766 } |
1764 return prefsize; | 1767 return prefsize; |
1765 } | 1768 } |
OLD | NEW |