#include "chrome/browser/ui/views/find_bar_view.h"
#include <algorithm>
#include <utility>
#include "base/feature_list.h"
#include "base/i18n/number_formatting.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/find_bar/find_bar_state.h"
#include "chrome/browser/ui/find_bar/find_bar_state_factory.h"
#include "chrome/browser/ui/lens/lens_overlay_controller.h"
#include "chrome/browser/ui/lens/lens_overlay_entry_point_controller.h"
#include "chrome/browser/ui/lens/lens_overlay_invocation_source.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/find_bar_host.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/user_education/user_education_service.h"
#include "chrome/grit/generated_resources.h"
#include "components/find_in_page/find_notification_details.h"
#include "components/find_in_page/find_tab_helper.h"
#include "components/find_in_page/find_types.h"
#include "components/lens/lens_features.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/text_input_flags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/theme_provider.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/events/event.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/bubble/bubble_border.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/separator.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/painter.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/views_features.h"
#include "ui/views/widget/widget.h"
namespace {
void SetCommonButtonAttributes(views::ImageButton* button) { … }
}
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(FindBarView, kElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(FindBarView, kTextField);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(FindBarView, kPreviousButtonElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(FindBarView, kNextButtonElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(FindBarView, kCloseButtonElementId);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(FindBarView, kLensButtonElementId);
class FindBarMatchCountLabel : public views::Label { … };
BEGIN_VIEW_BUILDER(, FindBarMatchCountLabel, views::Label)
END_VIEW_BUILDER
DEFINE_VIEW_BUILDER(…)
BEGIN_METADATA(…)
FindBarView::FindBarView(FindBarHost* host) { … }
FindBarView::~FindBarView() { … }
void FindBarView::SetHost(FindBarHost* host) { … }
void FindBarView::SetFindTextAndSelectedRange(
const std::u16string& find_text,
const gfx::Range& selected_range) { … }
std::u16string FindBarView::GetFindText() const { … }
gfx::Range FindBarView::GetSelectedRange() const { … }
std::u16string FindBarView::GetFindSelectedText() const { … }
std::u16string FindBarView::GetMatchCountText() const { … }
void FindBarView::UpdateForResult(
const find_in_page::FindNotificationDetails& result,
const std::u16string& find_text) { … }
void FindBarView::ClearMatchCount() { … }
bool FindBarView::OnMousePressed(const ui::MouseEvent& event) { … }
gfx::Size FindBarView::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
void FindBarView::FocusAndSelectAll() { … }
bool FindBarView::HandleKeyEvent(views::Textfield* sender,
const ui::KeyEvent& key_event) { … }
void FindBarView::OnAfterUserAction(views::Textfield* sender) { … }
void FindBarView::OnAfterPaste() { … }
void FindBarView::Find(const std::u16string& search_text) { … }
void FindBarView::FindNext(bool reverse) { … }
void FindBarView::EndFindSession() { … }
void FindBarView::UpdateMatchCountAppearance(bool no_match) { … }
void FindBarView::OnThemeChanged() { … }
void FindBarView::UpdateLensButtonVisibility(
const std::u16string& search_text) { … }
int FindBarView::GetLensOverlayFindBarMessageIds() { … }
int FindBarView::GetLensOverlayFindBarButtonLabelIds() { … }
BEGIN_METADATA(…)