| 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 662db24915d98ea805fb867459fdc4fda593742a..b231fd00f1eb43c116332e101e173fbc2428ca8c 100644
|
| --- a/third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp
|
| +++ b/third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp
|
| @@ -44,58 +44,6 @@
|
|
|
| namespace blink {
|
|
|
| -namespace {
|
| -
|
| -class PasswordLayoutObject : public LayoutTextControlSingleLine {
|
| - public:
|
| - explicit PasswordLayoutObject(HTMLInputElement* element)
|
| - : LayoutTextControlSingleLine(element) {
|
| - 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();
|
| - }
|
| -
|
| - ~PasswordLayoutObject() override {}
|
| -
|
| - protected:
|
| - void willBeDestroyed() override {
|
| - LayoutTextControlSingleLine::willBeDestroyed();
|
| - Document& document = inputElement()->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
|
| -
|
| InputType* PasswordInputType::create(HTMLInputElement& element) {
|
| return new PasswordInputType(element);
|
| }
|
| @@ -139,9 +87,44 @@ void PasswordInputType::disableSecureTextInput() {
|
| element().document().setUseSecureKeyboardEntryWhenActive(false);
|
| }
|
|
|
| -LayoutObject* PasswordInputType::createLayoutObject(
|
| - const ComputedStyle& style) const {
|
| - return new PasswordLayoutObject(&element());
|
| +void PasswordInputType::onAttachWithLayoutObject() {
|
| + 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() {
|
| + 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
|
|
|