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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
ash / public / cpp / nearby_share_delegate.h [blame]
// Copyright 2020 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_PUBLIC_CPP_NEARBY_SHARE_DELEGATE_H_
#define ASH_PUBLIC_CPP_NEARBY_SHARE_DELEGATE_H_
#include "ash/public/cpp/ash_public_export.h"
#include "base/observer_list_types.h"
#include "chromeos/ash/services/nearby/public/mojom/nearby_share_settings.mojom.h"
namespace base {
class TimeTicks;
} // namespace base
namespace gfx {
struct VectorIcon;
} // namespace gfx
namespace ash {
// This delegate is a singleton used by the
// NearbyShareVisibilityFeaturePodButton in //ash to communicate with the
// NearbySharingService KeyedService in //chrome.
class ASH_PUBLIC_EXPORT NearbyShareDelegate {
public:
virtual ~NearbyShareDelegate() = default;
// Used to determine if NearbyShare has been enabled in the settings app.
virtual bool IsEnabled() = 0;
// Used to enable/disable Quick Share (formerly Nearby Share) in the settings
// app.
virtual void SetEnabled(bool enabled) = 0;
// Used by the pod button to determine whether it should be visible.
virtual bool IsPodButtonVisible() = 0;
// Gets the current high visibility state from the NearbySharingService.
virtual bool IsHighVisibilityOn() = 0;
// Returns true if EnableHighVisibility() has been called but
// NearbyShareDelegate has not yet been informed that the request has
// concluded.
virtual bool IsEnableHighVisibilityRequestActive() const = 0;
// If high visibility is on, returns the time when the delegate
// will turn it off. May return any value if high visibility is off.
virtual base::TimeTicks HighVisibilityShutoffTime() const = 0;
// Request high visibility be turned on. If Nearby Share is disabled in prefs,
// this will instead redirect the user to onboarding.
virtual void EnableHighVisibility() = 0;
// Request high visibility be turned off.
virtual void DisableHighVisibility() = 0;
// Open the settings page for Nearby Share, Used when the user clicks on the
// label under the pod button.
virtual void ShowNearbyShareSettings() const = 0;
// Returns the icon for Nearby Share. Used by the pod button to
// display the icon, where `on_icon`=false will return the alternative icon
// for when the feature is off. Caller should check if the icon is_empty
// before using.
virtual const gfx::VectorIcon& GetIcon(bool on_icon) const = 0;
// Returns the feature name which will be used in feature name placeholder
// strings, or the empty string if on a non-chrome branded build or the
// feature flag is disabled.
virtual std::u16string GetPlaceholderFeatureName() const = 0;
// Returns the device's current Visibility.
virtual ::nearby_share::mojom::Visibility GetVisibility() const = 0;
// Sets the device's Visibility.
virtual void SetVisibility(::nearby_share::mojom::Visibility visibility) = 0;
};
} // namespace ash
#endif // ASH_PUBLIC_CPP_NEARBY_SHARE_DELEGATE_H_