| 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_item_view_md.h" | 5 #include "chrome/browser/ui/views/download/download_item_view_md.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "ui/gfx/color_palette.h" | 53 #include "ui/gfx/color_palette.h" |
| 54 #include "ui/gfx/color_utils.h" | 54 #include "ui/gfx/color_utils.h" |
| 55 #include "ui/gfx/image/image.h" | 55 #include "ui/gfx/image/image.h" |
| 56 #include "ui/gfx/paint_vector_icon.h" | 56 #include "ui/gfx/paint_vector_icon.h" |
| 57 #include "ui/gfx/text_elider.h" | 57 #include "ui/gfx/text_elider.h" |
| 58 #include "ui/gfx/text_utils.h" | 58 #include "ui/gfx/text_utils.h" |
| 59 #include "ui/gfx/vector_icons_public.h" | 59 #include "ui/gfx/vector_icons_public.h" |
| 60 #include "ui/views/border.h" | 60 #include "ui/views/border.h" |
| 61 #include "ui/views/controls/button/image_button.h" | 61 #include "ui/views/controls/button/image_button.h" |
| 62 #include "ui/views/controls/button/label_button.h" | 62 #include "ui/views/controls/button/label_button.h" |
| 63 #include "ui/views/controls/button/md_text_button.h" |
| 63 #include "ui/views/controls/label.h" | 64 #include "ui/views/controls/label.h" |
| 64 #include "ui/views/mouse_constants.h" | 65 #include "ui/views/mouse_constants.h" |
| 65 #include "ui/views/widget/root_view.h" | 66 #include "ui/views/widget/root_view.h" |
| 66 #include "ui/views/widget/widget.h" | 67 #include "ui/views/widget/widget.h" |
| 67 | 68 |
| 68 using content::DownloadItem; | 69 using content::DownloadItem; |
| 69 using extensions::ExperienceSamplingEvent; | 70 using extensions::ExperienceSamplingEvent; |
| 70 | 71 |
| 71 namespace { | 72 namespace { |
| 72 | 73 |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 // to the user, so we start a new SamplingEvent and track it. | 885 // to the user, so we start a new SamplingEvent and track it. |
| 885 std::string event_name = model_.MightBeMalicious() | 886 std::string event_name = model_.MightBeMalicious() |
| 886 ? ExperienceSamplingEvent::kMaliciousDownload | 887 ? ExperienceSamplingEvent::kMaliciousDownload |
| 887 : ExperienceSamplingEvent::kDangerousDownload; | 888 : ExperienceSamplingEvent::kDangerousDownload; |
| 888 sampling_event_.reset(new ExperienceSamplingEvent( | 889 sampling_event_.reset(new ExperienceSamplingEvent( |
| 889 event_name, download()->GetURL(), download()->GetReferrerUrl(), | 890 event_name, download()->GetURL(), download()->GetReferrerUrl(), |
| 890 download()->GetBrowserContext())); | 891 download()->GetBrowserContext())); |
| 891 | 892 |
| 892 dropdown_state_ = NORMAL; | 893 dropdown_state_ = NORMAL; |
| 893 if (mode_ == DANGEROUS_MODE) { | 894 if (mode_ == DANGEROUS_MODE) { |
| 894 save_button_ = | 895 save_button_ = views::MdTextButton::CreateStandardButton( |
| 895 new views::LabelButton(this, model_.GetWarningConfirmButtonText()); | 896 this, model_.GetWarningConfirmButtonText()); |
| 896 save_button_->SetStyle(views::Button::STYLE_BUTTON); | 897 save_button_->SetStyle(views::Button::STYLE_BUTTON); |
| 897 AddChildView(save_button_); | 898 AddChildView(save_button_); |
| 898 } | 899 } |
| 899 int discard_button_message = | 900 int discard_button_message = |
| 900 model_.IsMalicious() ? IDS_DISMISS_DOWNLOAD : IDS_DISCARD_DOWNLOAD; | 901 model_.IsMalicious() ? IDS_DISMISS_DOWNLOAD : IDS_DISCARD_DOWNLOAD; |
| 901 discard_button_ = new views::LabelButton( | 902 discard_button_ = views::MdTextButton::CreateStandardButton( |
| 902 this, l10n_util::GetStringUTF16(discard_button_message)); | 903 this, l10n_util::GetStringUTF16(discard_button_message)); |
| 903 discard_button_->SetStyle(views::Button::STYLE_BUTTON); | 904 discard_button_->SetStyle(views::Button::STYLE_BUTTON); |
| 904 AddChildView(discard_button_); | 905 AddChildView(discard_button_); |
| 905 | 906 |
| 906 base::string16 dangerous_label = | 907 base::string16 dangerous_label = |
| 907 model_.GetWarningText(font_list_, kTextWidth); | 908 model_.GetWarningText(font_list_, kTextWidth); |
| 908 dangerous_download_label_ = new views::Label(dangerous_label); | 909 dangerous_download_label_ = new views::Label(dangerous_label); |
| 909 dangerous_download_label_->SetMultiLine(true); | 910 dangerous_download_label_->SetMultiLine(true); |
| 910 dangerous_download_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 911 dangerous_download_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 911 dangerous_download_label_->SetAutoColorReadabilityEnabled(false); | 912 dangerous_download_label_->SetAutoColorReadabilityEnabled(false); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 SchedulePaint(); | 1061 SchedulePaint(); |
| 1061 } | 1062 } |
| 1062 | 1063 |
| 1063 SkColor DownloadItemViewMd::GetTextColor() { | 1064 SkColor DownloadItemViewMd::GetTextColor() { |
| 1064 return GetTextColorForThemeProvider(GetThemeProvider()); | 1065 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1065 } | 1066 } |
| 1066 | 1067 |
| 1067 SkColor DownloadItemViewMd::GetDimmedTextColor() { | 1068 SkColor DownloadItemViewMd::GetDimmedTextColor() { |
| 1068 return SkColorSetA(GetTextColor(), 0xC7); | 1069 return SkColorSetA(GetTextColor(), 0xC7); |
| 1069 } | 1070 } |
| OLD | NEW |