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

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: changed message ids to actual string names 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
« no previous file with comments | « ash/system/tray/tray_details_view.cc ('k') | ash/system/tray/tray_info_label.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2267e945bd65ca351ef924faa74848f0ee4f3ab2
--- /dev/null
+++ b/ash/system/tray/tray_info_label.h
@@ -0,0 +1,57 @@
+// Copyright 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 {
+
+// 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) const = 0;
+ };
+
+ // |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_
« no previous file with comments | « ash/system/tray/tray_details_view.cc ('k') | ash/system/tray/tray_info_label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698