chromium/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc

// Copyright 2017 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/views/payments/shipping_address_editor_view_controller.h"

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
#include "chrome/browser/ui/views/payments/validating_combobox.h"
#include "chrome/browser/ui/views/payments/validating_textfield.h"
#include "chrome/grit/generated_resources.h"
#include "components/autofill/core/browser/address_data_manager.h"
#include "components/autofill/core/browser/address_normalizer.h"
#include "components/autofill/core/browser/autofill_address_util.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/geo/address_i18n.h"
#include "components/autofill/core/browser/geo/autofill_country.h"
#include "components/autofill/core/browser/geo/phone_number_i18n.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/browser/ui/country_combobox_model.h"
#include "components/autofill/core/browser/validation.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_l10n_util.h"
#include "components/payments/content/payment_request_state.h"
#include "components/payments/core/payment_request_data_util.h"
#include "components/payments/core/payments_profile_comparator.h"
#include "components/strings/grit/components_strings.h"
#include "third_party/libaddressinput/messages.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_formatter.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/controls/textfield/textfield.h"

namespace payments {
namespace {

// size_t doesn't have a defined maximum value, so this is a trick to create one
// as is done for std::string::npos.
// http://www.cplusplus.com/reference/string/string/npos
const size_t kInvalidCountryIndex =;

}  // namespace

ShippingAddressEditorViewController::ShippingAddressEditorViewController(
    base::WeakPtr<PaymentRequestSpec> spec,
    base::WeakPtr<PaymentRequestState> state,
    base::WeakPtr<PaymentRequestDialogView> dialog,
    BackNavigationType back_navigation_type,
    base::OnceClosure on_edited,
    base::OnceCallback<void(const autofill::AutofillProfile&)> on_added,
    autofill::AutofillProfile* profile,
    bool is_incognito)
    :{}

ShippingAddressEditorViewController::~ShippingAddressEditorViewController() {}

bool ShippingAddressEditorViewController::IsEditingExistingItem() {}

std::vector<EditorField>
ShippingAddressEditorViewController::GetFieldDefinitions() {}

std::u16string ShippingAddressEditorViewController::GetInitialValueForType(
    autofill::FieldType type) {}

bool ShippingAddressEditorViewController::ValidateModelAndSave() {}

std::unique_ptr<ValidationDelegate>
ShippingAddressEditorViewController::CreateValidationDelegate(
    const EditorField& field) {}

std::unique_ptr<ui::ComboboxModel>
ShippingAddressEditorViewController::GetComboboxModelForType(
    const autofill::FieldType& type) {}

void ShippingAddressEditorViewController::OnPerformAction(
    ValidatingCombobox* sender) {}

void ShippingAddressEditorViewController::UpdateEditorView() {}

std::u16string ShippingAddressEditorViewController::GetSheetTitle() {}

base::WeakPtr<PaymentRequestSheetController>
ShippingAddressEditorViewController::GetWeakPtr() {}

int ShippingAddressEditorViewController::GetPrimaryButtonId() {}

ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
    ShippingAddressValidationDelegate(
        base::WeakPtr<ShippingAddressEditorViewController> controller,
        const EditorField& field)
    :{}

ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
    ~ShippingAddressValidationDelegate() {}

bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
    ShouldFormat() {}

std::u16string
ShippingAddressEditorViewController::ShippingAddressValidationDelegate::Format(
    const std::u16string& text) {}

bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
    IsValidTextfield(views::Textfield* textfield,
                     std::u16string* error_message) {}

bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
    IsValidCombobox(ValidatingCombobox* combobox,
                    std::u16string* error_message) {}

bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
    TextfieldValueChanged(views::Textfield* textfield, bool was_blurred) {}

bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
    ComboboxValueChanged(ValidatingCombobox* combobox) {}

void ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
    ComboboxModelChanged(ValidatingCombobox* combobox) {}

bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
    ValidateValue(const std::u16string& value, std::u16string* error_message) {}

std::u16string ShippingAddressEditorViewController::GetValueForType(
    const autofill::AutofillProfile& profile,
    autofill::FieldType type) {}

bool ShippingAddressEditorViewController::GetSheetId(DialogViewID* sheet_id) {}

void ShippingAddressEditorViewController::UpdateCountries(
    autofill::CountryComboboxModel* model) {}

void ShippingAddressEditorViewController::UpdateEditorFields() {}

void ShippingAddressEditorViewController::OnDataChanged(bool synchronous) {}

bool ShippingAddressEditorViewController::SaveFieldsToProfile(
    autofill::AutofillProfile* profile,
    bool ignore_errors) {}

void ShippingAddressEditorViewController::OnComboboxModelChanged(
    ValidatingCombobox* combobox) {}

}  // namespace payments