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

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@ 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..769170b7be7f2dc43d04e26f90a6d3317d4bb3bc
--- /dev/null
+++ b/ash/system/tray/tray_info_label.h
@@ -0,0 +1,59 @@
+// 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 {
+
+class TrayInfoLabelTest;
+
+// A view containing only a label, which is to be inserted as a
+// 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).
+// TrayInfoLabel can be clickable; this property is configured by its delegate.
+class TrayInfoLabel : public ActionableView {
+ public:
+ // A delegate for determining whether or not a TrayInfoLabel is clickable, and
+ // handling actions when it is clicked.
+ class Delegate {
+ public:
+ virtual ~Delegate(){};
+ virtual void OnLabelClicked(int message_id) = 0;
+ virtual bool IsLabelClickable(int message_id) = 0;
Kyle Horimoto 2017/07/14 20:58:49 nit: Make this function const: virtual bool IsLab
lesliewatkins 2017/07/18 17:00:06 Done.
+ };
+
+ // |delegate| may be null, which results in a TrayInfoLabel which cannot be
+ // clicked.
+ TrayInfoLabel(Delegate* delegate, int message_id);
+ ~TrayInfoLabel() override{};
+
+ // Updates the TrayInfoLabel to display the message associated with
+ // |message_id|. This may update text styling if the delegate indicates that
+ // the TrayInfoLabel should be clickable.
+ void Update(int message_id);
+
+ // ActionableView:
+ bool PerformAction(const ui::Event& event) override;
+ void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
+
+ private:
+ friend class 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