safety_check.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SAFETY_CHECK_SAFETY_CHECK_H_
  5. #define COMPONENTS_SAFETY_CHECK_SAFETY_CHECK_H_
  6. #include "base/observer_list_types.h"
  7. #include "components/prefs/pref_service.h"
  8. // Utilities for performing browser safety checks common to desktop, Android,
  9. // and iOS. Platform-specific checks, such as updates and extensions, are
  10. // implemented in handlers.
  11. namespace safety_check {
  12. // The following enums represent the state of each component (common among
  13. // desktop, Android, and iOS) of the safety check and should be kept in sync
  14. // with the JS frontend (safety_check_browser_proxy.js) and |SafetyCheck*|
  15. // metrics enums in enums.xml.
  16. // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.safety_check
  17. enum class PasswordsStatus {
  18. kChecking = 0,
  19. kSafe = 1,
  20. // Indicates that at least one compromised password exists. Weak passwords
  21. // may exist as well.
  22. kCompromisedExist = 2,
  23. kOffline = 3,
  24. kNoPasswords = 4,
  25. kSignedOut = 5,
  26. kQuotaLimit = 6,
  27. kError = 7,
  28. kFeatureUnavailable = 8,
  29. // Indicates that no compromised passwords exist, but at least one weak
  30. // password.
  31. kWeakPasswordsExist = 9,
  32. // New enum values must go above here.
  33. kMaxValue = kWeakPasswordsExist,
  34. };
  35. // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.safety_check
  36. enum class SafeBrowsingStatus {
  37. kChecking = 0,
  38. kEnabled = 1,
  39. kDisabled = 2,
  40. kDisabledByAdmin = 3,
  41. kDisabledByExtension = 4,
  42. kEnabledStandard = 5,
  43. kEnabledEnhanced = 6,
  44. kEnabledStandardAvailableEnhanced = 7,
  45. // New enum values must go above here.
  46. kMaxValue = kEnabledStandardAvailableEnhanced,
  47. };
  48. // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.safety_check
  49. enum class UpdateStatus {
  50. kChecking = 0,
  51. kUpdated = 1,
  52. kUpdating = 2,
  53. kRelaunch = 3,
  54. kDisabledByAdmin = 4,
  55. kFailedOffline = 5,
  56. kFailed = 6,
  57. // Non-Google branded browsers cannot check for updates using
  58. // VersionUpdater.
  59. kUnknown = 7,
  60. // Only used in Android where the user is directed to the Play Store.
  61. kOutdated = 8,
  62. // New enum values must go above here.
  63. kMaxValue = kOutdated,
  64. };
  65. // Gets the status of Safe Browsing from the PrefService and invokes
  66. // OnSafeBrowsingCheckResult on each Observer with results.
  67. SafeBrowsingStatus CheckSafeBrowsing(PrefService* pref_service);
  68. } // namespace safety_check
  69. #endif // COMPONENTS_SAFETY_CHECK_SAFETY_CHECK_H_