OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_COMMON_SYSTEM_DATE_SYSTEM_INFO_DEFAULT_VIEW_H_ | |
6 #define ASH_COMMON_SYSTEM_DATE_SYSTEM_INFO_DEFAULT_VIEW_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/common/login_status.h" | |
10 #include "base/macros.h" | |
11 #include "ui/views/view.h" | |
12 | |
13 namespace ash { | |
14 class PowerStatusView; | |
15 class SystemTrayItem; | |
16 class TriView; | |
17 | |
18 namespace tray { | |
19 class DateView; | |
20 } // namespace tray | |
21 | |
22 // The default view for the system info row in the system menu. Contains the | |
23 // current date and, if a battery is present, a string showing the current | |
24 // power status. | |
25 class ASH_EXPORT SystemInfoDefaultView : public views::View { | |
26 public: | |
27 SystemInfoDefaultView(SystemTrayItem* owner, LoginStatus login); | |
28 | |
29 ~SystemInfoDefaultView() override; | |
30 | |
31 tray::DateView* GetDateView(); | |
32 const tray::DateView* GetDateView() const; | |
33 | |
34 // views::View: | |
35 void Layout() override; | |
36 | |
37 private: | |
38 friend class SystemInfoDefaultViewTest; | |
39 | |
40 // Computes and returns the width for |date_view_| so that the separator to | |
41 // its right has the same x-position as a separator in the tiles row above. | |
42 // Depending on the width of the date string, we align the separator with | |
43 // either the second or third separator in the tiles row (|kMinNumTileWidths| | |
44 // and |kMaxNumTileWidths| respectively. | |
45 static int CalculateDateViewWidth(int preferred_width); | |
46 | |
47 tray::DateView* date_view_; | |
48 | |
49 PowerStatusView* power_status_view_ = nullptr; | |
50 | |
51 TriView* tri_view_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(SystemInfoDefaultView); | |
54 }; | |
55 | |
56 } // namespace ash | |
57 | |
58 #endif // ASH_COMMON_SYSTEM_DATE_SYSTEM_INFO_DEFAULT_VIEW_H_ | |
OLD | NEW |