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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 } | 1253 } |
1254 | 1254 |
1255 void BookmarkBarView::WriteDragDataForView(View* sender, | 1255 void BookmarkBarView::WriteDragDataForView(View* sender, |
1256 const gfx::Point& press_pt, | 1256 const gfx::Point& press_pt, |
1257 ui::OSExchangeData* data) { | 1257 ui::OSExchangeData* data) { |
1258 content::RecordAction(UserMetricsAction("BookmarkBar_DragButton")); | 1258 content::RecordAction(UserMetricsAction("BookmarkBar_DragButton")); |
1259 | 1259 |
1260 for (int i = 0; i < GetBookmarkButtonCount(); ++i) { | 1260 for (int i = 0; i < GetBookmarkButtonCount(); ++i) { |
1261 if (sender == GetBookmarkButton(i)) { | 1261 if (sender == GetBookmarkButton(i)) { |
1262 const BookmarkNode* node = model_->bookmark_bar_node()->GetChild(i); | 1262 const BookmarkNode* node = model_->bookmark_bar_node()->GetChild(i); |
1263 const gfx::Image& image_from_model = model_->GetFavicon(node); | |
1264 const gfx::ImageSkia* icon = nullptr; | 1263 const gfx::ImageSkia* icon = nullptr; |
1265 if (image_from_model.IsEmpty()) { | 1264 if (node->is_url()) { |
1266 icon = GetImageSkiaNamed(node->is_folder() ? IDR_BOOKMARK_BAR_FOLDER | 1265 const gfx::Image& image = model_->GetFavicon(node); |
1267 : IDR_DEFAULT_FAVICON); | 1266 icon = image.IsEmpty() ? GetImageSkiaNamed(IDR_DEFAULT_FAVICON) |
| 1267 : image.ToImageSkia(); |
1268 } else { | 1268 } else { |
1269 icon = image_from_model.ToImageSkia(); | 1269 icon = GetImageSkiaNamed(IDR_BOOKMARK_BAR_FOLDER); |
1270 } | 1270 } |
1271 | 1271 |
1272 button_drag_utils::SetDragImage(node->url(), | 1272 button_drag_utils::SetDragImage(node->url(), |
1273 node->GetTitle(), | 1273 node->GetTitle(), |
1274 *icon, | 1274 *icon, |
1275 &press_pt, | 1275 &press_pt, |
1276 data, | 1276 data, |
1277 GetBookmarkButton(i)->GetWidget()); | 1277 GetBookmarkButton(i)->GetWidget()); |
1278 WriteBookmarkDragData(node, data); | 1278 WriteBookmarkDragData(node, data); |
1279 return; | 1279 return; |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1954 return; | 1954 return; |
1955 apps_page_shortcut_->SetVisible(visible); | 1955 apps_page_shortcut_->SetVisible(visible); |
1956 UpdateBookmarksSeparatorVisibility(); | 1956 UpdateBookmarksSeparatorVisibility(); |
1957 LayoutAndPaint(); | 1957 LayoutAndPaint(); |
1958 } | 1958 } |
1959 | 1959 |
1960 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 1960 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
1961 if (UpdateOtherAndManagedButtonsVisibility()) | 1961 if (UpdateOtherAndManagedButtonsVisibility()) |
1962 LayoutAndPaint(); | 1962 LayoutAndPaint(); |
1963 } | 1963 } |
OLD | NEW |