Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2134)

Unified Diff: ash/system/tray/tray_info_label.h

Issue 2957043002: Add a row in the network tray to inform users to turn Bluetooth on to enable Tether. (Closed)
Patch Set: khorimoto@ and jamescook@ comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/tray/tray_info_label.h
diff --git a/ash/system/tray/tray_info_label.h b/ash/system/tray/tray_info_label.h
new file mode 100644
index 0000000000000000000000000000000000000000..d3b6a94a5cfd9cb5dd95252cfdc0390db9d5a941
--- /dev/null
+++ b/ash/system/tray/tray_info_label.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_
+#define ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_
+
+#include "ash/system/tray/actionable_view.h"
+#include "ui/views/controls/label.h"
+
+namespace ash {
+
+namespace test {
+class TrayInfoLabelTest;
+} // namespace test
+
+// A view containing only a label, which is to be inserted as a non-targetable
Kyle Horimoto 2017/07/12 22:45:59 What does non-targetable mean? I Googled it and di
lesliewatkins 2017/07/13 22:12:48 I didn't write that, but based on context, it may
+// row within a system menu detailed view (e.g., the "Scanning for devices..."
+// message that can appear at the top of the Bluetooth detailed view).
+// InfoLabel can be clickable if it is passed a non-null TrayDetailClickHandler
Kyle Horimoto 2017/07/12 22:45:59 How about "InfoLabel can be clickable; this proper
Kyle Horimoto 2017/07/12 22:45:59 InfoLabel --> TrayInfoLabel, TrayDetailClickHandle
lesliewatkins 2017/07/13 22:12:47 Done.
lesliewatkins 2017/07/13 22:12:48 Done.
+// in its constructructor.
+class TrayInfoLabel : public ActionableView {
+ public:
+ // A delegate for handling actions when an InfoLabel is clicked.
Kyle Horimoto 2017/07/12 22:45:59 nit: It does more than just that :)
lesliewatkins 2017/07/13 22:12:47 Changed the wording to reflect that it also determ
+ class Delegate {
+ public:
+ virtual ~Delegate(){};
+ virtual void OnLabelClicked(int message_id) = 0;
+ virtual bool LabelIsClickable(int message_id) = 0;
Kyle Horimoto 2017/07/12 22:45:59 nit: IsLabelClickable() reads better.
lesliewatkins 2017/07/13 22:12:48 Done.
+ };
+
+ // handler can be nullptr, in which case, the InfoLabel will not be
Kyle Horimoto 2017/07/12 22:45:59 handler --> delegate
Kyle Horimoto 2017/07/12 22:45:59 How about "|delegate| may be null, which results i
lesliewatkins 2017/07/13 22:12:47 Done.
lesliewatkins 2017/07/13 22:12:48 Done.
+ // clickable. Its status as clickable will be reflected in the style
+ // of the label.
+ TrayInfoLabel(Delegate* delegate, int message_id);
+ ~TrayInfoLabel() override{};
+
+ // Updates the message id, the label text, and the style if the
Kyle Horimoto 2017/07/12 22:45:59 How about: "Updates the InfoLabel to display the m
lesliewatkins 2017/07/13 22:12:48 Done.
+ // InfoLabel changes from clickable to non-clickable (or vice versa).
+ void Update(int message_id);
+
+ // ActionableView:
+ bool PerformAction(const ui::Event& event) override;
+ void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
+
+ private:
+ friend class test::TrayInfoLabelTest;
+
+ bool IsClickable();
+
+ views::Label* const label_;
+ int message_id_;
+
+ Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(TrayInfoLabel);
+};
+
+} // namespace ash
+
+#endif // ASH_SYSTEM_TRAY_TRAY_INFO_LABEL_H_

Powered by Google App Engine
This is Rietveld 408576698