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
ash / system / network / network_list_mobile_header_view.cc [blame]
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/network/network_list_mobile_header_view.h"
#include "ash/ash_element_identifiers.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/network/network_list_network_header_view.h"
#include "ash/system/tray/hover_highlight_view.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/views/view_class_properties.h"
namespace ash {
NetworkListMobileHeaderView::NetworkListMobileHeaderView(
NetworkListNetworkHeaderView::Delegate* delegate)
: NetworkListNetworkHeaderView(delegate,
IDS_ASH_STATUS_TRAY_NETWORK_MOBILE,
kUnifiedMenuSignalCellular0Icon) {
toggle()->SetProperty(views::kElementIdentifierKey,
kNetworkDetailedViewMobileDataToggleElementId);
}
NetworkListMobileHeaderView::~NetworkListMobileHeaderView() = default;
void NetworkListMobileHeaderView::SetToggleState(bool enabled,
bool is_on,
bool animate_toggle) {
std::u16string tooltip_text = l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_TOGGLE_MOBILE,
l10n_util::GetStringUTF16(
is_on ? IDS_ASH_STATUS_TRAY_NETWORK_MOBILE_ENABLED
: IDS_ASH_STATUS_TRAY_NETWORK_MOBILE_DISABLED));
entry_row()->SetTooltipText(tooltip_text);
toggle()->SetTooltipText(tooltip_text);
NetworkListNetworkHeaderView::SetToggleState(enabled, is_on, animate_toggle);
}
void NetworkListMobileHeaderView::OnToggleToggled(bool is_on) {
delegate()->OnMobileToggleClicked(is_on);
}
BEGIN_METADATA(NetworkListMobileHeaderView)
END_METADATA
} // namespace ash