chromium/chrome/browser/ui/passwords/password_generation_popup_controller_impl.cc

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

#include "chrome/browser/ui/passwords/password_generation_popup_controller_impl.h"

#include <math.h>
#include <stddef.h>

#include <algorithm>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/ui/passwords/password_generation_popup_observer.h"
#include "chrome/browser/ui/passwords/password_generation_popup_view.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/autofill/core/browser/ui/popup_open_enums.h"
#include "components/autofill/core/browser/ui/suggestion.h"
#include "components/autofill/core/common/password_generation_util.h"
#include "components/input/native_web_keyboard_event.h"
#include "components/password_manager/core/browser/features/password_features.h"
#include "components/password_manager/core/browser/password_bubble_experiment.h"
#include "components/password_manager/core/browser/password_generation_frame_helper.h"
#include "components/password_manager/core/browser/password_manager.h"
#include "components/password_manager/core/browser/password_manager_driver.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/text_utils.h"

#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "components/signin/public/base/consent_level.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#endif  // !BUILDFLAG(IS_ANDROID)

SuggestionHidingReason;
PasswordGenerationType;
#if !BUILDFLAG(IS_ANDROID)
kPasswordGenerationExperimentVariationParam;
PasswordGenerationVariation;
kPasswordGenerationNudgePasswordDismissCount;
#endif  // !BUILDFLAG(IS_ANDROID)

namespace {
#if !BUILDFLAG(IS_ANDROID)
constexpr int kMaxAllowedAmountOfNudgePasswordPopupRejections =;
#endif  // !BUILDFLAG(IS_ANDROID)
}  // namespace

// Handles registration for key events with RenderFrameHost.
class PasswordGenerationPopupControllerImpl::KeyPressRegistrator {};

base::WeakPtr<PasswordGenerationPopupControllerImpl>
PasswordGenerationPopupControllerImpl::GetOrCreate(
    base::WeakPtr<PasswordGenerationPopupControllerImpl> previous,
    const gfx::RectF& bounds,
    const autofill::password_generation::PasswordGenerationUIData& ui_data,
    const base::WeakPtr<password_manager::PasswordManagerDriver>& driver,
    PasswordGenerationPopupObserver* observer,
    content::WebContents* web_contents,
    content::RenderFrameHost* frame,
    PrefService* pref_service) {}

PasswordGenerationPopupControllerImpl::PasswordGenerationPopupControllerImpl(
    const gfx::RectF& bounds,
    const autofill::password_generation::PasswordGenerationUIData& ui_data,
    const base::WeakPtr<password_manager::PasswordManagerDriver>& driver,
    PasswordGenerationPopupObserver* observer,
    content::WebContents* web_contents,
    content::RenderFrameHost* frame,
    PrefService* pref_service)
    :{}

PasswordGenerationPopupControllerImpl::
    ~PasswordGenerationPopupControllerImpl() = default;

base::WeakPtr<PasswordGenerationPopupControllerImpl>
PasswordGenerationPopupControllerImpl::GetWeakPtr() {}

bool PasswordGenerationPopupControllerImpl::HandleKeyPressEvent(
    const input::NativeWebKeyboardEvent& event) {}

bool PasswordGenerationPopupControllerImpl::IsVisible() const {}

bool PasswordGenerationPopupControllerImpl::PossiblyAcceptSelectedElement() {}

bool PasswordGenerationPopupControllerImpl::IsSelectable() const {}

void PasswordGenerationPopupControllerImpl::SelectElement(
    PasswordGenerationPopupElement element) {}

void PasswordGenerationPopupControllerImpl::PasswordAccepted() {}

void PasswordGenerationPopupControllerImpl::GeneratePasswordValue(
    PasswordGenerationType generation_type) {}

void PasswordGenerationPopupControllerImpl::Show(GenerationUIState state) {}

void PasswordGenerationPopupControllerImpl::UpdateGeneratedPassword(
    std::u16string new_password) {}

void PasswordGenerationPopupControllerImpl::FrameWasScrolled() {}

void PasswordGenerationPopupControllerImpl::GenerationElementLostFocus() {}

void PasswordGenerationPopupControllerImpl::GeneratedPasswordRejected() {}

void PasswordGenerationPopupControllerImpl::WebContentsDestroyed() {}

void PasswordGenerationPopupControllerImpl::PrimaryPageChanged(
    content::Page& page) {}

#if !BUILDFLAG(IS_ANDROID)
void PasswordGenerationPopupControllerImpl::OnZoomControllerDestroyed(
    zoom::ZoomController* zoom_controller) {}

void PasswordGenerationPopupControllerImpl::OnZoomChanged(
    const zoom::ZoomController::ZoomChangedEventData& data) {}
#endif  // !BUILDFLAG(IS_ANDROID)

void PasswordGenerationPopupControllerImpl::Hide(SuggestionHidingReason) {}

void PasswordGenerationPopupControllerImpl::ViewDestroyed() {}

void PasswordGenerationPopupControllerImpl::SelectionCleared() {}

void PasswordGenerationPopupControllerImpl::SetSelected() {}

#if !BUILDFLAG(IS_ANDROID)
std::u16string PasswordGenerationPopupControllerImpl::GetPrimaryAccountEmail() {}

bool PasswordGenerationPopupControllerImpl::ShouldShowNudgePassword() const {}
#endif  // !BUILDFLAG(IS_ANDROID)

gfx::NativeView PasswordGenerationPopupControllerImpl::container_view() const {}

content::WebContents* PasswordGenerationPopupControllerImpl::GetWebContents()
    const {}

const gfx::RectF& PasswordGenerationPopupControllerImpl::element_bounds()
    const {}

autofill::PopupAnchorType PasswordGenerationPopupControllerImpl::anchor_type()
    const {}

base::i18n::TextDirection
PasswordGenerationPopupControllerImpl::GetElementTextDirection() const {}

void PasswordGenerationPopupControllerImpl::HideImpl() {}

PasswordGenerationPopupController::GenerationUIState
PasswordGenerationPopupControllerImpl::state() const {}

bool PasswordGenerationPopupControllerImpl::password_selected() const {}

bool PasswordGenerationPopupControllerImpl::accept_button_selected() const {}

bool PasswordGenerationPopupControllerImpl::cancel_button_selected() const {}

const std::u16string& PasswordGenerationPopupControllerImpl::password() const {}

std::u16string PasswordGenerationPopupControllerImpl::SuggestedText() const {}

const std::u16string& PasswordGenerationPopupControllerImpl::HelpText() const {}