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.h" | 5 #include "chrome/browser/ui/views/download/download_item_view.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 22 matching lines...) Expand all Loading... |
33 #include "chrome/browser/safe_browsing/download_protection_service.h" | 33 #include "chrome/browser/safe_browsing/download_protection_service.h" |
34 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 34 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
35 #include "chrome/browser/themes/theme_properties.h" | 35 #include "chrome/browser/themes/theme_properties.h" |
36 #include "chrome/browser/ui/views/download/download_feedback_dialog_view.h" | 36 #include "chrome/browser/ui/views/download/download_feedback_dialog_view.h" |
37 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" | 37 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" |
38 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 38 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
39 #include "chrome/browser/ui/views/frame/browser_view.h" | 39 #include "chrome/browser/ui/views/frame/browser_view.h" |
40 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
41 #include "chrome/grit/generated_resources.h" | 41 #include "chrome/grit/generated_resources.h" |
42 #include "components/prefs/pref_service.h" | 42 #include "components/prefs/pref_service.h" |
| 43 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
43 #include "content/public/browser/download_danger_type.h" | 44 #include "content/public/browser/download_danger_type.h" |
44 #include "third_party/icu/source/common/unicode/uchar.h" | 45 #include "third_party/icu/source/common/unicode/uchar.h" |
45 #include "ui/accessibility/ax_view_state.h" | 46 #include "ui/accessibility/ax_view_state.h" |
46 #include "ui/base/l10n/l10n_util.h" | 47 #include "ui/base/l10n/l10n_util.h" |
47 #include "ui/base/resource/resource_bundle.h" | 48 #include "ui/base/resource/resource_bundle.h" |
48 #include "ui/base/theme_provider.h" | 49 #include "ui/base/theme_provider.h" |
49 #include "ui/events/event.h" | 50 #include "ui/events/event.h" |
50 #include "ui/gfx/animation/slide_animation.h" | 51 #include "ui/gfx/animation/slide_animation.h" |
51 #include "ui/gfx/canvas.h" | 52 #include "ui/gfx/canvas.h" |
52 #include "ui/gfx/color_palette.h" | 53 #include "ui/gfx/color_palette.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 sampling_event_.reset(); | 565 sampling_event_.reset(); |
565 } | 566 } |
566 // This will change the state and notify us. | 567 // This will change the state and notify us. |
567 download()->ValidateDangerousDownload(); | 568 download()->ValidateDangerousDownload(); |
568 return; | 569 return; |
569 } | 570 } |
570 | 571 |
571 // WARNING: all end states after this point delete |this|. | 572 // WARNING: all end states after this point delete |this|. |
572 DCHECK_EQ(discard_button_, sender); | 573 DCHECK_EQ(discard_button_, sender); |
573 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", warning_duration); | 574 UMA_HISTOGRAM_LONG_TIMES("clickjacking.discard_download", warning_duration); |
| 575 Profile* profile = shelf_->browser()->profile(); |
574 if (!model_.IsMalicious() && model_.ShouldAllowDownloadFeedback() && | 576 if (!model_.IsMalicious() && model_.ShouldAllowDownloadFeedback() && |
575 !shelf_->browser()->profile()->IsOffTheRecord()) { | 577 !profile->IsOffTheRecord()) { |
576 if (!shelf_->browser()->profile()->GetPrefs()->HasPrefPath( | 578 if (!profile->GetPrefs()->HasPrefPath( |
577 prefs::kSafeBrowsingExtendedReportingEnabled)) { | 579 safe_browsing::GetExtendedReportingPrefName())) { |
578 // Show dialog, because the dialog hasn't been shown before. | 580 // Show dialog, because the dialog hasn't been shown before. |
579 DownloadFeedbackDialogView::Show( | 581 DownloadFeedbackDialogView::Show( |
580 shelf_->get_parent()->GetNativeWindow(), shelf_->browser()->profile(), | 582 shelf_->get_parent()->GetNativeWindow(), profile, |
581 shelf_->GetNavigator(), | 583 shelf_->GetNavigator(), |
582 base::Bind(&DownloadItemView::PossiblySubmitDownloadToFeedbackService, | 584 base::Bind(&DownloadItemView::PossiblySubmitDownloadToFeedbackService, |
583 weak_ptr_factory_.GetWeakPtr())); | 585 weak_ptr_factory_.GetWeakPtr())); |
584 } else { | 586 } else { |
585 PossiblySubmitDownloadToFeedbackService( | 587 PossiblySubmitDownloadToFeedbackService( |
586 shelf_->browser()->profile()->GetPrefs()->GetBoolean( | 588 safe_browsing::IsExtendedReportingEnabled(*profile->GetPrefs())); |
587 prefs::kSafeBrowsingExtendedReportingEnabled)); | |
588 } | 589 } |
589 return; | 590 return; |
590 } | 591 } |
591 download()->Remove(); | 592 download()->Remove(); |
592 } | 593 } |
593 | 594 |
594 SkColor DownloadItemView::GetVectorIconBaseColor() const { | 595 SkColor DownloadItemView::GetVectorIconBaseColor() const { |
595 return GetTextColor(); | 596 return GetTextColor(); |
596 } | 597 } |
597 | 598 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 SchedulePaint(); | 1109 SchedulePaint(); |
1109 } | 1110 } |
1110 | 1111 |
1111 SkColor DownloadItemView::GetTextColor() const { | 1112 SkColor DownloadItemView::GetTextColor() const { |
1112 return GetTextColorForThemeProvider(GetThemeProvider()); | 1113 return GetTextColorForThemeProvider(GetThemeProvider()); |
1113 } | 1114 } |
1114 | 1115 |
1115 SkColor DownloadItemView::GetDimmedTextColor() const { | 1116 SkColor DownloadItemView::GetDimmedTextColor() const { |
1116 return SkColorSetA(GetTextColor(), 0xC7); | 1117 return SkColorSetA(GetTextColor(), 0xC7); |
1117 } | 1118 } |
OLD | NEW |