OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
6 #define ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ | 6 #define ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/system/tray/tray_constants.h" | 11 #include "ash/system/tray/tray_constants.h" |
12 #include "ash/system/tray/view_click_listener.h" | 12 #include "ash/system/tray/view_click_listener.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
15 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
16 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 struct VectorIcon; | 19 struct VectorIcon; |
20 } // namespace gfx | 20 } // namespace gfx |
21 | 21 |
22 namespace views { | 22 namespace views { |
23 class BoxLayout; | 23 class BoxLayout; |
24 class CustomButton; | 24 class CustomButton; |
25 class Label; | |
26 class ProgressBar; | 25 class ProgressBar; |
27 class ScrollView; | 26 class ScrollView; |
28 } // namespace views | 27 } // namespace views |
29 | 28 |
30 namespace ash { | 29 namespace ash { |
31 | 30 |
32 class HoverHighlightView; | 31 class HoverHighlightView; |
33 class ScrollBorder; | 32 class ScrollBorder; |
34 class SystemTrayItem; | 33 class SystemTrayItem; |
35 class TriView; | 34 class TriView; |
36 | 35 |
37 class ASH_EXPORT TrayDetailsView : public views::View, | 36 class ASH_EXPORT TrayDetailsView : public views::View, |
38 public ViewClickListener, | 37 public ViewClickListener, |
39 public views::ButtonListener { | 38 public views::ButtonListener { |
40 public: | 39 public: |
41 explicit TrayDetailsView(SystemTrayItem* owner); | 40 explicit TrayDetailsView(SystemTrayItem* owner); |
42 ~TrayDetailsView() override; | 41 ~TrayDetailsView() override; |
43 | 42 |
44 // ViewClickListener: | 43 // ViewClickListener: |
45 // Don't override this --- override HandleViewClicked. | 44 // Don't override this --- override HandleViewClicked. |
46 void OnViewClicked(views::View* sender) final; | 45 void OnViewClicked(views::View* sender) final; |
47 | 46 |
48 // views::ButtonListener: | 47 // views::ButtonListener: |
49 // Don't override this --- override HandleButtonPressed. | 48 // Don't override this --- override HandleButtonPressed. |
50 void ButtonPressed(views::Button* sender, const ui::Event& event) final; | 49 void ButtonPressed(views::Button* sender, const ui::Event& event) final; |
51 | 50 |
52 SystemTrayItem* owner() { return owner_; } | 51 SystemTrayItem* owner() { return owner_; } |
53 | 52 |
54 protected: | 53 protected: |
55 // A view containing only a label, which is to be inserted as a non-targetable | |
56 // row within a system menu detailed view (e.g., the "Scanning for devices..." | |
57 // message that can appear at the top of the Bluetooth detailed view). | |
58 class InfoLabel : public View { | |
59 public: | |
60 explicit InfoLabel(int message_id); | |
61 ~InfoLabel() override; | |
62 | |
63 void SetMessage(int message_id); | |
64 | |
65 private: | |
66 views::Label* const label_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(InfoLabel); | |
69 }; | |
70 | |
71 // views::View: | 54 // views::View: |
72 void Layout() override; | 55 void Layout() override; |
73 int GetHeightForWidth(int width) const override; | 56 int GetHeightForWidth(int width) const override; |
74 | 57 |
75 // Exposes the layout manager of this view to give control to subclasses. | 58 // Exposes the layout manager of this view to give control to subclasses. |
76 views::BoxLayout* box_layout() { return box_layout_; } | 59 views::BoxLayout* box_layout() { return box_layout_; } |
77 | 60 |
78 // Creates the row containing the back button and title. For material design | 61 // Creates the row containing the back button and title. For material design |
79 // this appears at the top of the view, for non-material design it appears | 62 // this appears at the top of the view, for non-material design it appears |
80 // at the bottom. | 63 // at the bottom. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 159 |
177 // Used to delay the transition to the default view. | 160 // Used to delay the transition to the default view. |
178 base::OneShotTimer transition_delay_timer_; | 161 base::OneShotTimer transition_delay_timer_; |
179 | 162 |
180 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); | 163 DISALLOW_COPY_AND_ASSIGN(TrayDetailsView); |
181 }; | 164 }; |
182 | 165 |
183 } // namespace ash | 166 } // namespace ash |
184 | 167 |
185 #endif // ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ | 168 #endif // ASH_SYSTEM_TRAY_TRAY_DETAILS_VIEW_H_ |
OLD | NEW |