chromium/ui/views/controls/editable_combobox/editable_combobox.cc

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

#include "ui/views/controls/editable_combobox/editable_combobox.h"

#include <algorithm>
#include <memory>
#include <string>
#include <vector>

#include "base/callback_list.h"
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/menu_source_utils.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/combobox_model.h"
#include "ui/base/models/combobox_model_observer.h"
#include "ui/base/models/menu_model.h"
#include "ui/base/models/menu_separator_types.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_types.h"
#include "ui/color/color_provider.h"
#include "ui/events/event.h"
#include "ui/events/types/event_type.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/range/range.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_host.h"
#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/animation/ink_drop_ripple.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/button_controller.h"
#include "ui/views/controls/combobox/combobox_util.h"
#include "ui/views/controls/combobox/empty_combobox_model.h"
#include "ui/views/controls/menu/menu_config.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/menu/menu_types.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/box_layout_view.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/layout_manager.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/style/typography.h"
#include "ui/views/style/typography_provider.h"
#include "ui/views/vector_icons.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"

namespace views {

namespace {

int kEditableComboboxButtonSize =;
int kEditableComboboxControlsContainerInsets =;

class Arrow : public Button {};

BEGIN_METADATA()

}  // namespace

std::u16string EditableCombobox::MenuDecorationStrategy::DecorateItemText(
    std::u16string text) const {}

// Adapts a ui::ComboboxModel to a ui::MenuModel to be used by EditableCombobox.
// Also provides a filtering capability.
class EditableCombobox::EditableComboboxMenuModel final
    : public ui::MenuModel,
      public ui::ComboboxModelObserver {};

// This class adds itself as the pre-target handler for the RootView of the
// EditableCombobox. We use it to close the menu when press events happen in the
// RootView but not inside the EditableComboobox's textfield.
class EditableCombobox::EditableComboboxPreTargetHandler
    : public ui::EventHandler {};

EditableCombobox::EditableCombobox()
    :{}

EditableCombobox::EditableCombobox(
    std::unique_ptr<ui::ComboboxModel> combobox_model,
    const bool filter_on_edit,
    const bool show_on_empty,
    const int text_context,
    const int text_style,
    const bool display_arrow)
    :{}

EditableCombobox::~EditableCombobox() {}

void EditableCombobox::SetModel(std::unique_ptr<ui::ComboboxModel> model) {}

const std::u16string& EditableCombobox::GetText() const {}

void EditableCombobox::SetText(const std::u16string& text) {}

const std::u16string& EditableCombobox::GetPlaceholderText() const {}

void EditableCombobox::SetPlaceholderText(const std::u16string& text) {}

const gfx::FontList& EditableCombobox::GetFontList() const {}

void EditableCombobox::SelectRange(const gfx::Range& range) {}

void EditableCombobox::OnAccessibleNameChanged(const std::u16string& new_name) {}

void EditableCombobox::SetMenuDecorationStrategy(
    std::unique_ptr<MenuDecorationStrategy> strategy) {}

void EditableCombobox::UpdateMenu() {}

void EditableCombobox::RequestFocus() {}

bool EditableCombobox::GetNeedsNotificationWhenVisibleBoundsChange() const {}

void EditableCombobox::OnVisibleBoundsChanged() {}

void EditableCombobox::ContentsChanged(Textfield* sender,
                                       const std::u16string& new_contents) {}

bool EditableCombobox::HandleKeyEvent(Textfield* sender,
                                      const ui::KeyEvent& key_event) {}

void EditableCombobox::OnViewBlurred(View* observed_view) {}

void EditableCombobox::OnLayoutIsAnimatingChanged(
    views::AnimatingLayoutManager* source,
    bool is_animating) {}

// TODO(crbug.com/329471666): Refactor Textfield to obviate the need for this.
ProposedLayout EditableCombobox::CalculateProposedLayout(
    const SizeBounds& size_bounds) const {}

bool EditableCombobox::ShouldApplyInkDropEffects() {}

void EditableCombobox::CloseMenu() {}

void EditableCombobox::OnItemSelected(size_t index) {}

void EditableCombobox::HandleNewContent(const std::u16string& new_content) {}

void EditableCombobox::ArrowButtonPressed(const ui::Event& event) {}

void EditableCombobox::ShowDropDownMenu(ui::MenuSourceType source_type) {}

void EditableCombobox::UpdateTextfieldInsets() {}

const ui::MenuModel* EditableCombobox::GetMenuModelForTesting() const {}

std::u16string EditableCombobox::GetItemTextForTesting(size_t index) const {}

const ui::ComboboxModel* EditableCombobox::GetComboboxModel() const {}

BEGIN_METADATA()

}  // namespace views