| 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_COMMON_SYSTEM_DATE_DATE_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_DATE_DATE_VIEW_H_ |
| 6 #define ASH_COMMON_SYSTEM_DATE_DATE_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_DATE_DATE_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 public: | 32 public: |
| 33 ~BaseDateTimeView() override; | 33 ~BaseDateTimeView() override; |
| 34 | 34 |
| 35 // Updates the displayed text for the current time and calls SetTimer(). | 35 // Updates the displayed text for the current time and calls SetTimer(). |
| 36 void UpdateText(); | 36 void UpdateText(); |
| 37 | 37 |
| 38 // views::View overrides: | 38 // views::View overrides: |
| 39 void GetAccessibleState(ui::AXViewState* state) override; | 39 void GetAccessibleState(ui::AXViewState* state) override; |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 BaseDateTimeView(); | 42 explicit BaseDateTimeView(SystemTrayItem* owner); |
| 43 | 43 |
| 44 // Updates labels to display the current time. | 44 // Updates labels to display the current time. |
| 45 virtual void UpdateTextInternal(const base::Time& now); | 45 virtual void UpdateTextInternal(const base::Time& now); |
| 46 | 46 |
| 47 // Time format (12/24hr) used for accessibility string. | 47 // Time format (12/24hr) used for accessibility string. |
| 48 base::HourClockType hour_type_; | 48 base::HourClockType hour_type_; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // Starts |timer_| to schedule the next update. | 51 // Starts |timer_| to schedule the next update. |
| 52 void SetTimer(const base::Time& now); | 52 void SetTimer(const base::Time& now); |
| 53 | 53 |
| 54 // Overridden from views::View. | 54 // Overridden from views::View. |
| 55 void ChildPreferredSizeChanged(views::View* child) override; | 55 void ChildPreferredSizeChanged(views::View* child) override; |
| 56 void OnLocaleChanged() override; | 56 void OnLocaleChanged() override; |
| 57 | 57 |
| 58 // Invokes UpdateText() when the displayed time should change. | 58 // Invokes UpdateText() when the displayed time should change. |
| 59 base::OneShotTimer timer_; | 59 base::OneShotTimer timer_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(BaseDateTimeView); | 61 DISALLOW_COPY_AND_ASSIGN(BaseDateTimeView); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // Popup view used to display the date and day of week. | 64 // Popup view used to display the date and day of week. |
| 65 class ASH_EXPORT DateView : public BaseDateTimeView { | 65 class ASH_EXPORT DateView : public BaseDateTimeView { |
| 66 public: | 66 public: |
| 67 DateView(); | 67 explicit DateView(SystemTrayItem* owner); |
| 68 ~DateView() override; | 68 ~DateView() override; |
| 69 | 69 |
| 70 // Sets the action the view should take. An actionable date view gives visual | 70 // Sets the action the view should take. An actionable date view gives visual |
| 71 // feedback on hover, can be focused by keyboard, and clicking/pressing space | 71 // feedback on hover, can be focused by keyboard, and clicking/pressing space |
| 72 // or enter on the view executes the action. | 72 // or enter on the view executes the action. |
| 73 void SetAction(TrayDate::DateAction action); | 73 void SetAction(TrayDate::DateAction action); |
| 74 | 74 |
| 75 // Updates the format of the displayed time. | 75 // Updates the format of the displayed time. |
| 76 void UpdateTimeFormat(); | 76 void UpdateTimeFormat(); |
| 77 | 77 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 std::unique_ptr<views::Label> vertical_label_hours_; | 137 std::unique_ptr<views::Label> vertical_label_hours_; |
| 138 std::unique_ptr<views::Label> vertical_label_minutes_; | 138 std::unique_ptr<views::Label> vertical_label_minutes_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(TimeView); | 140 DISALLOW_COPY_AND_ASSIGN(TimeView); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 } // namespace tray | 143 } // namespace tray |
| 144 } // namespace ash | 144 } // namespace ash |
| 145 | 145 |
| 146 #endif // ASH_COMMON_SYSTEM_DATE_DATE_VIEW_H_ | 146 #endif // ASH_COMMON_SYSTEM_DATE_DATE_VIEW_H_ |
| OLD | NEW |