Index: third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp |
diff --git a/third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp b/third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp |
index a2453cbdf41c9e27cfa9d9ff688359a1f745c3a4..e11d64f62181e0e4232e5236f4c8bd14c58901aa 100644 |
--- a/third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp |
+++ b/third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp |
@@ -33,8 +33,11 @@ |
#include "core/InputTypeNames.h" |
#include "core/dom/Document.h" |
+#include "core/frame/LocalFrame.h" |
#include "core/html/HTMLInputElement.h" |
#include "core/html/forms/FormController.h" |
+#include "public/platform/InterfaceProvider.h" |
+#include "public/platform/modules/sensitive_input_visibility/sensitive_input_visibility_service.mojom-blink.h" |
#include "wtf/Assertions.h" |
#include "wtf/PassRefPtr.h" |
@@ -45,6 +48,19 @@ InputType* PasswordInputType::create(HTMLInputElement& element) |
return new PasswordInputType(element); |
} |
+DEFINE_TRACE(PasswordInputType) |
+{ |
+ visitor->trace(m_visibilityObserver); |
+ BaseTextInputType::trace(visitor); |
+} |
+ |
+PasswordInputType::PasswordInputType(HTMLInputElement& element) |
+ : BaseTextInputType(element) |
+ , m_visibilityObserver(new ElementVisibilityObserver(&element, WTF::bind(&PasswordInputType::onVisibilityChanged, wrapWeakPersistent(this)))) |
+{ |
+ m_visibilityObserver->start(); |
+} |
+ |
void PasswordInputType::countUsage() |
{ |
countUsageIfVisible(UseCounter::InputTypePassword); |
@@ -92,4 +108,13 @@ void PasswordInputType::disableSecureTextInput() |
element().document().setUseSecureKeyboardEntryWhenActive(false); |
} |
+void PasswordInputType::onVisibilityChanged(bool isVisible) |
+{ |
+ if (!isVisible || !element().document().frame()) |
+ return; |
+ mojom::blink::SensitiveInputVisibilityServicePtr sensitiveInputServicePtr; |
+ element().document().frame()->interfaceProvider()->getInterface(mojo::GetProxy(&sensitiveInputServicePtr)); |
+ sensitiveInputServicePtr->PasswordFieldVisible(); |
+} |
+ |
} // namespace blink |