continue_browsing_chip.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_SYSTEM_PHONEHUB_CONTINUE_BROWSING_CHIP_H_
  5. #define ASH_SYSTEM_PHONEHUB_CONTINUE_BROWSING_CHIP_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/components/phonehub/browser_tabs_model.h"
  8. #include "ui/gfx/canvas.h"
  9. #include "ui/views/controls/button/button.h"
  10. namespace ash {
  11. namespace phonehub {
  12. class UserActionRecorder;
  13. }
  14. // A chip containing a web page info (title, web URL, etc.) that users left off
  15. // from their phone.
  16. class ASH_EXPORT ContinueBrowsingChip : public views::Button {
  17. public:
  18. ContinueBrowsingChip(
  19. const phonehub::BrowserTabsModel::BrowserTabMetadata& metadata,
  20. int index,
  21. size_t total_count,
  22. phonehub::UserActionRecorder* user_action_recorder);
  23. ~ContinueBrowsingChip() override;
  24. ContinueBrowsingChip(ContinueBrowsingChip&) = delete;
  25. ContinueBrowsingChip operator=(ContinueBrowsingChip&) = delete;
  26. // views::Button:
  27. void OnPaintBackground(gfx::Canvas* canvas) override;
  28. const char* GetClassName() const override;
  29. private:
  30. void ButtonPressed();
  31. // The URL of the tab to open.
  32. GURL url_;
  33. // The index of the chip as it is ordered in the parent view.
  34. int index_;
  35. // The total number of chips in the parent view.
  36. size_t total_count_;
  37. phonehub::UserActionRecorder* user_action_recorder_ = nullptr;
  38. };
  39. } // namespace ash
  40. #endif // ASH_SYSTEM_PHONEHUB_CONTINUE_BROWSING_CHIP_H_