#include "chrome/browser/ui/views/find_bar_host.h"
#include <algorithm>
#include "base/check_is_test.h"
#include "base/i18n/rtl.h"
#include "build/build_config.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/find_bar_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/theme_copying_widget.h"
#include "components/find_in_page/find_tab_helper.h"
#include "components/find_in_page/find_types.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/compositor/layer.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/border.h"
#include "ui/views/focus/external_focus_tracker.h"
#include "ui/views/widget/root_view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#endif
#if defined(IS_AURA)
#include "ui/aura/window.h"
#include "ui/views/view_constants_aura.h"
#endif
NativeWebKeyboardEvent;
namespace …
FindBarHost::FindBarHost(BrowserView* browser_view)
: … { … }
FindBarHost::~FindBarHost() { … }
bool FindBarHost::MaybeForwardKeyEventToWebpage(
const ui::KeyEvent& key_event) { … }
bool FindBarHost::IsVisible() const { … }
#if BUILDFLAG(IS_MAC)
views::Widget* FindBarHost::GetHostWidget() {
return host_.get();
}
#endif
FindBarController* FindBarHost::GetFindBarController() const { … }
void FindBarHost::SetFindBarController(FindBarController* find_bar_controller) { … }
void FindBarHost::Show(bool animate) { … }
void FindBarHost::Hide(bool animate) { … }
void FindBarHost::SetFocusAndSelection() { … }
void FindBarHost::ClearResults(
const find_in_page::FindNotificationDetails& results) { … }
void FindBarHost::StopAnimation() { … }
void FindBarHost::MoveWindowIfNecessary() { … }
void FindBarHost::SetFindTextAndSelectedRange(
const std::u16string& find_text,
const gfx::Range& selected_range) { … }
std::u16string FindBarHost::GetFindText() const { … }
gfx::Range FindBarHost::GetSelectedRange() const { … }
void FindBarHost::UpdateUIForFindResult(
const find_in_page::FindNotificationDetails& result,
const std::u16string& find_text) { … }
void FindBarHost::AudibleAlert() { … }
bool FindBarHost::IsFindBarVisible() const { … }
void FindBarHost::RestoreSavedFocus() { … }
bool FindBarHost::HasGlobalFindPasteboard() const { … }
void FindBarHost::UpdateFindBarForChangedWebContents() { … }
const FindBarTesting* FindBarHost::GetFindBarTesting() const { … }
bool FindBarHost::AcceleratorPressed(const ui::Accelerator& accelerator) { … }
bool FindBarHost::CanHandleAccelerators() const { … }
bool FindBarHost::GetFindBarWindowInfo(gfx::Point* position,
bool* fully_visible) const { … }
std::u16string FindBarHost::GetFindSelectedText() const { … }
std::u16string FindBarHost::GetMatchCountText() const { … }
int FindBarHost::GetContentsWidth() const { … }
size_t FindBarHost::GetAudibleAlertCount() const { … }
std::u16string FindBarHost::GetAccessibleWindowTitle() const { … }
FindBarView* FindBarHost::GetFindBarViewForTesting() { … }
void FindBarHost::SetEnableAnimationsForTesting(bool enable_animations) { … }
void FindBarHost::GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect) { … }
void FindBarHost::MoveWindowIfNecessaryWithRect(
const gfx::Rect& selection_rect) { … }
void FindBarHost::SaveFocusTracker() { … }
void FindBarHost::RestoreOrCreateFocusTracker() { … }
void FindBarHost::OnVisibilityChanged() { … }
void FindBarHost::RegisterAccelerators() { … }
void FindBarHost::UnregisterAccelerators() { … }
gfx::Rect FindBarHost::GetDialogPosition(gfx::Rect avoid_overlapping_rect) { … }
void FindBarHost::SetDialogPosition(const gfx::Rect& new_pos) { … }
void FindBarHost::OnWillChangeFocus(views::View* focused_before,
views::View* focused_now) { … }
void FindBarHost::OnDidChangeFocus(views::View* focused_before,
views::View* focused_now) { … }
void FindBarHost::AnimationProgressed(const gfx::Animation* animation) { … }
void FindBarHost::AnimationEnded(const gfx::Animation* animation) { … }