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/safe_browsing/download_protection_service.h" | 5 #include "chrome/browser/safe_browsing/download_protection_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/scoped_observer.h" | 23 #include "base/scoped_observer.h" |
24 #include "base/sequenced_task_runner_helpers.h" | 24 #include "base/sequenced_task_runner_helpers.h" |
25 #include "base/sha1.h" | 25 #include "base/sha1.h" |
26 #include "base/stl_util.h" | 26 #include "base/stl_util.h" |
27 #include "base/strings/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
28 #include "base/strings/string_split.h" | 28 #include "base/strings/string_split.h" |
29 #include "base/strings/string_util.h" | 29 #include "base/strings/string_util.h" |
30 #include "base/strings/stringprintf.h" | 30 #include "base/strings/stringprintf.h" |
31 #include "base/task/cancelable_task_tracker.h" | 31 #include "base/task/cancelable_task_tracker.h" |
32 #include "base/task_scheduler/post_task.h" | 32 #include "base/task_scheduler/post_task.h" |
| 33 #include "base/task_scheduler/task_traits.h" |
33 #include "base/threading/sequenced_worker_pool.h" | 34 #include "base/threading/sequenced_worker_pool.h" |
34 #include "base/time/time.h" | 35 #include "base/time/time.h" |
35 #include "build/build_config.h" | 36 #include "build/build_config.h" |
36 #include "chrome/browser/browser_process.h" | 37 #include "chrome/browser/browser_process.h" |
37 #include "chrome/browser/history/history_service_factory.h" | 38 #include "chrome/browser/history/history_service_factory.h" |
38 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 39 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
39 #include "chrome/browser/profiles/profile.h" | 40 #include "chrome/browser/profiles/profile.h" |
40 #include "chrome/browser/profiles/profile_manager.h" | 41 #include "chrome/browser/profiles/profile_manager.h" |
41 #include "chrome/browser/safe_browsing/download_feedback_service.h" | 42 #include "chrome/browser/safe_browsing/download_feedback_service.h" |
42 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 43 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 }; | 1642 }; |
1642 | 1643 |
1643 DownloadProtectionService::DownloadProtectionService( | 1644 DownloadProtectionService::DownloadProtectionService( |
1644 SafeBrowsingService* sb_service) | 1645 SafeBrowsingService* sb_service) |
1645 : navigation_observer_manager_(nullptr), | 1646 : navigation_observer_manager_(nullptr), |
1646 request_context_getter_(sb_service ? sb_service->url_request_context() | 1647 request_context_getter_(sb_service ? sb_service->url_request_context() |
1647 : nullptr), | 1648 : nullptr), |
1648 enabled_(false), | 1649 enabled_(false), |
1649 binary_feature_extractor_(new BinaryFeatureExtractor()), | 1650 binary_feature_extractor_(new BinaryFeatureExtractor()), |
1650 download_request_timeout_ms_(kDownloadRequestTimeoutMs), | 1651 download_request_timeout_ms_(kDownloadRequestTimeoutMs), |
1651 feedback_service_( | 1652 feedback_service_(new DownloadFeedbackService( |
1652 new DownloadFeedbackService(request_context_getter_.get(), | 1653 request_context_getter_.get(), |
1653 BrowserThread::GetBlockingPool())), | 1654 base::CreateSequencedTaskRunnerWithTraits( |
| 1655 {base::MayBlock(), base::TaskPriority::BACKGROUND}) |
| 1656 .get())), |
1654 whitelist_sample_rate_(kWhitelistDownloadSampleRate) { | 1657 whitelist_sample_rate_(kWhitelistDownloadSampleRate) { |
1655 if (sb_service) { | 1658 if (sb_service) { |
1656 ui_manager_ = sb_service->ui_manager(); | 1659 ui_manager_ = sb_service->ui_manager(); |
1657 database_manager_ = sb_service->database_manager(); | 1660 database_manager_ = sb_service->database_manager(); |
1658 navigation_observer_manager_ = sb_service->navigation_observer_manager(); | 1661 navigation_observer_manager_ = sb_service->navigation_observer_manager(); |
1659 ParseManualBlacklistFlag(); | 1662 ParseManualBlacklistFlag(); |
1660 } | 1663 } |
1661 } | 1664 } |
1662 | 1665 |
1663 DownloadProtectionService::~DownloadProtectionService() { | 1666 DownloadProtectionService::~DownloadProtectionService() { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 out_request->mutable_referrer_chain()); | 1985 out_request->mutable_referrer_chain()); |
1983 UMA_HISTOGRAM_COUNTS_100( | 1986 UMA_HISTOGRAM_COUNTS_100( |
1984 "SafeBrowsing.ReferrerURLChainSize.PPAPIDownloadAttribution", | 1987 "SafeBrowsing.ReferrerURLChainSize.PPAPIDownloadAttribution", |
1985 out_request->referrer_chain_size()); | 1988 out_request->referrer_chain_size()); |
1986 UMA_HISTOGRAM_ENUMERATION( | 1989 UMA_HISTOGRAM_ENUMERATION( |
1987 "SafeBrowsing.ReferrerAttributionResult.PPAPIDownloadAttribution", result, | 1990 "SafeBrowsing.ReferrerAttributionResult.PPAPIDownloadAttribution", result, |
1988 SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX); | 1991 SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX); |
1989 } | 1992 } |
1990 | 1993 |
1991 } // namespace safe_browsing | 1994 } // namespace safe_browsing |
OLD | NEW |