| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "ui/gfx/image/image.h" | 56 #include "ui/gfx/image/image.h" |
| 57 #include "ui/gfx/paint_vector_icon.h" | 57 #include "ui/gfx/paint_vector_icon.h" |
| 58 #include "ui/gfx/text_elider.h" | 58 #include "ui/gfx/text_elider.h" |
| 59 #include "ui/gfx/text_utils.h" | 59 #include "ui/gfx/text_utils.h" |
| 60 #include "ui/gfx/vector_icons_public.h" | 60 #include "ui/gfx/vector_icons_public.h" |
| 61 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 61 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 62 #include "ui/views/animation/ink_drop_delegate.h" | 62 #include "ui/views/animation/ink_drop_delegate.h" |
| 63 #include "ui/views/animation/ink_drop_hover.h" | 63 #include "ui/views/animation/ink_drop_hover.h" |
| 64 #include "ui/views/border.h" | 64 #include "ui/views/border.h" |
| 65 #include "ui/views/controls/button/image_button.h" | 65 #include "ui/views/controls/button/image_button.h" |
| 66 #include "ui/views/controls/button/label_button.h" | |
| 67 #include "ui/views/controls/button/md_text_button.h" | 66 #include "ui/views/controls/button/md_text_button.h" |
| 68 #include "ui/views/controls/label.h" | 67 #include "ui/views/controls/label.h" |
| 69 #include "ui/views/mouse_constants.h" | 68 #include "ui/views/mouse_constants.h" |
| 70 #include "ui/views/widget/root_view.h" | 69 #include "ui/views/widget/root_view.h" |
| 71 #include "ui/views/widget/widget.h" | 70 #include "ui/views/widget/widget.h" |
| 72 | 71 |
| 73 using content::DownloadItem; | 72 using content::DownloadItem; |
| 74 using extensions::ExperienceSamplingEvent; | 73 using extensions::ExperienceSamplingEvent; |
| 75 | 74 |
| 76 namespace { | 75 namespace { |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 ? ExperienceSamplingEvent::kMaliciousDownload | 942 ? ExperienceSamplingEvent::kMaliciousDownload |
| 944 : ExperienceSamplingEvent::kDangerousDownload; | 943 : ExperienceSamplingEvent::kDangerousDownload; |
| 945 sampling_event_.reset(new ExperienceSamplingEvent( | 944 sampling_event_.reset(new ExperienceSamplingEvent( |
| 946 event_name, download()->GetURL(), download()->GetReferrerUrl(), | 945 event_name, download()->GetURL(), download()->GetReferrerUrl(), |
| 947 download()->GetBrowserContext())); | 946 download()->GetBrowserContext())); |
| 948 | 947 |
| 949 dropdown_state_ = NORMAL; | 948 dropdown_state_ = NORMAL; |
| 950 if (mode_ == DANGEROUS_MODE) { | 949 if (mode_ == DANGEROUS_MODE) { |
| 951 save_button_ = views::MdTextButton::CreateMdButton( | 950 save_button_ = views::MdTextButton::CreateMdButton( |
| 952 this, model_.GetWarningConfirmButtonText()); | 951 this, model_.GetWarningConfirmButtonText()); |
| 953 save_button_->SetStyle(views::Button::STYLE_BUTTON); | |
| 954 AddChildView(save_button_); | 952 AddChildView(save_button_); |
| 955 } | 953 } |
| 956 int discard_button_message = | 954 int discard_button_message = |
| 957 model_.IsMalicious() ? IDS_DISMISS_DOWNLOAD : IDS_DISCARD_DOWNLOAD; | 955 model_.IsMalicious() ? IDS_DISMISS_DOWNLOAD : IDS_DISCARD_DOWNLOAD; |
| 958 discard_button_ = views::MdTextButton::CreateMdButton( | 956 discard_button_ = views::MdTextButton::CreateMdButton( |
| 959 this, l10n_util::GetStringUTF16(discard_button_message)); | 957 this, l10n_util::GetStringUTF16(discard_button_message)); |
| 960 discard_button_->SetStyle(views::Button::STYLE_BUTTON); | |
| 961 AddChildView(discard_button_); | 958 AddChildView(discard_button_); |
| 962 | 959 |
| 963 base::string16 dangerous_label = | 960 base::string16 dangerous_label = |
| 964 model_.GetWarningText(font_list_, kTextWidth); | 961 model_.GetWarningText(font_list_, kTextWidth); |
| 965 dangerous_download_label_ = new views::Label(dangerous_label); | 962 dangerous_download_label_ = new views::Label(dangerous_label); |
| 966 dangerous_download_label_->SetMultiLine(true); | 963 dangerous_download_label_->SetMultiLine(true); |
| 967 dangerous_download_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 964 dangerous_download_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 968 dangerous_download_label_->SetAutoColorReadabilityEnabled(false); | 965 dangerous_download_label_->SetAutoColorReadabilityEnabled(false); |
| 969 AddChildView(dangerous_download_label_); | 966 AddChildView(dangerous_download_label_); |
| 970 SizeLabelToMinWidth(); | 967 SizeLabelToMinWidth(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 SchedulePaint(); | 1114 SchedulePaint(); |
| 1118 } | 1115 } |
| 1119 | 1116 |
| 1120 SkColor DownloadItemViewMd::GetTextColor() const { | 1117 SkColor DownloadItemViewMd::GetTextColor() const { |
| 1121 return GetTextColorForThemeProvider(GetThemeProvider()); | 1118 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1122 } | 1119 } |
| 1123 | 1120 |
| 1124 SkColor DownloadItemViewMd::GetDimmedTextColor() const { | 1121 SkColor DownloadItemViewMd::GetDimmedTextColor() const { |
| 1125 return SkColorSetA(GetTextColor(), 0xC7); | 1122 return SkColorSetA(GetTextColor(), 0xC7); |
| 1126 } | 1123 } |
| OLD | NEW |