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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
ash / wm / overview / birch / birch_chip_loader_view.h [blame]
// Copyright 2024 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_WM_OVERVIEW_BIRCH_BIRCH_CHIP_LOADER_VIEW_H_
#define ASH_WM_OVERVIEW_BIRCH_BIRCH_CHIP_LOADER_VIEW_H_
#include "ash/wm/overview/birch/birch_chip_button_base.h"
#include "base/time/time.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/animation/animation_builder.h"
#include "ui/views/metadata/view_factory.h"
namespace ash {
// When entering an informed restore session and customizing suggestion types to
// show, the birch bar needs to fetch data from the model. While waiting for the
// data, the loader views will show on the birch bar with corresponding fading
// in and out animations.
class BirchChipLoaderView : public BirchChipButtonBase {
METADATA_HEADER(BirchChipLoaderView, BirchChipButtonBase)
public:
enum class Type {
kInit, // Used during loading for informed restore.
kReload, // Used when suggestions are customized by user.
kNone,
};
BirchChipLoaderView();
BirchChipLoaderView(const BirchChipLoaderView&) = delete;
BirchChipLoaderView& operator=(const BirchChipLoaderView&) = delete;
~BirchChipLoaderView() override;
// Sets the delay for loading animation.
void SetDelay(const base::TimeDelta& delay);
// Sets the loading type.
void SetType(Type type);
// Adds the loading animation to given animation builder.
void AddAnimationToBuilder(views::AnimationBuilder& builder);
// BirchChipButtonBase:
void Init(BirchItem* item) override;
const BirchItem* GetItem() const override;
BirchItem* GetItem() override;
void Shutdown() override;
private:
base::TimeDelta delay_;
Type type_ = Type::kNone;
};
BEGIN_VIEW_BUILDER(/*no export*/, BirchChipLoaderView, BirchChipButtonBase)
VIEW_BUILDER_PROPERTY(const base::TimeDelta&, Delay)
VIEW_BUILDER_PROPERTY(BirchChipLoaderView::Type, Type)
END_VIEW_BUILDER
} // namespace ash
DEFINE_VIEW_BUILDER(/*no export*/, ash::BirchChipLoaderView)
#endif // ASH_WM_OVERVIEW_BIRCH_BIRCH_CHIP_LOADER_VIEW_H_