#ifndef ASH_ANNOTATOR_ANNOTATION_TRAY_H_
#define ASH_ANNOTATOR_ANNOTATION_TRAY_H_
#include "ash/public/cpp/session/session_observer.h"
#include "ash/session/session_controller_impl.h"
#include "ash/system/tray/tray_background_view.h"
#include "ash/system/tray/view_click_listener.h"
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "ui/base/metadata/metadata_header_macros.h"
namespace ui {
class GestureEvent;
}
namespace views {
class ImageView;
class Widget;
}
namespace ash {
class HoverHighlightView;
class TrayBubbleWrapper;
constexpr SkColor kAnnotatorMagentaPenColor = SkColorSetRGB(0xFF, 0x00, 0xE5);
constexpr SkColor kAnnotatorRedPenColor = SkColorSetRGB(0xE9, 0x42, 0x35);
constexpr SkColor kAnnotatorYellowPenColor = SkColorSetRGB(0xFB, 0xF1, 0x04);
constexpr SkColor kAnnotatorBluePenColor = SkColorSetRGB(0x42, 0x85, 0xF4);
constexpr SkColor kAnnotatorDefaultPenColor = kAnnotatorMagentaPenColor;
class AnnotationTray : public TrayBackgroundView,
public SessionObserver {
METADATA_HEADER(AnnotationTray, TrayBackgroundView)
public:
explicit AnnotationTray(Shelf* shelf);
AnnotationTray(const AnnotationTray&) = delete;
AnnotationTray& operator=(const AnnotationTray&) = delete;
~AnnotationTray() override;
void OnGestureEvent(ui::GestureEvent* event) override;
void ClickedOutsideBubble(const ui::LocatedEvent& event) override;
void UpdateTrayItemColor(bool is_active) override;
void HandleLocaleChange() override;
void HideBubbleWithView(const TrayBubbleView* bubble_view) override;
void CloseBubbleInternal() override;
void ShowBubble() override;
TrayBubbleView* GetBubbleView() override;
views::Widget* GetBubbleWidget() const override;
void OnThemeChanged() override;
void HideBubble(const TrayBubbleView* bubble_view) override;
std::u16string GetAccessibleNameForBubble() override;
void OnActiveUserPrefServiceChanged(PrefService* pref_service) override;
void OnTrayButtonPressed(const ui::Event& event);
void HideAnnotationTray();
void SetTrayEnabled(bool enabled);
void ToggleAnnotator();
void UpdateAccessibleName(bool is_annotator_enabled);
private:
void EnableAnnotatorWithPenColor();
void DeactivateActiveTool();
void UpdateIcon();
void OnPenColorPressed(SkColor color);
int GetAccessibleNameForColor(SkColor color);
void ResetTray();
std::u16string GetTooltip();
void SetIconImage(bool is_active);
const raw_ptr<views::ImageView> image_view_;
raw_ptr<HoverHighlightView> pen_view_;
std::unique_ptr<TrayBubbleWrapper> bubble_;
SkColor current_pen_color_ = kAnnotatorDefaultPenColor;
base::ScopedObservation<SessionControllerImpl, SessionObserver>
session_observer_{this};
};
}
#endif