| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/base_drag_source.h" | 9 #include "base/base_drag_source.h" |
| 10 #include "base/gfx/skia_utils.h" | 10 #include "base/gfx/skia_utils.h" |
| (...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 | 1111 |
| 1112 instructions_ = new ChromeViews::Label( | 1112 instructions_ = new ChromeViews::Label( |
| 1113 l10n_util::GetString(IDS_BOOKMARKS_NO_ITEMS), | 1113 l10n_util::GetString(IDS_BOOKMARKS_NO_ITEMS), |
| 1114 rb.GetFont(ResourceBundle::BaseFont)); | 1114 rb.GetFont(ResourceBundle::BaseFont)); |
| 1115 instructions_->SetColor(kInstructionsColor); | 1115 instructions_->SetColor(kInstructionsColor); |
| 1116 AddChildView(instructions_); | 1116 AddChildView(instructions_); |
| 1117 | 1117 |
| 1118 SetContextMenuController(this); | 1118 SetContextMenuController(this); |
| 1119 | 1119 |
| 1120 size_animation_.reset(new SlideAnimation(this)); | 1120 size_animation_.reset(new SlideAnimation(this)); |
| 1121 size_animation_->SetSlideDuration(4000); | |
| 1122 } | 1121 } |
| 1123 | 1122 |
| 1124 MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() { | 1123 MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() { |
| 1125 MenuButton* button = new MenuButton( | 1124 MenuButton* button = new MenuButton( |
| 1126 l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_BOOKMARKED), this, false); | 1125 l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_BOOKMARKED), this, false); |
| 1127 button->SetIcon(GetGroupIcon()); | 1126 button->SetIcon(GetGroupIcon()); |
| 1128 button->SetContextMenuController(this); | 1127 button->SetContextMenuController(this); |
| 1129 return button; | 1128 return button; |
| 1130 } | 1129 } |
| 1131 | 1130 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1159 BookmarkBarNode* node = model_->GetBookmarkBarNode(); | 1158 BookmarkBarNode* node = model_->GetBookmarkBarNode(); |
| 1160 DCHECK(node && model_->other_node()); | 1159 DCHECK(node && model_->other_node()); |
| 1161 // Create a button for each of the children on the bookmark bar. | 1160 // Create a button for each of the children on the bookmark bar. |
| 1162 for (int i = 0; i < node->GetChildCount(); ++i) | 1161 for (int i = 0; i < node->GetChildCount(); ++i) |
| 1163 AddChildView(i, CreateBookmarkButton(node->GetChild(i))); | 1162 AddChildView(i, CreateBookmarkButton(node->GetChild(i))); |
| 1164 other_bookmarked_button_->SetEnabled(true); | 1163 other_bookmarked_button_->SetEnabled(true); |
| 1165 Layout(); | 1164 Layout(); |
| 1166 SchedulePaint(); | 1165 SchedulePaint(); |
| 1167 } | 1166 } |
| 1168 | 1167 |
| 1168 void BookmarkBarView::BookmarkModelBeingDeleted(BookmarkBarModel* model) { |
| 1169 // The bookmark model should never be deleted before us. This code exists |
| 1170 // to check for regressions in shutdown code and not crash. |
| 1171 NOTREACHED(); |
| 1172 |
| 1173 // Do minimal cleanup, presumably we'll be deleted shortly. |
| 1174 NotifyModelChanged(); |
| 1175 model_->RemoveObserver(this); |
| 1176 model_ = NULL; |
| 1177 } |
| 1178 |
| 1169 void BookmarkBarView::BookmarkNodeMoved(BookmarkBarModel* model, | 1179 void BookmarkBarView::BookmarkNodeMoved(BookmarkBarModel* model, |
| 1170 BookmarkBarNode* old_parent, | 1180 BookmarkBarNode* old_parent, |
| 1171 int old_index, | 1181 int old_index, |
| 1172 BookmarkBarNode* new_parent, | 1182 BookmarkBarNode* new_parent, |
| 1173 int new_index) { | 1183 int new_index) { |
| 1174 StopThrobbing(true); | 1184 StopThrobbing(true); |
| 1175 BookmarkNodeRemovedImpl(model, old_parent, old_index); | 1185 BookmarkNodeRemovedImpl(model, old_parent, old_index); |
| 1176 BookmarkNodeAddedImpl(model, new_parent, new_index); | 1186 BookmarkNodeAddedImpl(model, new_parent, new_index); |
| 1177 StartThrobbing(); | 1187 StartThrobbing(); |
| 1178 } | 1188 } |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 | 1834 |
| 1825 void BookmarkBarView::StopThrobbing(bool immediate) { | 1835 void BookmarkBarView::StopThrobbing(bool immediate) { |
| 1826 if (!throbbing_view_) | 1836 if (!throbbing_view_) |
| 1827 return; | 1837 return; |
| 1828 | 1838 |
| 1829 // If not immediate, cycle through 2 more complete cycles. | 1839 // If not immediate, cycle through 2 more complete cycles. |
| 1830 throbbing_view_->StartThrobbing(immediate ? 0 : 4); | 1840 throbbing_view_->StartThrobbing(immediate ? 0 : 4); |
| 1831 throbbing_view_ = NULL; | 1841 throbbing_view_ = NULL; |
| 1832 } | 1842 } |
| 1833 | 1843 |
| OLD | NEW |