Index: chrome/browser/ui/views/download/download_shelf_view.cc |
diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc |
index a8310bb11ec8e059ee0bdf6f1b91b0e6846ef761..aa24d10423398ee6dc9555d8d6b2af2798cbc8a0 100644 |
--- a/chrome/browser/ui/views/download/download_shelf_view.cc |
+++ b/chrome/browser/ui/views/download/download_shelf_view.cc |
@@ -114,7 +114,11 @@ void DownloadShelfView::AddDownloadView(DownloadItemView* view) { |
DCHECK(view); |
download_views_.push_back(view); |
- AddChildView(view); |
+ |
+ // Insert the new view as the first child, so the logical child order matches |
+ // the visual order. This ensures that tabbing through downloads happens in |
+ // the order users would expect. |
+ AddChildViewAt(view, 0); |
if (download_views_.size() > kMaxDownloadViews) |
RemoveDownloadView(*download_views_.begin()); |
@@ -149,7 +153,7 @@ void DownloadShelfView::RemoveDownloadView(View* view) { |
views::View* DownloadShelfView::GetDefaultFocusableChild() { |
return download_views_.empty() ? |
- static_cast<View*>(show_all_view_) : download_views_[0]; |
+ static_cast<View*>(show_all_view_) : download_views_.back(); |
} |
void DownloadShelfView::OnPaintBorder(gfx::Canvas* canvas) { |