#include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/user_metrics.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/commerce/shopping_service_factory.h"
#include "chrome/browser/favicon/favicon_utils.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/image_fetcher/image_fetcher_service_factory.h"
#include "chrome/browser/page_image_service/image_service_factory.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/browser/signin/signin_promo_util.h"
#include "chrome/browser/ui/bookmarks/bookmark_editor.h"
#include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/commerce/price_tracking_email_dialog_view.h"
#include "chrome/browser/ui/views/commerce/price_tracking_view.h"
#include "chrome/browser/ui/views/commerce/shopping_collection_iph_view.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/common/bookmark_metrics.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/metrics/metrics_utils.h"
#include "components/commerce/core/price_tracking_utils.h"
#include "components/commerce/core/shopping_service.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/tracker.h"
#include "components/image_fetcher/core/image_fetcher.h"
#include "components/image_fetcher/core/image_fetcher_service.h"
#include "components/page_image_service/image_service.h"
#include "components/signin/public/base/signin_buildflags.h"
#include "components/signin/public/base/signin_metrics.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/dialog_model.h"
#include "ui/base/models/image_model.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/views/bubble/bubble_dialog_model_host.h"
#include "ui/views/controls/styled_label.h"
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ui/views/promos/bubble_signin_promo_view.h"
#endif
UserMetricsAction;
BookmarkModel;
BookmarkNode;
views::BubbleDialogDelegate* BookmarkBubbleView::bookmark_bubble_ = …;
DEFINE_ELEMENT_IDENTIFIER_VALUE(kBookmarkBubbleOkButtonId);
DEFINE_ELEMENT_IDENTIFIER_VALUE(kBookmarkFolderFieldId);
DEFINE_ELEMENT_IDENTIFIER_VALUE(kBookmarkNameFieldId);
DEFINE_ELEMENT_IDENTIFIER_VALUE(kBookmarkSecondaryButtonId);
namespace {
void FetchImageForUrl(const GURL& url, Profile* profile) { … }
gfx::ImageSkia GetFaviconForWebContents(content::WebContents* web_contents) { … }
base::OnceCallback<void()> CreatePriceTrackingEmailCallback(
Profile* profile,
views::View* anchor_view,
content::WebContents* web_contents,
const bookmarks::BookmarkNode* bookmark) { … }
bool ShouldShowShoppingCollectionFootnote(Profile* profile,
bookmarks::BookmarkModel* model,
const bookmarks::BookmarkNode* node) { … }
}
class BookmarkBubbleView::BookmarkBubbleDelegate
: public ui::DialogModelDelegate { … };
void BookmarkBubbleView::ShowBubble(
views::View* anchor_view,
content::WebContents* web_contents,
views::Button* highlighted_button,
std::unique_ptr<BubbleSignInPromoDelegate> delegate,
Browser* browser,
const GURL& url,
bool already_bookmarked) { … }
void BookmarkBubbleView::Hide() { … }
void BookmarkBubbleView::HandleImageUrlResponse(const Profile* profile,
const GURL& image_service_url) { … }
void BookmarkBubbleView::HandleImageBytesResponse(
const gfx::Image& image,
const image_fetcher::RequestMetadata& metadata) { … }