chromium/components/autofill/content/renderer/password_generation_agent.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/autofill/content/renderer/password_generation_agent.h"

#include <memory>
#include <utility>

#include "base/auto_reset.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/task/single_thread_task_runner.h"
#include "components/autofill/content/renderer/form_autofill_util.h"
#include "components/autofill/content/renderer/password_autofill_agent.h"
#include "components/autofill/content/renderer/password_form_conversion_utils.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/password_form_generation_data.h"
#include "components/autofill/core/common/password_generation_util.h"
#include "components/autofill/core/common/signatures.h"
#include "content/public/renderer/render_frame.h"
#include "google_apis/gaia/gaia_urls.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/features_generated.h"
#include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_form_control_element.h"
#include "third_party/blink/public/web/web_form_element.h"
#include "third_party/blink/public/web/web_input_element.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_view.h"
#include "ui/gfx/geometry/rect.h"

WebAutofillState;
WebDocument;
WebFormControlElement;
WebFormElement;
WebInputElement;
WebLocalFrame;

namespace autofill {

namespace {

GetTextDirectionForElement;
Logger;

// Returns the renderer id of the next password field in |control_elements|
// after |new_password|. This field is likely to be the confirmation field.
// Returns a null renderer ID if there is no such field.
FieldRendererId FindConfirmationPasswordFieldId(
    const std::vector<WebFormControlElement>& control_elements,
    const WebFormControlElement& new_password) {}

void CopyElementValueToOtherInputElements(
    const WebInputElement* element,
    std::vector<WebInputElement>* elements) {}

void PreviewGeneratedValue(WebInputElement& input_element,
                           const blink::WebString& value) {}

void ClearPreviewedValue(WebInputElement& input_element) {}

}  // namespace

// During prerendering, we do not want the renderer to send messages to the
// corresponding driver. Since we use a channel associated interface, we still
// need to set up the mojo connection as before (i.e., we can't defer binding
// the interface). Instead, we enqueue our messages here as post-activation
// tasks. See post-prerendering activation steps here:
// https://wicg.github.io/nav-speculation/prerendering.html#prerendering-bcs-subsection
class PasswordGenerationAgent::DeferringPasswordGenerationDriver
    : public mojom::PasswordGenerationDriver {};

// Contains information about generation status for an element for the
// lifetime of the possible interaction.
struct PasswordGenerationAgent::GenerationItemInfo {};

PasswordGenerationAgent::PasswordGenerationAgent(
    content::RenderFrame* render_frame,
    PasswordAutofillAgent* password_agent,
    blink::AssociatedInterfaceRegistry* registry)
    :{}

PasswordGenerationAgent::~PasswordGenerationAgent() {}

void PasswordGenerationAgent::BindPendingReceiver(
    mojo::PendingAssociatedReceiver<mojom::PasswordGenerationAgent>
        pending_receiver) {}

void PasswordGenerationAgent::DidCommitProvisionalLoad(
    ui::PageTransition transition) {}

void PasswordGenerationAgent::DidChangeScrollOffset() {}

void PasswordGenerationAgent::OnDestruct() {}

void PasswordGenerationAgent::OnFieldAutofilled(
    const WebInputElement& password_element) {}

bool PasswordGenerationAgent::ShouldIgnoreBlur() const {}

bool PasswordGenerationAgent::IsPrerendering() const {}

void PasswordGenerationAgent::PreviewGenerationSuggestion(
    const std::u16string& password) {}

void PasswordGenerationAgent::ClearPreviewedForm() {}

void PasswordGenerationAgent::GeneratedPasswordAccepted(
    const std::u16string& password) {}

void PasswordGenerationAgent::FocusNextFieldAfterPasswords() {}

std::optional<FormData> PasswordGenerationAgent::CreateFormDataToPresave() {}

void PasswordGenerationAgent::FoundFormEligibleForGeneration(
    const PasswordFormGenerationData& form) {}

void PasswordGenerationAgent::TriggeredGeneratePassword(
    TriggeredGeneratePasswordCallback callback) {}

bool PasswordGenerationAgent::SetUpTriggeredGeneration() {}

bool PasswordGenerationAgent::ShowPasswordGenerationSuggestions(
    const WebInputElement& element) {}

void PasswordGenerationAgent::DidEndTextFieldEditing(
    const blink::WebInputElement& element) {}

void PasswordGenerationAgent::TextFieldCleared(
    const blink::WebInputElement& element) {}

bool PasswordGenerationAgent::TextDidChangeInTextField(
    const WebInputElement& element) {}

bool PasswordGenerationAgent::MaybeOfferAutomaticGeneration() {}

void PasswordGenerationAgent::AutomaticGenerationAvailable() {}

void PasswordGenerationAgent::ShowEditingPopup() {}

void PasswordGenerationAgent::GenerationRejectedByTyping() {}

void PasswordGenerationAgent::PasswordNoLongerGenerated() {}

void PasswordGenerationAgent::MaybeCreateCurrentGenerationItem(
    WebInputElement generation_element,
    FieldRendererId confirmation_password_renderer_id) {}

mojom::PasswordManagerDriver&
PasswordGenerationAgent::GetPasswordManagerDriver() {}

mojom::PasswordGenerationDriver&
PasswordGenerationAgent::GetPasswordGenerationDriver() {}

void PasswordGenerationAgent::LogMessage(Logger::StringID message_id) {}

void PasswordGenerationAgent::LogBoolean(Logger::StringID message_id,
                                         bool truth_value) {}

}  // namespace autofill