| 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 18 matching lines...) Expand all Loading... |
| 29 #include "ui/base/material_design/material_design_controller.h" | 29 #include "ui/base/material_design/material_design_controller.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 31 #include "ui/base/theme_provider.h" | 31 #include "ui/base/theme_provider.h" |
| 32 #include "ui/gfx/animation/slide_animation.h" | 32 #include "ui/gfx/animation/slide_animation.h" |
| 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/md_text_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 | 43 |
| 44 using content::DownloadItem; | 44 using content::DownloadItem; |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 // Max number of download views we'll contain. Any time a view is added and | 48 // 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. | 49 // we already have this many download views, one is removed. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 show_all_view_ = show_all_view; | 156 show_all_view_ = show_all_view; |
| 157 | 157 |
| 158 close_button_ = new views::ImageButton(this); | 158 close_button_ = new views::ImageButton(this); |
| 159 close_button_->SetImage(views::CustomButton::STATE_NORMAL, | 159 close_button_->SetImage(views::CustomButton::STATE_NORMAL, |
| 160 rb.GetImageSkiaNamed(IDR_CLOSE_1)); | 160 rb.GetImageSkiaNamed(IDR_CLOSE_1)); |
| 161 close_button_->SetImage(views::CustomButton::STATE_HOVERED, | 161 close_button_->SetImage(views::CustomButton::STATE_HOVERED, |
| 162 rb.GetImageSkiaNamed(IDR_CLOSE_1_H)); | 162 rb.GetImageSkiaNamed(IDR_CLOSE_1_H)); |
| 163 close_button_->SetImage(views::CustomButton::STATE_PRESSED, | 163 close_button_->SetImage(views::CustomButton::STATE_PRESSED, |
| 164 rb.GetImageSkiaNamed(IDR_CLOSE_1_P)); | 164 rb.GetImageSkiaNamed(IDR_CLOSE_1_P)); |
| 165 } else { | 165 } else { |
| 166 views::LabelButton* show_all_view = new views::LabelButton( | 166 views::LabelButton* show_all_view = |
| 167 this, l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS_MD)); | 167 views::MdTextButton::CreateStandardButton( |
| 168 show_all_view->SetFocusable(true); | 168 this, l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS_MD)); |
| 169 show_all_view->SetStyle(views::Button::STYLE_BUTTON); | |
| 170 show_all_view_ = show_all_view; | 169 show_all_view_ = show_all_view; |
| 171 | 170 |
| 172 BarControlButton* close_button = new BarControlButton(this); | 171 BarControlButton* close_button = new BarControlButton(this); |
| 173 close_button->SetIcon(gfx::VectorIconId::BAR_CLOSE, | 172 close_button->SetIcon(gfx::VectorIconId::BAR_CLOSE, |
| 174 base::Bind(&DownloadShelfView::GetTextColorForIconMd, | 173 base::Bind(&DownloadShelfView::GetTextColorForIconMd, |
| 175 base::Unretained(this))); | 174 base::Unretained(this))); |
| 176 close_button_ = close_button; | 175 close_button_ = close_button; |
| 177 } | 176 } |
| 178 close_button_->SetAccessibleName( | 177 close_button_->SetAccessibleName( |
| 179 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 178 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 489 |
| 491 content::DownloadItem* DownloadShelfView::GetDownloadItemForView(size_t i) { | 490 content::DownloadItem* DownloadShelfView::GetDownloadItemForView(size_t i) { |
| 492 if (ui::MaterialDesignController::IsModeMaterial()) | 491 if (ui::MaterialDesignController::IsModeMaterial()) |
| 493 return static_cast<DownloadItemViewMd*>(download_views_[i])->download(); | 492 return static_cast<DownloadItemViewMd*>(download_views_[i])->download(); |
| 494 return static_cast<DownloadItemView*>(download_views_[i])->download(); | 493 return static_cast<DownloadItemView*>(download_views_[i])->download(); |
| 495 } | 494 } |
| 496 | 495 |
| 497 SkColor DownloadShelfView::GetTextColorForIconMd() { | 496 SkColor DownloadShelfView::GetTextColorForIconMd() { |
| 498 return DownloadItemViewMd::GetTextColorForThemeProvider(GetThemeProvider()); | 497 return DownloadItemViewMd::GetTextColorForThemeProvider(GetThemeProvider()); |
| 499 } | 498 } |
| OLD | NEW |