1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
|
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -2214,7 +2214,6 @@ static_library("browser") {
"//components/reputation/core:proto",
"//components/resources",
"//components/safe_browsing/content/browser",
- "//components/safe_browsing/content/browser:client_side_detection",
"//components/safe_browsing/content/browser:safe_browsing_service",
"//components/safe_browsing/content/browser/password_protection",
"//components/safe_browsing/content/browser/web_ui",
@@ -3754,8 +3753,6 @@ static_library("browser") {
"download/download_commands.h",
"download/download_crx_util.cc",
"download/download_crx_util.h",
- "download/download_danger_prompt.cc",
- "download/download_danger_prompt.h",
"download/download_dir_policy_handler.cc",
"download/download_dir_policy_handler.h",
"download/download_dir_util.cc",
--- a/chrome/browser/browser_process.h
+++ b/chrome/browser/browser_process.h
@@ -54,10 +54,6 @@ class NetworkQualityTracker;
class SharedURLLoaderFactory;
}
-namespace safe_browsing {
-class SafeBrowsingService;
-}
-
namespace subresource_filter {
class RulesetService;
}
@@ -210,9 +206,6 @@ class BrowserProcess {
// on this platform (or this is a unit test).
virtual StatusTray* status_tray() = 0;
- // Returns the SafeBrowsing service.
- virtual safe_browsing::SafeBrowsingService* safe_browsing_service() = 0;
-
// Returns the service providing versioned storage for rules used by the Safe
// Browsing subresource filter.
virtual subresource_filter::RulesetService*
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -71,7 +71,6 @@
#include "chrome/browser/printing/print_preview_dialog_controller.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/resource_coordinator/resource_coordinator_parts.h"
-#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/site_isolation/prefs_observer.h"
#include "chrome/browser/ssl/secure_origin_prefs_observer.h"
@@ -394,8 +393,6 @@ void BrowserProcessImpl::StartTearDown()
metrics_services_manager_.reset();
intranet_redirect_detector_.reset();
- if (safe_browsing_service_.get())
- safe_browsing_service()->ShutDown();
network_time_tracker_.reset();
#if BUILDFLAG(ENABLE_PLUGINS)
plugins_resource_service_.reset();
@@ -1029,14 +1026,6 @@ StatusTray* BrowserProcessImpl::status_t
return status_tray_.get();
}
-safe_browsing::SafeBrowsingService*
-BrowserProcessImpl::safe_browsing_service() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (!created_safe_browsing_service_)
- CreateSafeBrowsingService();
- return safe_browsing_service_.get();
-}
-
subresource_filter::RulesetService*
BrowserProcessImpl::subresource_filter_ruleset_service() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -1283,26 +1272,6 @@ void BrowserProcessImpl::CreateBackgroun
#endif
}
-void BrowserProcessImpl::CreateSafeBrowsingService() {
- DCHECK(!safe_browsing_service_);
- // Set this flag to true so that we don't retry indefinitely to
- // create the service class if there was an error.
- created_safe_browsing_service_ = true;
-
- // The factory can be overridden in tests.
- if (!safe_browsing::SafeBrowsingServiceInterface::HasFactory()) {
- safe_browsing::SafeBrowsingServiceInterface::RegisterFactory(
- safe_browsing::GetSafeBrowsingServiceFactory());
- }
-
- // TODO(crbug/925153): Port consumers of the |safe_browsing_service_| to use
- // the interface in components/safe_browsing, and remove this cast.
- safe_browsing_service_ = static_cast<safe_browsing::SafeBrowsingService*>(
- safe_browsing::SafeBrowsingServiceInterface::CreateSafeBrowsingService());
- if (safe_browsing_service_)
- safe_browsing_service_->Initialize();
-}
-
void BrowserProcessImpl::CreateSubresourceFilterRulesetService() {
DCHECK(!subresource_filter_ruleset_service_);
created_subresource_filter_ruleset_service_ = true;
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -188,7 +188,6 @@ class BrowserProcessImpl : public Browse
std::unique_ptr<BackgroundModeManager> manager) override;
#endif
StatusTray* status_tray() override;
- safe_browsing::SafeBrowsingService* safe_browsing_service() override;
subresource_filter::RulesetService* subresource_filter_ruleset_service()
override;
@@ -335,9 +334,6 @@ class BrowserProcessImpl : public Browse
std::unique_ptr<BackgroundModeManager> background_mode_manager_;
#endif
- bool created_safe_browsing_service_ = false;
- scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service_;
-
bool created_subresource_filter_ruleset_service_ = false;
std::unique_ptr<subresource_filter::RulesetService>
subresource_filter_ruleset_service_;
--- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
+++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
@@ -66,7 +66,6 @@
#include "chrome/browser/profiles/keep_alive/profile_keep_alive_types.h"
#include "chrome/browser/profiles/keep_alive/scoped_profile_keep_alive.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/verdict_cache_manager_factory.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/share/share_history.h"
@@ -617,10 +616,6 @@ void ChromeBrowsingDataRemoverDelegate::
base::RecordAction(UserMetricsAction("ClearBrowsingData_Cookies"));
network::mojom::NetworkContext* safe_browsing_context = nullptr;
- safe_browsing::SafeBrowsingService* sb_service =
- g_browser_process->safe_browsing_service();
- if (sb_service)
- safe_browsing_context = sb_service->GetNetworkContext(profile_);
browsing_data::RemoveFederatedSiteSettingsData(delete_begin_, delete_end_,
host_content_settings_map_);
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -959,34 +959,6 @@ void SetApplicationLocaleOnIOThread(cons
GetIOThreadApplicationLocale() = locale;
}
-// An implementation of the SSLCertReporter interface used by
-// SSLErrorHandler. Uses CertificateReportingService to send reports. The
-// service handles queueing and re-sending of failed reports. Each certificate
-// error creates a new instance of this class.
-class CertificateReportingServiceCertReporter : public SSLCertReporter {
- public:
- explicit CertificateReportingServiceCertReporter(
- content::WebContents* web_contents)
- : service_(CertificateReportingServiceFactory::GetForBrowserContext(
- web_contents->GetBrowserContext())) {}
-
- CertificateReportingServiceCertReporter(
- const CertificateReportingServiceCertReporter&) = delete;
- CertificateReportingServiceCertReporter& operator=(
- const CertificateReportingServiceCertReporter&) = delete;
-
- ~CertificateReportingServiceCertReporter() override {}
-
- // SSLCertReporter implementation
- void ReportInvalidCertificateChain(
- const std::string& serialized_report) override {
- service_->Send(serialized_report);
- }
-
- private:
- raw_ptr<CertificateReportingService> service_;
-};
-
#if BUILDFLAG(ENABLE_EXTENSIONS)
AppLoadedInTabSource ClassifyAppLoadedInTabSource(
@@ -1495,7 +1467,6 @@ void ChromeContentBrowserClient::PostAft
InitNetworkContextsParentDirectory();
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- safe_browsing_service_ = g_browser_process->safe_browsing_service();
}
bool ChromeContentBrowserClient::IsBrowserStartupComplete() {
@@ -4290,14 +4261,9 @@ ChromeContentBrowserClient::CreateThrott
throttles.push_back(std::make_unique<PolicyBlocklistNavigationThrottle>(
handle, handle->GetWebContents()->GetBrowserContext()));
- // Before setting up SSL error detection, configure SSLErrorHandler to invoke
- // the relevant extension API whenever an SSL interstitial is shown.
- SSLErrorHandler::SetClientCallbackOnInterstitialsShown(
- base::BindRepeating(&MaybeTriggerSecurityInterstitialShownEvent));
- content::WebContents* web_contents = handle->GetWebContents();
throttles.push_back(std::make_unique<SSLErrorNavigationThrottle>(
handle,
- std::make_unique<CertificateReportingServiceCertReporter>(web_contents),
+ nullptr,
base::BindOnce(&HandleSSLErrorWrapper), base::BindOnce(&IsInHostedApp),
base::BindOnce(
&ShouldIgnoreSslInterstitialBecauseNavigationDefaultedToHttps)));
@@ -4332,16 +4298,6 @@ ChromeContentBrowserClient::CreateThrott
&throttles);
#endif
- // g_browser_process->safe_browsing_service() may be null in unittests.
- safe_browsing::SafeBrowsingUIManager* ui_manager =
- g_browser_process->safe_browsing_service()
- ? g_browser_process->safe_browsing_service()->ui_manager().get()
- : nullptr;
- MaybeAddThrottle(
- safe_browsing::SafeBrowsingNavigationThrottle::MaybeCreateThrottleFor(
- handle, ui_manager),
- &throttles);
-
if (base::FeatureList::IsEnabled(safe_browsing::kDelayedWarnings)) {
throttles.push_back(
std::make_unique<safe_browsing::DelayedWarningNavigationThrottle>(
--- a/chrome/browser/component_updater/file_type_policies_component_installer.cc
+++ b/chrome/browser/component_updater/file_type_policies_component_installer.cc
@@ -39,20 +39,6 @@ const uint8_t kFileTypePoliciesPublicKey
const char kFileTypePoliciesManifestName[] = "File Type Policies";
void LoadFileTypesFromDisk(const base::FilePath& pb_path) {
- if (pb_path.empty())
- return;
-
- VLOG(1) << "Reading Download File Types from file: " << pb_path.value();
- std::string binary_pb;
- if (!base::ReadFileToString(pb_path, &binary_pb)) {
- // The file won't exist on new installations, so this is not always an
- // error.
- VLOG(1) << "Failed reading from " << pb_path.value();
- return;
- }
-
- safe_browsing::FileTypePolicies::GetInstance()->PopulateFromDynamicUpdate(
- binary_pb);
}
} // namespace
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -430,13 +430,6 @@ ChromeDownloadManagerDelegate::~ChromeDo
void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
download_manager_ = dm;
-
- safe_browsing::SafeBrowsingService* sb_service =
- g_browser_process->safe_browsing_service();
- if (sb_service && !profile_->IsOffTheRecord()) {
- // Include this download manager in the set monitored by safe browsing.
- sb_service->AddDownloadManager(dm);
- }
}
#if BUILDFLAG(IS_ANDROID)
@@ -790,17 +783,6 @@ void ChromeDownloadManagerDelegate::Choo
void ChromeDownloadManagerDelegate::SanitizeSavePackageResourceName(
base::FilePath* filename,
const GURL& source_url) {
- safe_browsing::FileTypePolicies* file_type_policies =
- safe_browsing::FileTypePolicies::GetInstance();
-
- const PrefService* prefs = profile_->GetPrefs();
- if (file_type_policies->GetFileDangerLevel(*filename, source_url, prefs) ==
- safe_browsing::DownloadFileType::NOT_DANGEROUS)
- return;
-
- base::FilePath default_filename = base::FilePath::FromUTF8Unsafe(
- l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME));
- *filename = filename->AddExtension(default_filename.BaseName().value());
}
void ChromeDownloadManagerDelegate::SanitizeDownloadParameters(
--- a/chrome/browser/download/download_item_model.cc
+++ b/chrome/browser/download/download_item_model.cc
@@ -89,7 +89,7 @@ class DownloadItemModelData : public bas
// Danger level of the file determined based on the file type and whether
// there was a user action associated with the download.
- DownloadFileType::DangerLevel danger_level_;
+ safe_browsing::DownloadFileType::DangerLevel danger_level_;
// Whether the download is currently being revived.
bool is_being_revived_;
@@ -126,7 +126,7 @@ DownloadItemModelData::DownloadItemModel
: should_show_in_shelf_(true),
was_ui_notified_(false),
should_prefer_opening_in_browser_(false),
- danger_level_(DownloadFileType::NOT_DANGEROUS),
+ danger_level_(safe_browsing::DownloadFileType::NOT_DANGEROUS),
is_being_revived_(false) {}
} // namespace
@@ -417,13 +417,13 @@ void DownloadItemModel::SetShouldPreferO
data->should_prefer_opening_in_browser_ = preference;
}
-DownloadFileType::DangerLevel DownloadItemModel::GetDangerLevel() const {
+safe_browsing::DownloadFileType::DangerLevel DownloadItemModel::GetDangerLevel() const {
const DownloadItemModelData* data = DownloadItemModelData::Get(download_);
- return data ? data->danger_level_ : DownloadFileType::NOT_DANGEROUS;
+ return data ? data->danger_level_ : safe_browsing::DownloadFileType::NOT_DANGEROUS;
}
void DownloadItemModel::SetDangerLevel(
- DownloadFileType::DangerLevel danger_level) {
+ safe_browsing::DownloadFileType::DangerLevel danger_level) {
DownloadItemModelData* data = DownloadItemModelData::GetOrCreate(download_);
data->danger_level_ = danger_level;
}
@@ -643,9 +643,6 @@ bool DownloadItemModel::IsCommandEnabled
// filename. Don't base an "Always open" decision based on it. Also
// exclude extensions.
return download_->CanOpenDownload() &&
- safe_browsing::FileTypePolicies::GetInstance()
- ->IsAllowedToOpenAutomatically(
- download_->GetTargetFilePath()) &&
!download_crx_util::IsExtensionDownload(*download_);
case DownloadCommands::PAUSE:
return !download_->IsSavePackageDownload() &&
--- a/chrome/browser/download/download_prefs.cc
+++ b/chrome/browser/download/download_prefs.cc
@@ -252,14 +252,7 @@ DownloadPrefs::DownloadPrefs(Profile* pr
base::FilePath::StringType(1, base::FilePath::kExtensionSeparator) +
extension);
- // Note that the list of file types that are not allowed to open
- // automatically can change in the future. When the list is tightened, it is
- // expected that some entries in the users' auto open list will get dropped
- // permanently as a result.
- if (FileTypePolicies::GetInstance()->IsAllowedToOpenAutomatically(
- filename_with_extension)) {
- auto_open_by_user_.insert(extension);
- }
+ auto_open_by_user_.insert(extension);
}
}
@@ -479,10 +472,6 @@ bool DownloadPrefs::IsAutoOpenByPolicy(c
bool DownloadPrefs::EnableAutoOpenByUserBasedOnExtension(
const base::FilePath& file_name) {
base::FilePath::StringType extension = file_name.Extension();
- if (!FileTypePolicies::GetInstance()->IsAllowedToOpenAutomatically(
- file_name)) {
- return false;
- }
DCHECK(extension[0] == base::FilePath::kExtensionSeparator);
extension.erase(0, 1);
--- a/chrome/browser/download/download_target_determiner.cc
+++ b/chrome/browser/download/download_target_determiner.cc
@@ -297,13 +297,6 @@ base::FilePath DownloadTargetDeterminer:
download_->GetURL(), download_->GetContentDisposition(), referrer_charset,
suggested_filename, sniffed_mime_type, default_filename);
- // We don't replace the file extension if sfafe browsing consider the file
- // extension to be unsafe. Just let safe browsing scan the generated file.
- if (safe_browsing::FileTypePolicies::GetInstance()->IsCheckedBinaryFile(
- generated_filename)) {
- return generated_filename;
- }
-
// If no mime type or explicitly specified a name, don't replace file
// extension.
if (sniffed_mime_type.empty() || !suggested_filename.empty())
@@ -1124,30 +1117,7 @@ DownloadFileType::DangerLevel DownloadTa
download_->HasUserGesture())
return DownloadFileType::NOT_DANGEROUS;
- DownloadFileType::DangerLevel danger_level =
- safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel(
- virtual_path_.BaseName(), download_->GetURL(),
- GetProfile()->GetPrefs());
-
- // A danger level of ALLOW_ON_USER_GESTURE is used to label potentially
- // dangerous file types that have a high frequency of legitimate use. We would
- // like to avoid prompting for the legitimate cases as much as possible. To
- // that end, we consider a download to be legitimate if one of the following
- // is true, and avoid prompting:
- //
- // * The user navigated to the download URL via the omnibox (either by typing
- // the URL, pasting it, or using search).
- //
- // * The navigation that initiated the download has a user gesture associated
- // with it AND the user the user is familiar with the referring origin. A
- // user is considered familiar with a referring origin if a visit for a page
- // from the same origin was recorded on the previous day or earlier.
- if (danger_level == DownloadFileType::ALLOW_ON_USER_GESTURE &&
- ((download_->GetTransitionType() &
- ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) != 0 ||
- (download_->HasUserGesture() && visits == VISITED_REFERRER)))
- return DownloadFileType::NOT_DANGEROUS;
- return danger_level;
+ return DownloadFileType::NOT_DANGEROUS;
}
absl::optional<base::Time>
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -36,7 +36,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_core_service.h"
#include "chrome/browser/download/download_core_service_factory.h"
-#include "chrome/browser/download/download_danger_prompt.h"
#include "chrome/browser/download/download_file_icon_extractor.h"
#include "chrome/browser/download/download_open_prompt.h"
#include "chrome/browser/download/download_prefs.h"
@@ -1277,9 +1276,6 @@ DownloadsAcceptDangerFunction::Downloads
DownloadsAcceptDangerFunction::~DownloadsAcceptDangerFunction() {}
-DownloadsAcceptDangerFunction::OnPromptCreatedCallback*
- DownloadsAcceptDangerFunction::on_prompt_created_ = NULL;
-
ExtensionFunction::ResponseAction DownloadsAcceptDangerFunction::Run() {
std::unique_ptr<downloads::AcceptDanger::Params> params(
downloads::AcceptDanger::Params::Create(args()));
@@ -1317,42 +1313,7 @@ void DownloadsAcceptDangerFunction::Prom
return;
}
RecordApiFunctions(DOWNLOADS_FUNCTION_ACCEPT_DANGER);
- // DownloadDangerPrompt displays a modal dialog using native widgets that the
- // user must either accept or cancel. It cannot be scripted.
- DownloadDangerPrompt* prompt = DownloadDangerPrompt::Create(
- download_item, web_contents, true,
- base::BindOnce(&DownloadsAcceptDangerFunction::DangerPromptCallback, this,
- download_id));
- // DownloadDangerPrompt deletes itself
- if (on_prompt_created_ && !on_prompt_created_->is_null())
- std::move(*on_prompt_created_).Run(prompt);
- // Function finishes in DangerPromptCallback().
-}
-
-void DownloadsAcceptDangerFunction::DangerPromptCallback(
- int download_id,
- DownloadDangerPrompt::Action action) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- DownloadItem* download_item = GetDownload(
- browser_context(), include_incognito_information(), download_id);
- std::string error;
- if (InvalidId(download_item, &error) ||
- Fault(download_item->GetState() != DownloadItem::IN_PROGRESS,
- download_extension_errors::kNotInProgress, &error)) {
- Respond(Error(std::move(error)));
- return;
- }
- switch (action) {
- case DownloadDangerPrompt::ACCEPT:
- download_item->ValidateDangerousDownload();
- break;
- case DownloadDangerPrompt::CANCEL:
- download_item->Remove();
- break;
- case DownloadDangerPrompt::DISMISS:
- break;
- }
- Respond(NoArguments());
+ download_item->ValidateDangerousDownload();
}
DownloadsShowFunction::DownloadsShowFunction() {}
--- a/chrome/browser/extensions/api/downloads/downloads_api.h
+++ b/chrome/browser/extensions/api/downloads/downloads_api.h
@@ -13,7 +13,6 @@
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
-#include "chrome/browser/download/download_danger_prompt.h"
#include "chrome/common/extensions/api/downloads.h"
#include "components/download/content/public/all_download_item_notifier.h"
#include "components/download/public/common/download_path_reservation_tracker.h"
@@ -199,13 +198,6 @@ class DownloadsRemoveFileFunction : publ
class DownloadsAcceptDangerFunction : public ExtensionFunction {
public:
- using OnPromptCreatedCallback =
- base::OnceCallback<void(DownloadDangerPrompt*)>;
- static void OnPromptCreatedForTesting(
- OnPromptCreatedCallback* callback) {
- on_prompt_created_ = callback;
- }
-
DECLARE_EXTENSION_FUNCTION("downloads.acceptDanger", DOWNLOADS_ACCEPTDANGER)
DownloadsAcceptDangerFunction();
@@ -217,13 +209,10 @@ class DownloadsAcceptDangerFunction : pu
protected:
~DownloadsAcceptDangerFunction() override;
- void DangerPromptCallback(int download_id,
- DownloadDangerPrompt::Action action);
private:
void PromptOrWait(int download_id, int retries);
- static OnPromptCreatedCallback* on_prompt_created_;
};
class DownloadsShowFunction : public ExtensionFunction {
--- a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc
+++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc
@@ -54,38 +54,7 @@ SafeBrowsingPrivateGetReferrerChainFunct
base::StringPrintf("Could not find tab with id %d.", params->tab_id)));
}
- Profile* profile = Profile::FromBrowserContext(browser_context());
- if (!SafeBrowsingNavigationObserverManager::IsEnabledAndReady(
- profile->GetPrefs(), g_browser_process->safe_browsing_service()))
- return RespondNow(NoArguments());
-
- SafeBrowsingNavigationObserverManager* navigation_observer_manager =
- safe_browsing::SafeBrowsingNavigationObserverManagerFactory::
- GetForBrowserContext(profile);
-
- safe_browsing::ReferrerChain referrer_chain;
- SafeBrowsingNavigationObserverManager::AttributionResult result =
- navigation_observer_manager->IdentifyReferrerChainByRenderFrameHost(
- contents->GetMainFrame(), kReferrerUserGestureLimit, &referrer_chain);
-
- // If the referrer chain is incomplete we'll append the most recent
- // navigations to referrer chain for diagnostic purposes. This only happens if
- // the user is not in incognito mode and has opted into extended reporting or
- // Scout reporting. Otherwise, |CountOfRecentNavigationsToAppend| returns 0.
- int recent_navigations_to_collect =
- SafeBrowsingNavigationObserverManager::CountOfRecentNavigationsToAppend(
- profile, profile->GetPrefs(), result);
- if (recent_navigations_to_collect > 0) {
- navigation_observer_manager->AppendRecentNavigations(
- recent_navigations_to_collect, &referrer_chain);
- }
-
std::vector<api::safe_browsing_private::ReferrerChainEntry> referrer_entries;
- referrer_entries.reserve(referrer_chain.size());
- for (const auto& entry : referrer_chain) {
- referrer_entries.emplace_back(
- safe_browsing_util::ReferrerToReferrerChainEntry(entry));
- }
return RespondNow(ArgumentList(
api::safe_browsing_private::GetReferrerChain::Results::Create(
referrer_entries)));
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -721,18 +721,6 @@ void WebstorePrivateBeginInstallWithMani
void WebstorePrivateBeginInstallWithManifest3Function::
ReportFrictionAcceptedEvent() {
- if (!profile_) {
- return;
- }
- auto* metrics_collector =
- safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile(
- profile_);
- // `metrics_collector` can be null in incognito.
- if (metrics_collector) {
- metrics_collector->AddSafeBrowsingEventToPref(
- safe_browsing::SafeBrowsingMetricsCollector::EventType::
- EXTENSION_ALLOWLIST_INSTALL_BYPASS);
- }
}
void WebstorePrivateBeginInstallWithManifest3Function::OnInstallPromptDone(
@@ -1202,55 +1190,9 @@ WebstorePrivateGetReferrerChainFunction:
ExtensionFunction::ResponseAction
WebstorePrivateGetReferrerChainFunction::Run() {
- Profile* profile = Profile::FromBrowserContext(browser_context());
- if (!SafeBrowsingNavigationObserverManager::IsEnabledAndReady(
- profile->GetPrefs(), g_browser_process->safe_browsing_service()))
- return RespondNow(ArgumentList(
- api::webstore_private::GetReferrerChain::Results::Create("")));
-
- content::RenderFrameHost* rfh = render_frame_host();
- content::RenderFrameHost* outermost_rfh =
- rfh ? rfh->GetOutermostMainFrame() : nullptr;
-
- if (!outermost_rfh) {
- return RespondNow(ErrorWithArguments(
- api::webstore_private::GetReferrerChain::Results::Create(""),
- kWebstoreUserCancelledError));
- }
-
- SafeBrowsingNavigationObserverManager* navigation_observer_manager =
- safe_browsing::SafeBrowsingNavigationObserverManagerFactory::
- GetForBrowserContext(profile);
-
- safe_browsing::ReferrerChain referrer_chain;
- SafeBrowsingNavigationObserverManager::AttributionResult result =
- navigation_observer_manager->IdentifyReferrerChainByRenderFrameHost(
- outermost_rfh, kExtensionReferrerUserGestureLimit, &referrer_chain);
-
- // If the referrer chain is incomplete we'll append the most recent
- // navigations to referrer chain for diagnostic purposes. This only happens if
- // the user is not in incognito mode and has opted into extended reporting or
- // Scout reporting. Otherwise, |CountOfRecentNavigationsToAppend| returns 0.
- int recent_navigations_to_collect =
- SafeBrowsingNavigationObserverManager::CountOfRecentNavigationsToAppend(
- profile, profile->GetPrefs(), result);
- if (recent_navigations_to_collect > 0) {
- navigation_observer_manager->AppendRecentNavigations(
- recent_navigations_to_collect, &referrer_chain);
- }
-
- safe_browsing::ExtensionWebStoreInstallRequest request;
- request.mutable_referrer_chain()->Swap(&referrer_chain);
- request.mutable_referrer_chain_options()->set_recent_navigations_to_collect(
- recent_navigations_to_collect);
-
- std::string serialized_referrer_proto = request.SerializeAsString();
- // Base64 encode the proto to avoid issues with base::Value rejecting strings
- // which are not valid UTF8.
- base::Base64Encode(serialized_referrer_proto, &serialized_referrer_proto);
return RespondNow(
ArgumentList(api::webstore_private::GetReferrerChain::Results::Create(
- serialized_referrer_proto)));
+ "")));
}
WebstorePrivateGetExtensionStatusFunction::
--- a/chrome/browser/extensions/blocklist_state_fetcher.cc
+++ b/chrome/browser/extensions/blocklist_state_fetcher.cc
@@ -38,23 +38,8 @@ BlocklistStateFetcher::~BlocklistStateFe
void BlocklistStateFetcher::Request(const std::string& id,
RequestCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (!safe_browsing_config_) {
- if (g_browser_process && g_browser_process->safe_browsing_service()) {
- SetSafeBrowsingConfig(
- g_browser_process->safe_browsing_service()->GetV4ProtocolConfig());
- } else {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), BLOCKLISTED_UNKNOWN));
- return;
- }
- }
-
- bool request_already_sent = base::Contains(callbacks_, id);
- callbacks_.insert(std::make_pair(id, std::move(callback)));
- if (request_already_sent)
- return;
-
- SendRequest(id);
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::BindOnce(std::move(callback), BLOCKLISTED_UNKNOWN));
}
void BlocklistStateFetcher::SendRequest(const std::string& id) {
@@ -65,8 +50,7 @@ void BlocklistStateFetcher::SendRequest(
std::string request_str;
request.SerializeToString(&request_str);
- GURL request_url = GURL(safe_browsing::GetReportUrl(
- *safe_browsing_config_, "clientreport/crx-list-info"));
+ GURL request_url = GURL();
net::NetworkTrafficAnnotationTag traffic_annotation =
net::DefineNetworkTrafficAnnotation("extension_blacklist", R"(
semantics {
@@ -114,12 +98,6 @@ void BlocklistStateFetcher::SendRequest(
base::Unretained(this), fetcher));
}
-void BlocklistStateFetcher::SetSafeBrowsingConfig(
- const safe_browsing::V4ProtocolConfig& config) {
- safe_browsing_config_ =
- std::make_unique<safe_browsing::V4ProtocolConfig>(config);
-}
-
void BlocklistStateFetcher::OnURLLoaderComplete(
network::SimpleURLLoader* url_loader,
std::unique_ptr<std::string> response_body) {
--- a/chrome/browser/extensions/blocklist_state_fetcher.h
+++ b/chrome/browser/extensions/blocklist_state_fetcher.h
@@ -36,8 +36,6 @@ class BlocklistStateFetcher {
virtual void Request(const std::string& id, RequestCallback callback);
- void SetSafeBrowsingConfig(const safe_browsing::V4ProtocolConfig& config);
-
protected:
void OnURLLoaderComplete(network::SimpleURLLoader* url_loader,
std::unique_ptr<std::string> response_body);
@@ -56,7 +54,6 @@ class BlocklistStateFetcher {
void SendRequest(const std::string& id);
- std::unique_ptr<safe_browsing::V4ProtocolConfig> safe_browsing_config_;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
// SimpleURLLoader -> (owned loader, extension id).
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
@@ -861,9 +861,6 @@ void ChromeMetricsServiceClient::Registe
metrics_service_->RegisterMetricsProvider(
std::make_unique<HttpsEngagementMetricsProvider>());
- metrics_service_->RegisterMetricsProvider(
- std::make_unique<CertificateReportingMetricsProvider>());
-
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
metrics_service_->RegisterMetricsProvider(
std::make_unique<UpgradeMetricsProvider>());
--- a/chrome/browser/net/trial_comparison_cert_verifier_controller.cc
+++ b/chrome/browser/net/trial_comparison_cert_verifier_controller.cc
@@ -137,9 +137,6 @@ void TrialComparisonCertVerifierControll
std::string serialized_report;
if (!report.Serialize(&serialized_report))
return;
-
- CertificateReportingServiceFactory::GetForBrowserContext(profile_)->Send(
- serialized_report);
}
// static
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -324,7 +324,6 @@ void ChromeBrowserMainExtraPartsProfiles
#if BUILDFLAG(IS_CHROMEOS_LACROS)
CertDbInitializerFactory::GetInstance();
#endif
- CertificateReportingServiceFactory::GetInstance();
#if !BUILDFLAG(IS_ANDROID)
ChromeBrowsingDataLifetimeManagerFactory::GetInstance();
#endif
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -91,7 +91,6 @@
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/push_messaging/push_messaging_service_factory.h"
#include "chrome/browser/push_messaging/push_messaging_service_impl.h"
-#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/sessions/exit_type_service.h"
#include "chrome/browser/sharing/sharing_service_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
@@ -623,17 +622,6 @@ void ProfileImpl::LoadPrefsForNormalStar
mojo::PendingRemote<prefs::mojom::TrackedPreferenceValidationDelegate>
pref_validation_delegate;
- scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service(
- g_browser_process->safe_browsing_service());
- if (safe_browsing_service.get()) {
- auto pref_validation_delegate_impl =
- safe_browsing_service->CreatePreferenceValidationDelegate(this);
- if (pref_validation_delegate_impl) {
- mojo::MakeSelfOwnedReceiver(
- std::move(pref_validation_delegate_impl),
- pref_validation_delegate.InitWithNewPipeAndPassReceiver());
- }
- }
prefs_ =
CreatePrefService(pref_registry_, CreateExtensionPrefStore(this, false),
--- a/chrome/browser/profiles/profiles_state.cc
+++ b/chrome/browser/profiles/profiles_state.cc
@@ -255,9 +255,6 @@ void RemoveBrowsingDataForProfile(const
// The BrowsingDataRemover relies on many objects that aren't created in unit
// tests. Previously this code would depend on content::ResourceDispatcherHost
// but that's gone, so do a similar hack for now.
- if (!g_browser_process->safe_browsing_service())
- return;
-
Profile* profile =
g_browser_process->profile_manager()->GetProfileByPath(profile_path);
if (!profile)
--- a/chrome/browser/safe_browsing/BUILD.gn
+++ b/chrome/browser/safe_browsing/BUILD.gn
@@ -6,6 +6,7 @@ import("//components/safe_browsing/build
import("//extensions/buildflags/buildflags.gni")
static_library("safe_browsing") {
+ if (false) {
sources = [
"chrome_controller_client.cc",
"chrome_controller_client.h",
@@ -91,6 +92,7 @@ static_library("safe_browsing") {
"//extensions/browser",
]
}
+ }
if (safe_browsing_mode != 0) {
# "Safe Browsing Basic" files used for safe browsing in full mode
@@ -455,6 +457,7 @@ static_library("advanced_protection") {
}
source_set("metrics_collector") {
+ if (false) {
sources = [
"safe_browsing_metrics_collector_factory.cc",
"safe_browsing_metrics_collector_factory.h",
@@ -472,6 +475,7 @@ source_set("metrics_collector") {
"//components/safe_browsing/core/common:safe_browsing_prefs",
"//content/public/browser",
]
+ }
}
source_set("test_support") {
--- a/chrome/browser/ssl/security_state_tab_helper.cc
+++ b/chrome/browser/ssl/security_state_tab_helper.cc
@@ -180,89 +180,6 @@ bool SecurityStateTabHelper::UsedPolicyI
security_state::MaliciousContentStatus
SecurityStateTabHelper::GetMaliciousContentStatus() const {
- content::NavigationEntry* entry =
- web_contents()->GetController().GetVisibleEntry();
- if (!entry)
- return security_state::MALICIOUS_CONTENT_STATUS_NONE;
- safe_browsing::SafeBrowsingService* sb_service =
- g_browser_process->safe_browsing_service();
- if (!sb_service)
- return security_state::MALICIOUS_CONTENT_STATUS_NONE;
- scoped_refptr<SafeBrowsingUIManager> sb_ui_manager = sb_service->ui_manager();
- safe_browsing::SBThreatType threat_type;
- if (sb_ui_manager->IsUrlAllowlistedOrPendingForWebContents(
- entry->GetURL(), false, entry, web_contents(), false, &threat_type)) {
- switch (threat_type) {
- case safe_browsing::SB_THREAT_TYPE_UNUSED:
- case safe_browsing::SB_THREAT_TYPE_SAFE:
- case safe_browsing::SB_THREAT_TYPE_URL_PHISHING:
- case safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_PHISHING:
- return security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING;
- case safe_browsing::SB_THREAT_TYPE_URL_MALWARE:
- case safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_MALWARE:
- return security_state::MALICIOUS_CONTENT_STATUS_MALWARE;
- case safe_browsing::SB_THREAT_TYPE_URL_UNWANTED:
- return security_state::MALICIOUS_CONTENT_STATUS_UNWANTED_SOFTWARE;
- case safe_browsing::SB_THREAT_TYPE_SAVED_PASSWORD_REUSE:
-#if BUILDFLAG(FULL_SAFE_BROWSING)
- return security_state::MALICIOUS_CONTENT_STATUS_SAVED_PASSWORD_REUSE;
-#endif
- case safe_browsing::SB_THREAT_TYPE_SIGNED_IN_SYNC_PASSWORD_REUSE:
-#if BUILDFLAG(FULL_SAFE_BROWSING)
- if (safe_browsing::ChromePasswordProtectionService::
- ShouldShowPasswordReusePageInfoBubble(
- web_contents(), PasswordType::PRIMARY_ACCOUNT_PASSWORD)) {
- return security_state::
- MALICIOUS_CONTENT_STATUS_SIGNED_IN_SYNC_PASSWORD_REUSE;
- }
-#endif
- [[fallthrough]];
- case safe_browsing::SB_THREAT_TYPE_SIGNED_IN_NON_SYNC_PASSWORD_REUSE:
-#if BUILDFLAG(FULL_SAFE_BROWSING)
- if (safe_browsing::ChromePasswordProtectionService::
- ShouldShowPasswordReusePageInfoBubble(
- web_contents(), PasswordType::OTHER_GAIA_PASSWORD)) {
- return security_state::
- MALICIOUS_CONTENT_STATUS_SIGNED_IN_NON_SYNC_PASSWORD_REUSE;
- }
-#endif
- [[fallthrough]];
- case safe_browsing::SB_THREAT_TYPE_ENTERPRISE_PASSWORD_REUSE:
-#if BUILDFLAG(FULL_SAFE_BROWSING)
- if (safe_browsing::ChromePasswordProtectionService::
- ShouldShowPasswordReusePageInfoBubble(
- web_contents(), PasswordType::ENTERPRISE_PASSWORD)) {
- return security_state::
- MALICIOUS_CONTENT_STATUS_ENTERPRISE_PASSWORD_REUSE;
- }
-#endif
- // If user has already changed password or FULL_SAFE_BROWSING isn't
- // enabled, returns the regular social engineering content status.
- return security_state::MALICIOUS_CONTENT_STATUS_SOCIAL_ENGINEERING;
- case safe_browsing::SB_THREAT_TYPE_BILLING:
- return security_state::MALICIOUS_CONTENT_STATUS_BILLING;
- case safe_browsing::
- DEPRECATED_SB_THREAT_TYPE_URL_PASSWORD_PROTECTION_PHISHING:
- case safe_browsing::SB_THREAT_TYPE_URL_BINARY_MALWARE:
- case safe_browsing::SB_THREAT_TYPE_EXTENSION:
- case safe_browsing::SB_THREAT_TYPE_BLOCKLISTED_RESOURCE:
- case safe_browsing::SB_THREAT_TYPE_API_ABUSE:
- case safe_browsing::SB_THREAT_TYPE_SUBRESOURCE_FILTER:
- case safe_browsing::SB_THREAT_TYPE_CSD_ALLOWLIST:
- case safe_browsing::SB_THREAT_TYPE_AD_SAMPLE:
- case safe_browsing::SB_THREAT_TYPE_BLOCKED_AD_POPUP:
- case safe_browsing::SB_THREAT_TYPE_BLOCKED_AD_REDIRECT:
- case safe_browsing::SB_THREAT_TYPE_SUSPICIOUS_SITE:
- case safe_browsing::SB_THREAT_TYPE_APK_DOWNLOAD:
- case safe_browsing::SB_THREAT_TYPE_HIGH_CONFIDENCE_ALLOWLIST:
- case safe_browsing::SB_THREAT_TYPE_ACCURACY_TIPS:
- // These threat types are not currently associated with
- // interstitials, and thus resources with these threat types are
- // not ever whitelisted or pending whitelisting.
- NOTREACHED();
- break;
- }
- }
return security_state::MALICIOUS_CONTENT_STATUS_NONE;
}
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -4219,7 +4219,6 @@ static_library("ui") {
"views/download/bubble/download_dialog_view.h",
"views/download/bubble/download_toolbar_button_view.cc",
"views/download/bubble/download_toolbar_button_view.h",
- "views/download/download_danger_prompt_views.cc",
"views/download/download_in_progress_dialog_view.cc",
"views/download/download_in_progress_dialog_view.h",
"views/download/download_item_view.cc",
--- a/chrome/browser/ui/tab_helpers.cc
+++ b/chrome/browser/ui/tab_helpers.cc
@@ -390,22 +390,6 @@ void TabHelpers::AttachTabHelpers(WebCon
// See https://crbug.com/910288.
resource_coordinator::ResourceCoordinatorTabHelper::CreateForWebContents(
web_contents);
- safe_browsing::SafeBrowsingNavigationObserver::MaybeCreateForWebContents(
- web_contents, HostContentSettingsMapFactory::GetForProfile(profile),
- safe_browsing::SafeBrowsingNavigationObserverManagerFactory::
- GetForBrowserContext(profile),
- profile->GetPrefs(), g_browser_process->safe_browsing_service());
- if (base::FeatureList::IsEnabled(
- safe_browsing::kTailoredSecurityIntegration)) {
- safe_browsing::TailoredSecurityUrlObserver::CreateForWebContents(
- web_contents,
- safe_browsing::TailoredSecurityServiceFactory::GetForProfile(profile));
- }
- safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(
- web_contents,
- std::make_unique<safe_browsing::ChromeSafeBrowsingTabObserverDelegate>());
- safe_browsing::TriggerCreator::MaybeCreateTriggersForWebContents(
- profile, web_contents);
ReputationWebContentsObserver::CreateForWebContents(web_contents);
SearchEngineTabHelper::CreateForWebContents(web_contents);
SecurityStateTabHelper::CreateForWebContents(web_contents);
--- a/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
+++ b/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
@@ -23,7 +23,6 @@
#include "base/threading/thread.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/download/download_danger_prompt.h"
#include "chrome/browser/download/download_history.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_prefs.h"
@@ -172,9 +171,6 @@ void DownloadsDOMHandler::SaveDangerousR
}
CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
- download::DownloadItem* file = GetDownloadByStringId(id);
- if (file)
- ShowDangerPrompt(file);
}
void DownloadsDOMHandler::AcceptIncognitoWarning(const std::string& id) {
@@ -326,12 +322,6 @@ void DownloadsDOMHandler::RemoveDownload
IdSet ids;
for (auto* download : to_remove) {
- if (download->IsDangerous() || download->IsMixedContent()) {
- // Don't allow users to revive dangerous downloads; just nuke 'em.
- download->Remove();
- continue;
- }
-
DownloadItemModel item_model(download);
if (!item_model.ShouldShowInShelf() ||
download->GetState() == download::DownloadItem::IN_PROGRESS) {
@@ -405,44 +395,6 @@ void DownloadsDOMHandler::FinalizeRemova
}
}
-void DownloadsDOMHandler::ShowDangerPrompt(
- download::DownloadItem* dangerous_item) {
- DownloadDangerPrompt* danger_prompt = DownloadDangerPrompt::Create(
- dangerous_item, GetWebUIWebContents(), false,
- base::BindOnce(&DownloadsDOMHandler::DangerPromptDone,
- weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId()));
- // danger_prompt will delete itself.
- DCHECK(danger_prompt);
-}
-
-void DownloadsDOMHandler::DangerPromptDone(
- int download_id,
- DownloadDangerPrompt::Action action) {
- if (action != DownloadDangerPrompt::ACCEPT)
- return;
- download::DownloadItem* item = NULL;
- if (GetMainNotifierManager())
- item = GetMainNotifierManager()->GetDownload(download_id);
- if (!item && GetOriginalNotifierManager())
- item = GetOriginalNotifierManager()->GetDownload(download_id);
- if (!item || item->IsDone())
- return;
- CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
-
- // If a download is mixed content, validate that first. Is most cases, mixed
- // content warnings will occur first, but in the worst case scenario, we show
- // a dangerous warning twice. That's better than showing a mixed content
- // warning, then dismissing the dangerous download warning. Since mixed
- // content downloads triggering the UI are temporary and rare to begin with,
- // this should very rarely occur.
- if (item->IsMixedContent()) {
- item->ValidateMixedContentDownload();
- return;
- }
-
- item->ValidateDangerousDownload();
-}
-
bool DownloadsDOMHandler::IsDeletingHistoryAllowed() {
content::DownloadManager* manager = GetMainNotifierManager();
return manager &&
--- a/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
+++ b/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
@@ -12,7 +12,6 @@
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/download/download_danger_prompt.h"
#include "chrome/browser/ui/webui/downloads/downloads.mojom-forward.h"
#include "chrome/browser/ui/webui/downloads/downloads_list_tracker.h"
#include "content/public/browser/web_contents_observer.h"
@@ -95,18 +94,6 @@ class DownloadsDOMHandler : public conte
// null-checking |original_notifier_|.
content::DownloadManager* GetOriginalNotifierManager() const;
- // Displays a native prompt asking the user for confirmation after accepting
- // the dangerous download specified by |dangerous|. The function returns
- // immediately, and will invoke DangerPromptAccepted() asynchronously if the
- // user accepts the dangerous download. The native prompt will observe
- // |dangerous| until either the dialog is dismissed or |dangerous| is no
- // longer an in-progress dangerous download.
- virtual void ShowDangerPrompt(download::DownloadItem* dangerous);
-
- // Conveys danger acceptance from the DownloadDangerPrompt to the
- // DownloadItem.
- void DangerPromptDone(int download_id, DownloadDangerPrompt::Action action);
-
// Returns true if the records of any downloaded items are allowed (and able)
// to be deleted.
bool IsDeletingHistoryAllowed();
--- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
+++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -274,120 +274,6 @@ CreateHttpsOnlyModePage(content::WebCont
request_url));
}
-std::unique_ptr<safe_browsing::SafeBrowsingBlockingPage>
-CreateSafeBrowsingBlockingPage(content::WebContents* web_contents) {
- safe_browsing::SBThreatType threat_type =
- safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- GURL request_url("http://example.com");
- std::string url_param;
- if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "url",
- &url_param)) {
- if (GURL(url_param).is_valid()) {
- request_url = GURL(url_param);
- }
- }
- GURL main_frame_url(request_url);
- // TODO(mattm): add flag to change main_frame_url or add dedicated flag to
- // test subresource interstitials.
- std::string type_param;
- if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "type",
- &type_param)) {
- if (type_param == "malware") {
- threat_type = safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- } else if (type_param == "phishing") {
- threat_type = safe_browsing::SB_THREAT_TYPE_URL_PHISHING;
- } else if (type_param == "unwanted") {
- threat_type = safe_browsing::SB_THREAT_TYPE_URL_UNWANTED;
- } else if (type_param == "clientside_malware") {
- threat_type = safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_MALWARE;
- } else if (type_param == "clientside_phishing") {
- threat_type = safe_browsing::SB_THREAT_TYPE_URL_CLIENT_SIDE_PHISHING;
- } else if (type_param == "billing") {
- threat_type = safe_browsing::SB_THREAT_TYPE_BILLING;
- }
- }
- const content::GlobalRenderFrameHostId primary_main_frame_id =
- web_contents->GetMainFrame()->GetGlobalId();
- safe_browsing::SafeBrowsingBlockingPage::UnsafeResource resource;
- resource.url = request_url;
- resource.is_subresource = request_url != main_frame_url;
- resource.is_subframe = false;
- resource.threat_type = threat_type;
- resource.render_process_id = primary_main_frame_id.child_id;
- resource.render_frame_id = primary_main_frame_id.frame_routing_id;
- resource.threat_source = g_browser_process->safe_browsing_service()
- ->database_manager()
- ->GetThreatSource();
-
- // Normally safebrowsing interstitial types which block the main page load
- // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and
- // SB_THREAT_TYPE_URL_UNWANTED on main-frame loads) would expect there to be a
- // pending navigation when the SafeBrowsingBlockingPage is created. This demo
- // creates a SafeBrowsingBlockingPage but does not actually show a real
- // interstitial. Instead it extracts the html and displays it manually, so the
- // parts which depend on the NavigationEntry are not hit.
- auto* ui_manager =
- g_browser_process->safe_browsing_service()->ui_manager().get();
- return base::WrapUnique<safe_browsing::SafeBrowsingBlockingPage>(
- ui_manager->blocking_page_factory()->CreateSafeBrowsingPage(
- ui_manager, web_contents, main_frame_url, {resource}, true));
-}
-
-std::unique_ptr<TestSafeBrowsingBlockingPageQuiet>
-CreateSafeBrowsingQuietBlockingPage(content::WebContents* web_contents) {
- safe_browsing::SBThreatType threat_type =
- safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- GURL request_url("http://example.com");
- std::string url_param;
- if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "url",
- &url_param)) {
- if (GURL(url_param).is_valid())
- request_url = GURL(url_param);
- }
- GURL main_frame_url(request_url);
- std::string type_param;
- bool is_giant_webview = false;
- if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "type",
- &type_param)) {
- if (type_param == "malware") {
- threat_type = safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- } else if (type_param == "phishing") {
- threat_type = safe_browsing::SB_THREAT_TYPE_URL_PHISHING;
- } else if (type_param == "unwanted") {
- threat_type = safe_browsing::SB_THREAT_TYPE_URL_UNWANTED;
- } else if (type_param == "billing") {
- threat_type = safe_browsing::SB_THREAT_TYPE_BILLING;
- } else if (type_param == "giant") {
- threat_type = safe_browsing::SB_THREAT_TYPE_URL_MALWARE;
- is_giant_webview = true;
- }
- }
- const content::GlobalRenderFrameHostId primary_main_frame_id =
- web_contents->GetMainFrame()->GetGlobalId();
- safe_browsing::SafeBrowsingBlockingPage::UnsafeResource resource;
- resource.url = request_url;
- resource.is_subresource = request_url != main_frame_url;
- resource.is_subframe = false;
- resource.threat_type = threat_type;
- resource.render_process_id = primary_main_frame_id.child_id;
- resource.render_frame_id = primary_main_frame_id.frame_routing_id;
- resource.threat_source = g_browser_process->safe_browsing_service()
- ->database_manager()
- ->GetThreatSource();
-
- // Normally safebrowsing interstitial types which block the main page load
- // (SB_THREAT_TYPE_URL_MALWARE, SB_THREAT_TYPE_URL_PHISHING, and
- // SB_THREAT_TYPE_URL_UNWANTED on main-frame loads) would expect there to be a
- // pending navigation when the SafeBrowsingBlockingPage is created. This demo
- // creates a SafeBrowsingBlockingPage but does not actually show a real
- // interstitial. Instead it extracts the html and displays it manually, so the
- // parts which depend on the NavigationEntry are not hit.
- return base::WrapUnique<TestSafeBrowsingBlockingPageQuiet>(
- TestSafeBrowsingBlockingPageQuiet::CreateBlockingPage(
- g_browser_process->safe_browsing_service()->ui_manager().get(),
- web_contents, main_frame_url, resource, is_giant_webview));
-}
-
#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
std::unique_ptr<CaptivePortalBlockingPage> CreateCaptivePortalBlockingPage(
content::WebContents* web_contents) {
@@ -502,8 +388,6 @@ void InterstitialHTMLSource::StartDataRe
interstitial_delegate = CreateMITMSoftwareBlockingPage(web_contents);
} else if (path_without_query == "/blocked-interception") {
interstitial_delegate = CreateBlockedInterceptionBlockingPage(web_contents);
- } else if (path_without_query == "/safebrowsing") {
- interstitial_delegate = CreateSafeBrowsingBlockingPage(web_contents);
} else if (path_without_query == "/clock") {
interstitial_delegate = CreateBadClockBlockingPage(web_contents);
} else if (path_without_query == "/lookalike") {
@@ -520,16 +404,12 @@ void InterstitialHTMLSource::StartDataRe
interstitial_delegate = CreateHttpsOnlyModePage(web_contents);
}
- if (path_without_query == "/quietsafebrowsing") {
- std::unique_ptr<TestSafeBrowsingBlockingPageQuiet> blocking_page =
- CreateSafeBrowsingQuietBlockingPage(web_contents);
- html = blocking_page->GetHTML();
- interstitial_delegate = std::move(blocking_page);
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
- } else if (path_without_query == "/supervised_user") {
+ if (path_without_query == "/supervised_user") {
html = GetSupervisedUserInterstitialHTML(path);
+ } else
#endif
- } else if (interstitial_delegate.get()) {
+ if (interstitial_delegate.get()) {
html = interstitial_delegate.get()->GetHTMLContents();
} else {
html = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -95,7 +95,6 @@
#include "components/paint_preview/buildflags/buildflags.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/safe_browsing/buildflags.h"
-#include "components/safe_browsing/content/renderer/threat_dom_details.h"
#include "components/spellcheck/spellcheck_buildflags.h"
#include "components/subresource_filter/content/renderer/subresource_filter_agent.h"
#include "components/subresource_filter/content/renderer/unverified_ruleset_dealer.h"
--- a/components/security_interstitials/content/cert_report_helper.cc
+++ b/components/security_interstitials/content/cert_report_helper.cc
@@ -177,7 +177,6 @@ void CertReportHelper::FinishCertCollect
return;
}
- ssl_cert_reporter_->ReportInvalidCertificateChain(serialized_report);
}
bool CertReportHelper::ShouldShowCertificateReporterCheckbox() {
|