chromium/ui/views/corewm/tooltip_state_manager.cc

// Copyright 2021 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_state_manager.h"

#include <stddef.h>

#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/text_elider.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/wm/public/tooltip_client.h"
#include "ui/wm/public/tooltip_observer.h"

namespace views::corewm {
namespace {

#if BUILDFLAG(IS_WIN)
// Drawing a long word in tooltip is very slow on Windows. crbug.com/513693
constexpr size_t kMaxTooltipLength = 1024;
#else
constexpr size_t kMaxTooltipLength =;
#endif

}  // namespace

TooltipStateManager::TooltipStateManager(std::unique_ptr<Tooltip> tooltip)
    :{}

TooltipStateManager::~TooltipStateManager() = default;

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

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

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

void TooltipStateManager::HideAndReset() {}

void TooltipStateManager::Show(aura::Window* window,
                               const std::u16string& tooltip_text,
                               const gfx::Point& position,
                               TooltipTrigger trigger,
                               const base::TimeDelta show_delay,
                               const base::TimeDelta hide_delay) {}

void TooltipStateManager::UpdatePositionIfNeeded(const gfx::Point& position,
                                                 TooltipTrigger trigger) {}

#if BUILDFLAG(IS_CHROMEOS_LACROS)
void TooltipStateManager::OnTooltipShownOnServer(aura::Window* window,
                                                 const std::u16string& text,
                                                 const gfx::Rect& bounds) {
  tooltip_id_ = wm::GetTooltipId(window);
  tooltip_parent_window_ = window;
  tooltip_->OnTooltipShownOnServer(text, bounds);
}

void TooltipStateManager::OnTooltipHiddenOnServer() {
  tooltip_id_ = nullptr;
  tooltip_parent_window_ = nullptr;
  tooltip_->OnTooltipHiddenOnServer();
}
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

void TooltipStateManager::ShowNow(const std::u16string& trimmed_text,
                                  const base::TimeDelta hide_delay) {}

void TooltipStateManager::StartWillShowTooltipTimer(
    const std::u16string& trimmed_text,
    const base::TimeDelta show_delay,
    const base::TimeDelta hide_delay) {}

}  // namespace views::corewm