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