phone_hub_interstitial_view.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_PHONE_HUB_INTERSTITIAL_VIEW_H_
  5. #define ASH_SYSTEM_PHONEHUB_PHONE_HUB_INTERSTITIAL_VIEW_H_
  6. #include <vector>
  7. #include "ash/ash_export.h"
  8. #include "ash/system/phonehub/phone_hub_content_view.h"
  9. #include "ui/base/metadata/metadata_header_macros.h"
  10. #include "ui/views/controls/progress_bar.h"
  11. #include "ui/views/view.h"
  12. namespace ui {
  13. class ImageModel;
  14. } // namespace ui
  15. namespace views {
  16. class BoxLayoutView;
  17. class Button;
  18. class ImageView;
  19. class Label;
  20. class ProgressBar;
  21. } // namespace views
  22. namespace ash {
  23. // A generic view to display interstitial pages for the Phone Hub feature with
  24. // image, text and buttons in a customized layout. It is reused by the
  25. // onboarding, loading, disconnected/reconnecting and error state UI.
  26. class ASH_EXPORT PhoneHubInterstitialView : public PhoneHubContentView {
  27. public:
  28. METADATA_HEADER(PhoneHubInterstitialView);
  29. explicit PhoneHubInterstitialView(bool show_progress, bool show_image = true);
  30. PhoneHubInterstitialView(const PhoneHubInterstitialView&) = delete;
  31. PhoneHubInterstitialView& operator=(const PhoneHubInterstitialView&) = delete;
  32. ~PhoneHubInterstitialView() override;
  33. void SetImage(const ui::ImageModel& image_model);
  34. void SetTitle(const std::u16string& title);
  35. void SetDescription(const std::u16string& desc);
  36. void AddButton(std::unique_ptr<views::Button> button);
  37. private:
  38. // A progress bar will be shown under the title row if |show_progress| is
  39. // true.
  40. views::ProgressBar* progress_bar_ = nullptr;
  41. views::ImageView* image_ = nullptr;
  42. views::Label* title_ = nullptr;
  43. views::Label* description_ = nullptr;
  44. views::BoxLayoutView* button_container_ = nullptr;
  45. };
  46. } // namespace ash
  47. #endif // ASH_SYSTEM_PHONEHUB_PHONE_HUB_INTERSTITIAL_VIEW_H_