#ifndef UI_VIEWS_BUBBLE_INFO_BUBBLE_H_
#define UI_VIEWS_BUBBLE_INFO_BUBBLE_H_
#include <memory>
#include <string>
#include "base/memory/raw_ptr.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
namespace views {
class InfoBubbleFrame;
class Label;
class VIEWS_EXPORT InfoBubble : public BubbleDialogDelegateView {
METADATA_HEADER(InfoBubble, BubbleDialogDelegateView)
public:
InfoBubble(View* anchor,
BubbleBorder::Arrow arrow,
const std::u16string& message);
InfoBubble(const InfoBubble&) = delete;
InfoBubble& operator=(const InfoBubble&) = delete;
~InfoBubble() override;
void Show();
void Hide();
std::unique_ptr<FrameView> CreateFrameView(Widget* widget) override;
gfx::Size CalculatePreferredSize(
const SizeBounds& available_size) const override;
void OnWidgetBoundsChanged(Widget* widget,
const gfx::Rect& new_bounds) override;
void set_preferred_width(int preferred_width) {
preferred_width_ = preferred_width;
}
const Label* label_for_testing() const { return label_; }
private:
void UpdatePosition();
raw_ptr<InfoBubbleFrame> frame_ = nullptr;
raw_ptr<Label> label_ = nullptr;
int preferred_width_ = 0;
};
}
#endif