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
ash / system / phonehub / quick_actions_view.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_SYSTEM_PHONEHUB_QUICK_ACTIONS_VIEW_H_
#define ASH_SYSTEM_PHONEHUB_QUICK_ACTIONS_VIEW_H_
#include "ash/ash_export.h"
#include "base/memory/raw_ptr.h"
#include "chromeos/ash/components/phonehub/phone_hub_manager.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/view.h"
namespace ash {
class QuickActionControllerBase;
class QuickActionItem;
// A view in Phone Hub bubble that contains toggle button for quick actions such
// as enable hotspot, silence phone and locate phone.
class ASH_EXPORT QuickActionsView : public views::View {
METADATA_HEADER(QuickActionsView, views::View)
public:
explicit QuickActionsView(phonehub::PhoneHubManager* phone_hub_manager);
~QuickActionsView() override;
QuickActionsView(QuickActionsView&) = delete;
QuickActionsView operator=(QuickActionsView&) = delete;
// Return enable_hotspot to start tethering from Phone
// Hub error dialog.
QuickActionItem* GetEnableHotspotQuickActionItem() { return enable_hotspot_; }
// Used for testing only
QuickActionItem* silence_phone_for_testing() { return silence_phone_; }
QuickActionItem* locate_phone_for_testing() { return locate_phone_; }
void OnThemeChanged() override;
private:
// Add all the quick actions items to the view.
void InitQuickActionItems();
// Controllers of quick actions items. Owned by this.
std::vector<std::unique_ptr<QuickActionControllerBase>>
quick_action_controllers_;
raw_ptr<phonehub::PhoneHubManager> phone_hub_manager_ = nullptr;
// QuickActionItem for unit testing. Owned by this view.
raw_ptr<QuickActionItem> enable_hotspot_ = nullptr;
raw_ptr<QuickActionItem> silence_phone_ = nullptr;
raw_ptr<QuickActionItem> locate_phone_ = nullptr;
};
} // namespace ash
#endif // ASH_SYSTEM_PHONEHUB_QUICK_ACTIONS_VIEW_H_