1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37

ash / system / phonehub / phone_hub_app_loading_icon.h [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SYSTEM_PHONEHUB_PHONE_HUB_APP_LOADING_ICON_H_
#define ASH_SYSTEM_PHONEHUB_PHONE_HUB_APP_LOADING_ICON_H_

#include <optional>

#include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_app_icon.h"
#include "base/timer/timer.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/animation/animation_abort_handle.h"

namespace ash {

class ASH_EXPORT AppLoadingIcon : public AppIcon {
  METADATA_HEADER(AppLoadingIcon, AppIcon)

 public:
  explicit AppLoadingIcon(int size);
  AppLoadingIcon(const AppLoadingIcon&) = delete;
  AppLoadingIcon& operator=(const AppLoadingIcon&) = delete;
  ~AppLoadingIcon() override;

  void StartLoadingAnimation(std::optional<base::TimeDelta> initial_delay);
  void StopLoadingAnimation();

 private:
  std::unique_ptr<views::AnimationAbortHandle> animation_abort_handle_;
  base::OneShotTimer animation_initial_delay_timer_;
};

}  // namespace ash

#endif  // ASH_SYSTEM_PHONEHUB_PHONE_HUB_APP_LOADING_ICON_H_