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
ash / components / arc / intent_helper / arc_icon_cache_delegate.h [blame]
// Copyright 2021 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_COMPONENTS_ARC_INTENT_HELPER_ARC_ICON_CACHE_DELEGATE_H_
#define ASH_COMPONENTS_ARC_INTENT_HELPER_ARC_ICON_CACHE_DELEGATE_H_
#include <vector>
#include "ash/components/arc/intent_helper/activity_icon_loader.h"
#include "base/memory/raw_ptr.h"
namespace arc {
// This class stores activity icon cache for ARC and provides API to handle and
// access to the cache.
class ArcIconCacheDelegate {
public:
virtual ~ArcIconCacheDelegate();
// internal::ActivityIconLoader types.
using ActivityIconLoader = internal::ActivityIconLoader;
using ActivityName = internal::ActivityIconLoader::ActivityName;
using ActivityToIconsMap = internal::ActivityIconLoader::ActivityToIconsMap;
using GetResult = internal::ActivityIconLoader::GetResult;
using OnIconsReadyCallback =
internal::ActivityIconLoader::OnIconsReadyCallback;
// Return ArcIconCacheDelegate instance.
static ArcIconCacheDelegate* GetInstance();
// Retrieves icons for the |activities| and calls |callback|.
// See internal::ActivityIconLoader::GetActivityIcons() for more details.
virtual GetResult GetActivityIcons(
const std::vector<ActivityName>& activities,
OnIconsReadyCallback callback) = 0;
};
// Provides ArcIconCacheDelegate implementation.
class ArcIconCacheDelegateProvider {
public:
explicit ArcIconCacheDelegateProvider(ArcIconCacheDelegate* delegate);
ArcIconCacheDelegateProvider(const ArcIconCacheDelegateProvider&) = delete;
ArcIconCacheDelegateProvider& operator=(const ArcIconCacheDelegateProvider&) =
delete;
~ArcIconCacheDelegateProvider();
ArcIconCacheDelegate* GetInstance();
private:
raw_ptr<ArcIconCacheDelegate> delegate_;
};
} // namespace arc
#endif // ASH_COMPONENTS_ARC_INTENT_HELPER_ARC_ICON_CACHE_DELEGATE_H_