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/download/download_shelf_view.h" | 5 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 #include "ui/gfx/canvas.h" | 33 #include "ui/gfx/canvas.h" |
34 #include "ui/gfx/vector_icons_public.h" | 34 #include "ui/gfx/vector_icons_public.h" |
35 #include "ui/resources/grit/ui_resources.h" | 35 #include "ui/resources/grit/ui_resources.h" |
36 #include "ui/views/background.h" | 36 #include "ui/views/background.h" |
37 #include "ui/views/border.h" | 37 #include "ui/views/border.h" |
38 #include "ui/views/controls/button/image_button.h" | 38 #include "ui/views/controls/button/image_button.h" |
39 #include "ui/views/controls/button/label_button.h" | 39 #include "ui/views/controls/button/label_button.h" |
40 #include "ui/views/controls/image_view.h" | 40 #include "ui/views/controls/image_view.h" |
41 #include "ui/views/controls/link.h" | 41 #include "ui/views/controls/link.h" |
42 #include "ui/views/mouse_watcher_view_host.h" | 42 #include "ui/views/mouse_watcher_view_host.h" |
43 #include "ui/views/style/platform_style.h" | |
43 | 44 |
44 using content::DownloadItem; | 45 using content::DownloadItem; |
45 | 46 |
46 namespace { | 47 namespace { |
47 | 48 |
48 // Max number of download views we'll contain. Any time a view is added and | 49 // Max number of download views we'll contain. Any time a view is added and |
49 // we already have this many download views, one is removed. | 50 // we already have this many download views, one is removed. |
50 const size_t kMaxDownloadViews = 15; | 51 const size_t kMaxDownloadViews = 15; |
51 | 52 |
52 // Padding from left edge and first download view. | 53 // Padding from left edge and first download view. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 close_button_ = new views::ImageButton(this); | 159 close_button_ = new views::ImageButton(this); |
159 close_button_->SetImage(views::CustomButton::STATE_NORMAL, | 160 close_button_->SetImage(views::CustomButton::STATE_NORMAL, |
160 rb.GetImageSkiaNamed(IDR_CLOSE_1)); | 161 rb.GetImageSkiaNamed(IDR_CLOSE_1)); |
161 close_button_->SetImage(views::CustomButton::STATE_HOVERED, | 162 close_button_->SetImage(views::CustomButton::STATE_HOVERED, |
162 rb.GetImageSkiaNamed(IDR_CLOSE_1_H)); | 163 rb.GetImageSkiaNamed(IDR_CLOSE_1_H)); |
163 close_button_->SetImage(views::CustomButton::STATE_PRESSED, | 164 close_button_->SetImage(views::CustomButton::STATE_PRESSED, |
164 rb.GetImageSkiaNamed(IDR_CLOSE_1_P)); | 165 rb.GetImageSkiaNamed(IDR_CLOSE_1_P)); |
165 } else { | 166 } else { |
166 views::LabelButton* show_all_view = new views::LabelButton( | 167 views::LabelButton* show_all_view = new views::LabelButton( |
167 this, l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS_MD)); | 168 this, l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS_MD)); |
168 show_all_view->SetFocusable(true); | |
tapted
2016/02/23 03:01:19
SetControlStyleFocus instead?
karandeepb
2016/03/15 02:19:50
This call is redundant, since SetStyle(..) on the
| |
169 show_all_view->SetStyle(views::Button::STYLE_BUTTON); | 169 show_all_view->SetStyle(views::Button::STYLE_BUTTON); |
170 show_all_view_ = show_all_view; | 170 show_all_view_ = show_all_view; |
171 | 171 |
172 BarControlButton* close_button = new BarControlButton(this); | 172 BarControlButton* close_button = new BarControlButton(this); |
173 close_button->SetIcon(gfx::VectorIconId::BAR_CLOSE, | 173 close_button->SetIcon(gfx::VectorIconId::BAR_CLOSE, |
174 base::Bind(&DownloadShelfView::GetTextColorForIconMd, | 174 base::Bind(&DownloadShelfView::GetTextColorForIconMd, |
175 base::Unretained(this))); | 175 base::Unretained(this))); |
176 close_button_ = close_button; | 176 close_button_ = close_button; |
177 } | 177 } |
178 close_button_->SetAccessibleName( | 178 close_button_->SetAccessibleName( |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 | 490 |
491 content::DownloadItem* DownloadShelfView::GetDownloadItemForView(size_t i) { | 491 content::DownloadItem* DownloadShelfView::GetDownloadItemForView(size_t i) { |
492 if (ui::MaterialDesignController::IsModeMaterial()) | 492 if (ui::MaterialDesignController::IsModeMaterial()) |
493 return static_cast<DownloadItemViewMd*>(download_views_[i])->download(); | 493 return static_cast<DownloadItemViewMd*>(download_views_[i])->download(); |
494 return static_cast<DownloadItemView*>(download_views_[i])->download(); | 494 return static_cast<DownloadItemView*>(download_views_[i])->download(); |
495 } | 495 } |
496 | 496 |
497 SkColor DownloadShelfView::GetTextColorForIconMd() { | 497 SkColor DownloadShelfView::GetTextColorForIconMd() { |
498 return DownloadItemViewMd::GetTextColorForThemeProvider(GetThemeProvider()); | 498 return DownloadItemViewMd::GetTextColorForThemeProvider(GetThemeProvider()); |
499 } | 499 } |
OLD | NEW |