chromium/ui/views/corewm/tooltip_controller.cc

// Copyright 2012 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/corewm/tooltip_controller.h"

#include <stddef.h>

#include <string_view>
#include <utility>
#include <vector>

#include "base/time/time.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_type.h"
#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/views/corewm/tooltip_state_manager.h"
#include "ui/views/widget/tooltip_manager.h"
#include "ui/wm/public/activation_client.h"
#include "ui/wm/public/tooltip_observer.h"

namespace views::corewm {
namespace {

constexpr auto kDefaultShowTooltipDelay =;
constexpr auto kDefaultHideTooltipDelay =;

// Returns true if |target| is a valid window to get the tooltip from.
// |event_target| is the original target from the event and |target| the window
// at the same location.
bool IsValidTarget(aura::Window* event_target, aura::Window* target) {}

// Returns the target (the Window tooltip text comes from) based on the event.
// If a Window other than event.target() is returned, |location| is adjusted
// to be in the coordinates of the returned Window.
aura::Window* GetTooltipTarget(const ui::MouseEvent& event,
                               gfx::Point* location) {}

}  // namespace

////////////////////////////////////////////////////////////////////////////////
// TooltipController public:

TooltipController::TooltipController(std::unique_ptr<Tooltip> tooltip,
                                     wm::ActivationClient* activation_client)
    :{}

TooltipController::~TooltipController() {}

void TooltipController::AddObserver(wm::TooltipObserver* observer) {}

void TooltipController::RemoveObserver(wm::TooltipObserver* observer) {}

int TooltipController::GetMaxWidth(const gfx::Point& location) const {}

void TooltipController::UpdateTooltip(aura::Window* target) {}

void TooltipController::UpdateTooltipFromKeyboard(const gfx::Rect& bounds,
                                                  aura::Window* target) {}

void TooltipController::UpdateTooltipFromKeyboardWithAnchorPoint(
    const gfx::Point& anchor_point,
    aura::Window* target) {}

bool TooltipController::IsTooltipSetFromKeyboard(aura::Window* target) {}

void TooltipController::SetHideTooltipTimeout(aura::Window* target,
                                              base::TimeDelta timeout) {}

void TooltipController::SetTooltipsEnabled(bool enable) {}

void TooltipController::OnKeyEvent(ui::KeyEvent* event) {}

// TODO(crbug.com/40285439): Figure out why we have code both here and
// in DesktopNativeWidgetAura to handle mouse (and key?) events. Seems like we
// should only need one set of them.
void TooltipController::OnMouseEvent(ui::MouseEvent* event) {}

void TooltipController::OnTouchEvent(ui::TouchEvent* event) {}

void TooltipController::OnCancelMode(ui::CancelModeEvent* event) {}

std::string_view TooltipController::GetLogContext() const {}

void TooltipController::OnCursorVisibilityChanged(bool is_visible) {}

void TooltipController::OnWindowVisibilityChanged(aura::Window* window,
                                                  bool visible) {}

void TooltipController::OnWindowDestroying(aura::Window* window) {}

void TooltipController::OnWindowDestroyed(aura::Window* window) {}

void TooltipController::OnWindowPropertyChanged(aura::Window* window,
                                                const void* key,
                                                intptr_t old) {}

void TooltipController::OnWindowActivated(ActivationReason reason,
                                          aura::Window* gained_active,
                                          aura::Window* lost_active) {}

void TooltipController::SetShowTooltipDelay(aura::Window* target,
                                            base::TimeDelta delay) {}

#if BUILDFLAG(IS_CHROMEOS_LACROS)
void TooltipController::OnTooltipShownOnServer(aura::Window* window,
                                               const std::u16string& text,
                                               const gfx::Rect& bounds) {
  state_manager_->OnTooltipShownOnServer(window, text, bounds);
}

void TooltipController::OnTooltipHiddenOnServer() {
  state_manager_->OnTooltipHiddenOnServer();
}
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

////////////////////////////////////////////////////////////////////////////////
// TooltipController private:

void TooltipController::HideAndReset() {}

void TooltipController::UpdateIfRequired(TooltipTrigger trigger) {}

bool TooltipController::IsDragDropInProgress() const {}

bool TooltipController::IsCursorVisible() const {}

base::TimeDelta TooltipController::GetShowTooltipDelay() {}

base::TimeDelta TooltipController::GetHideTooltipDelay() {}

void TooltipController::SetObservedWindow(aura::Window* target) {}

bool TooltipController::IsTooltipIdUpdateNeeded() const {}

bool TooltipController::IsTooltipTextUpdateNeeded() const {}

void TooltipController::RemoveTooltipDelayFromMap(aura::Window* window) {}

void TooltipController::ResetWindowAtMousePressedIfNeeded(aura::Window* target,
                                                          bool force_reset) {}

// TODO(bebeaudr): This approach is less than ideal. It looks at the tooltip
// text at the moment the mouse was pressed to determine whether or not we are
// on the same tooltip as before. This cause problems when two elements are next
// to each other and have the same text - unlikely, but an issue nonetheless.
// However, this is currently the nearest we can get since we don't have an
// identifier of the renderer side element that triggered the tooltip. Could we
// pass a renderer element unique id alongside the tooltip text?
bool TooltipController::ShouldHideBecauseMouseWasOncePressed() {}

bool TooltipController::IsDuplicatePenHoverEvent(
    ui::EventPointerType pointer_type) {}

}  // namespace views::corewm