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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 ExperienceSamplingEvent::kProceed); | 565 ExperienceSamplingEvent::kProceed); |
| 566 sampling_event_.reset(NULL); | 566 sampling_event_.reset(NULL); |
| 567 } | 567 } |
| 568 // This will change the state and notify us. | 568 // This will change the state and notify us. |
| 569 download()->ValidateDangerousDownload(); | 569 download()->ValidateDangerousDownload(); |
| 570 return; | 570 return; |
| 571 } | 571 } |
| 572 | 572 |
| 573 // WARNING: all end states after this point delete |this|. | 573 // WARNING: all end states after this point delete |this|. |
| 574 DCHECK_EQ(discard_button_, sender); | 574 DCHECK_EQ(discard_button_, sender); |
| 575 if (model_.IsMalicious()) { | |
| 576 UMA_HISTOGRAM_LONG_TIMES("clickjacking.dismiss_download", warning_duration); | |
| 577 // ExperienceSampling: User chose to dismiss the dangerous download. | |
| 578 if (sampling_event_.get()) { | |
| 579 sampling_event_->CreateUserDecisionEvent(ExperienceSamplingEvent::kDeny); | |
| 580 sampling_event_.reset(NULL); | |
| 581 } | |
| 582 shelf_->RemoveDownloadView(this); | |
| 583 return; | |
| 584 } | |
| 585 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", warning_duration); | 575 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", warning_duration); |
| 586 if (model_.ShouldAllowDownloadFeedback() && | 576 if (!model_.IsMalicious() && model_.ShouldAllowDownloadFeedback() && |
| 587 !shelf_->browser()->profile()->IsOffTheRecord()) { | 577 !shelf_->browser()->profile()->IsOffTheRecord()) { |
| 588 if (!shelf_->browser()->profile()->GetPrefs()->HasPrefPath( | 578 if (!shelf_->browser()->profile()->GetPrefs()->HasPrefPath( |
| 589 prefs::kSafeBrowsingExtendedReportingEnabled)) { | 579 prefs::kSafeBrowsingExtendedReportingEnabled)) { |
| 590 // Show dialog, because the dialog hasn't been shown before. | 580 // Show dialog, because the dialog hasn't been shown before. |
| 591 DownloadFeedbackDialogView::Show( | 581 DownloadFeedbackDialogView::Show( |
| 592 shelf_->get_parent()->GetNativeWindow(), shelf_->browser()->profile(), | 582 shelf_->get_parent()->GetNativeWindow(), shelf_->browser()->profile(), |
| 593 shelf_->GetNavigator(), | 583 shelf_->GetNavigator(), |
| 594 base::Bind( | 584 base::Bind( |
| 595 &DownloadItemViewMd::PossiblySubmitDownloadToFeedbackService, | 585 &DownloadItemViewMd::PossiblySubmitDownloadToFeedbackService, |
| 596 weak_ptr_factory_.GetWeakPtr())); | 586 weak_ptr_factory_.GetWeakPtr())); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 968 sampling_event_.reset(new ExperienceSamplingEvent( | 958 sampling_event_.reset(new ExperienceSamplingEvent( |
| 969 event_name, download()->GetURL(), download()->GetReferrerUrl(), | 959 event_name, download()->GetURL(), download()->GetReferrerUrl(), |
| 970 download()->GetBrowserContext())); | 960 download()->GetBrowserContext())); |
| 971 | 961 |
| 972 dropdown_state_ = NORMAL; | 962 dropdown_state_ = NORMAL; |
| 973 if (mode_ == DANGEROUS_MODE) { | 963 if (mode_ == DANGEROUS_MODE) { |
| 974 save_button_ = views::MdTextButton::CreateMdButton( | 964 save_button_ = views::MdTextButton::CreateMdButton( |
| 975 this, model_.GetWarningConfirmButtonText()); | 965 this, model_.GetWarningConfirmButtonText()); |
| 976 AddChildView(save_button_); | 966 AddChildView(save_button_); |
| 977 } | 967 } |
| 978 int discard_button_message = | |
| 979 model_.IsMalicious() ? IDS_DISMISS_DOWNLOAD : IDS_DISCARD_DOWNLOAD; | |
|
msw
2016/07/20 20:24:32
Remove IDS_DISMISS_DOWNLOAD from chrome/app/genera
Jialiu Lin
2016/07/20 20:30:01
Done.
| |
| 980 discard_button_ = views::MdTextButton::CreateMdButton( | 968 discard_button_ = views::MdTextButton::CreateMdButton( |
| 981 this, l10n_util::GetStringUTF16(discard_button_message)); | 969 this, l10n_util::GetStringUTF16(IDS_DISCARD_DOWNLOAD)); |
| 982 AddChildView(discard_button_); | 970 AddChildView(discard_button_); |
| 983 | 971 |
| 984 base::string16 dangerous_label = | 972 base::string16 dangerous_label = |
| 985 model_.GetWarningText(font_list_, kTextWidth); | 973 model_.GetWarningText(font_list_, kTextWidth); |
| 986 dangerous_download_label_ = new views::Label(dangerous_label); | 974 dangerous_download_label_ = new views::Label(dangerous_label); |
| 987 dangerous_download_label_->SetMultiLine(true); | 975 dangerous_download_label_->SetMultiLine(true); |
| 988 dangerous_download_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 976 dangerous_download_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 989 dangerous_download_label_->SetAutoColorReadabilityEnabled(false); | 977 dangerous_download_label_->SetAutoColorReadabilityEnabled(false); |
| 990 AddChildView(dangerous_download_label_); | 978 AddChildView(dangerous_download_label_); |
| 991 SizeLabelToMinWidth(); | 979 SizeLabelToMinWidth(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1138 SchedulePaint(); | 1126 SchedulePaint(); |
| 1139 } | 1127 } |
| 1140 | 1128 |
| 1141 SkColor DownloadItemViewMd::GetTextColor() const { | 1129 SkColor DownloadItemViewMd::GetTextColor() const { |
| 1142 return GetTextColorForThemeProvider(GetThemeProvider()); | 1130 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1143 } | 1131 } |
| 1144 | 1132 |
| 1145 SkColor DownloadItemViewMd::GetDimmedTextColor() const { | 1133 SkColor DownloadItemViewMd::GetDimmedTextColor() const { |
| 1146 return SkColorSetA(GetTextColor(), 0xC7); | 1134 return SkColorSetA(GetTextColor(), 0xC7); |
| 1147 } | 1135 } |
| OLD | NEW |