chromium/chrome/browser/ui/views/bookmarks/bookmark_button.cc

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

#include "chrome/browser/ui/views/bookmarks/bookmark_button.h"

#include "base/metrics/histogram_functions.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/predictors/loading_predictor.h"
#include "chrome/browser/predictors/loading_predictor_config.h"
#include "chrome/browser/predictors/loading_predictor_factory.h"
#include "chrome/browser/preloading/chrome_preloading.h"
#include "chrome/browser/preloading/prerender/prerender_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_button_util.h"
#include "chrome/browser/ui/views/event_utils.h"
#include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/navigation_handle.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_features.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/widget/tooltip_manager.h"

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class PreloadBookmarkMetricsEvent {};

// These are used as control the behavior of kBookmarkTriggerForPrerender2.
const base::FeatureParam<int> kPreconnectStartDelayOnMouseHoverByMiliseconds{};
const base::FeatureParam<int> kPrerenderStartDelayOnMouseHoverByMiliseconds{};
const base::FeatureParam<bool> kPrerenderBookmarkBarOnMousePressedTrigger{};
// The hover trigger is not enabled as we are aware that this negatively
// affects other navigations like Omnibox search.
const base::FeatureParam<bool> kPrerenderBookmarkBarOnMouseHoverTrigger{};

// BookmarkButtonBase -----------------------------------------------

// Base class for non-menu hosting buttons used on the bookmark bar.

BookmarkButtonBase::BookmarkButtonBase(PressedCallback callback,
                                       const std::u16string& title)
    :{}

BookmarkButtonBase::~BookmarkButtonBase() = default;

views::View* BookmarkButtonBase::GetTooltipHandlerForPoint(
    const gfx::Point& point) {}

bool BookmarkButtonBase::IsTriggerableEvent(const ui::Event& e) {}

std::unique_ptr<views::LabelButtonBorder>
BookmarkButtonBase::CreateDefaultBorder() const {}

void BookmarkButtonBase::GetAccessibleNodeData(ui::AXNodeData* node_data) {}

BEGIN_METADATA()
// BookmarkButton -------------------------------------------------------------

// Buttons used for the bookmarks on the bookmark bar.
BookmarkButton::BookmarkButton(PressedCallback callback,
                               const GURL& url,
                               const std::u16string& title,
                               const raw_ptr<Browser> browser)
    :{}

BookmarkButton::~BookmarkButton() = default;

std::u16string BookmarkButton::GetTooltipText(const gfx::Point& p) const {}

void BookmarkButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {}

void BookmarkButton::AdjustAccessibleName(std::u16string& new_name,
                                          ax::mojom::NameFrom& name_from) {}

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

void BookmarkButton::OnMouseEntered(const ui::MouseEvent& event) {}

void BookmarkButton::OnMouseExited(const ui::MouseEvent& event) {}

bool BookmarkButton::OnMousePressed(const ui::MouseEvent& event) {}

void BookmarkButton::OnMouseMoved(const ui::MouseEvent& event) {}

void BookmarkButton::StartPreconnecting(GURL url) {}

void BookmarkButton::StartPrerendering(GURL url) {}

BEGIN_METADATA()