credential.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2014 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 THIRD_PARTY_BLINK_RENDERER_MODULES_CREDENTIALMANAGER_CREDENTIAL_H_
  5. #define THIRD_PARTY_BLINK_RENDERER_MODULES_CREDENTIALMANAGER_CREDENTIAL_H_
  6. #include "third_party/blink/renderer/modules/modules_export.h"
  7. #include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
  8. #include "third_party/blink/renderer/platform/heap/handle.h"
  9. #include "third_party/blink/renderer/platform/weborigin/kurl.h"
  10. #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
  11. namespace blink {
  12. class ExceptionState;
  13. class MODULES_EXPORT Credential : public ScriptWrappable {
  14. DEFINE_WRAPPERTYPEINFO();
  15. public:
  16. ~Credential() override;
  17. void Trace(Visitor*) const override;
  18. virtual bool IsPasswordCredential() const { return false; }
  19. virtual bool IsFederatedCredential() const { return false; }
  20. virtual bool IsPublicKeyCredential() const { return false; }
  21. virtual bool IsOTPCredential() const { return false; }
  22. virtual bool IsPaymentCredential() const { return false; }
  23. // Credential.idl
  24. const String& id() const { return id_; }
  25. const String& type() const { return type_; }
  26. protected:
  27. Credential(const String& id, const String& type);
  28. // Parses a String into a KURL that is potentially empty or null. Throws an
  29. // exception via |exceptionState| if an invalid URL is produced.
  30. static KURL ParseStringAsURLOrThrow(const String&, ExceptionState&);
  31. private:
  32. String id_;
  33. String type_;
  34. };
  35. } // namespace blink
  36. #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_CREDENTIALMANAGER_CREDENTIAL_H_