permission_usage_session.cc 986 B

123456789101112131415161718192021222324252627282930
  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. #include "components/permissions/permission_usage_session.h"
  5. #include <tuple>
  6. namespace permissions {
  7. bool PermissionUsageSession::operator==(
  8. const PermissionUsageSession& other) const {
  9. return std::tie(origin, type, usage_start, usage_end, had_user_activation,
  10. was_foreground, had_focus) ==
  11. std::tie(other.origin, other.type, other.usage_start, other.usage_end,
  12. other.had_user_activation, other.was_foreground,
  13. other.had_focus);
  14. }
  15. bool PermissionUsageSession::operator!=(
  16. const PermissionUsageSession& other) const {
  17. return !(*this == other);
  18. }
  19. bool PermissionUsageSession::IsValid() const {
  20. return !(origin.opaque() || usage_start.is_null() || usage_end.is_null() ||
  21. usage_end < usage_start);
  22. }
  23. } // namespace permissions