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/local_database_manager.h" | 5 #include "chrome/browser/safe_browsing/local_database_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/safe_browsing/download_protection_service.h" | 26 #include "chrome/browser/safe_browsing/download_protection_service.h" |
27 #include "chrome/browser/safe_browsing/protocol_manager.h" | 27 #include "chrome/browser/safe_browsing/protocol_manager.h" |
28 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 28 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
30 #include "chrome/browser/safe_browsing/ui_manager.h" | 30 #include "chrome/browser/safe_browsing/ui_manager.h" |
31 #include "chrome/common/chrome_constants.h" | 31 #include "chrome/common/chrome_constants.h" |
32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "components/prefs/pref_service.h" | 35 #include "components/prefs/pref_service.h" |
| 36 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
36 #include "components/safe_browsing_db/util.h" | 37 #include "components/safe_browsing_db/util.h" |
37 #include "components/safe_browsing_db/v4_protocol_manager_util.h" | 38 #include "components/safe_browsing_db/v4_protocol_manager_util.h" |
38 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
39 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
40 #include "net/url_request/url_request_context_getter.h" | 41 #include "net/url_request/url_request_context_getter.h" |
41 #include "url/url_constants.h" | 42 #include "url/url_constants.h" |
42 | 43 |
43 using content::BrowserThread; | 44 using content::BrowserThread; |
44 | 45 |
45 namespace safe_browsing { | 46 namespace safe_browsing { |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 bool LocalSafeBrowsingDatabaseManager::GetExtendedReporting() { | 887 bool LocalSafeBrowsingDatabaseManager::GetExtendedReporting() { |
887 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 888 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
888 | 889 |
889 // Determine if the last used profile is opted into extended reporting. | 890 // Determine if the last used profile is opted into extended reporting. |
890 // Note: It is possible that the last used profile is not the one triggers | 891 // Note: It is possible that the last used profile is not the one triggers |
891 // the hash request, but not very likely. | 892 // the hash request, but not very likely. |
892 bool is_extended_reporting = false; | 893 bool is_extended_reporting = false; |
893 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 894 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
894 if (profile_manager) { | 895 if (profile_manager) { |
895 Profile* profile = profile_manager->GetLastUsedProfile(); | 896 Profile* profile = profile_manager->GetLastUsedProfile(); |
896 is_extended_reporting = profile && | 897 is_extended_reporting = |
897 profile->GetPrefs()->GetBoolean( | 898 profile && IsExtendedReportingEnabled(*profile->GetPrefs()); |
898 prefs::kSafeBrowsingExtendedReportingEnabled); | |
899 } | 899 } |
900 return is_extended_reporting; | 900 return is_extended_reporting; |
901 } | 901 } |
902 | 902 |
903 void LocalSafeBrowsingDatabaseManager::RequestFullHash( | 903 void LocalSafeBrowsingDatabaseManager::RequestFullHash( |
904 SafeBrowsingCheck* check) { | 904 SafeBrowsingCheck* check) { |
905 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 905 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
906 | 906 |
907 if (!enabled_) | 907 if (!enabled_) |
908 return; | 908 return; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, | 1239 FROM_HERE, base::Bind(&LocalSafeBrowsingDatabaseManager::TimeoutCallback, |
1240 check->weak_ptr_factory_->GetWeakPtr(), check), | 1240 check->weak_ptr_factory_->GetWeakPtr(), check), |
1241 check_timeout_); | 1241 check_timeout_); |
1242 } | 1242 } |
1243 | 1243 |
1244 bool LocalSafeBrowsingDatabaseManager::IsDownloadProtectionEnabled() const { | 1244 bool LocalSafeBrowsingDatabaseManager::IsDownloadProtectionEnabled() const { |
1245 return enable_download_protection_; | 1245 return enable_download_protection_; |
1246 } | 1246 } |
1247 | 1247 |
1248 } // namespace safe_browsing | 1248 } // namespace safe_browsing |
OLD | NEW |