Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Unified Diff: third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp

Issue 2531683002: Revert of Post tasks for sensitive input visibility notifications (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ab57a788443e9ea402e0c2e1d87f602729b4a3d3..06b7fbc0df3c21bc0ac550e7dad4760e26b3ae2c 100644
--- a/third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp
+++ b/third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp
@@ -38,6 +38,8 @@
#include "core/html/HTMLInputElement.h"
#include "core/html/forms/FormController.h"
#include "core/layout/LayoutTextControlSingleLine.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"
@@ -91,11 +93,43 @@
}
void PasswordInputType::onAttachWithLayoutObject() {
- element().document().incrementPasswordCount();
+ Document& document = element().document();
+ DCHECK(document.frame());
+ if (document.isSecureContext()) {
+ // The browser process only cares about passwords on pages where the
+ // top-level URL is not secure. Secure contexts must have a top-level
+ // URL that is secure, so there is no need to send notifications for
+ // password fields in secure contexts.
+ return;
+ }
+
+ document.incrementPasswordCount();
+ if (document.passwordCount() > 1) {
+ // Only send a message on the first visible password field; the
+ // browser process doesn't care about the presence of additional
+ // password fields beyond that.
+ return;
+ }
+ mojom::blink::SensitiveInputVisibilityServicePtr sensitiveInputServicePtr;
+ document.frame()->interfaceProvider()->getInterface(
+ mojo::GetProxy(&sensitiveInputServicePtr));
+ sensitiveInputServicePtr->PasswordFieldVisibleInInsecureContext();
}
void PasswordInputType::onDetachWithLayoutObject() {
- element().document().decrementPasswordCount();
+ Document& document = element().document();
+ DCHECK(document.frame());
+ if (document.isSecureContext()) {
+ return;
+ }
+ document.decrementPasswordCount();
+ if (document.passwordCount() > 0)
+ return;
+
+ mojom::blink::SensitiveInputVisibilityServicePtr sensitiveInputServicePtr;
+ document.frame()->interfaceProvider()->getInterface(
+ mojo::GetProxy(&sensitiveInputServicePtr));
+ sensitiveInputServicePtr->AllPasswordFieldsInInsecureContextInvisible();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/html/forms/PasswordInputTypeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698