| 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 #include "ash/common/system/date/date_view.h" | 5 #include "ash/common/system/date/date_view.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/system/tray/system_tray_controller.h" | 8 #include "ash/common/system/tray/system_tray_controller.h" |
| 9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
| 10 #include "ash/common/system/tray/tray_popup_item_style.h" | 10 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 11 #include "ash/common/system/tray/tray_utils.h" | 11 #include "ash/common/system/tray/tray_utils.h" |
| 12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/i18n/time_formatting.h" | 14 #include "base/i18n/time_formatting.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
| 18 #include "third_party/icu/source/i18n/unicode/datefmt.h" | 18 #include "third_party/icu/source/i18n/unicode/datefmt.h" |
| 19 #include "third_party/icu/source/i18n/unicode/dtptngen.h" | 19 #include "third_party/icu/source/i18n/unicode/dtptngen.h" |
| 20 #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" | 20 #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" |
| 21 #include "ui/accessibility/ax_view_state.h" | 21 #include "ui/accessibility/ax_node_data.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/views/background.h" | 23 #include "ui/views/background.h" |
| 24 #include "ui/views/border.h" | 24 #include "ui/views/border.h" |
| 25 #include "ui/views/controls/button/button.h" | 25 #include "ui/views/controls/button/button.h" |
| 26 #include "ui/views/controls/label.h" | 26 #include "ui/views/controls/label.h" |
| 27 #include "ui/views/layout/box_layout.h" | 27 #include "ui/views/layout/box_layout.h" |
| 28 #include "ui/views/layout/fill_layout.h" | 28 #include "ui/views/layout/fill_layout.h" |
| 29 #include "ui/views/layout/grid_layout.h" | 29 #include "ui/views/layout/grid_layout.h" |
| 30 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| 31 | 31 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 timer_.Stop(); | 99 timer_.Stop(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void BaseDateTimeView::UpdateText() { | 102 void BaseDateTimeView::UpdateText() { |
| 103 base::Time now = base::Time::Now(); | 103 base::Time now = base::Time::Now(); |
| 104 UpdateTextInternal(now); | 104 UpdateTextInternal(now); |
| 105 SchedulePaint(); | 105 SchedulePaint(); |
| 106 SetTimer(now); | 106 SetTimer(now); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void BaseDateTimeView::GetAccessibleState(ui::AXViewState* state) { | 109 void BaseDateTimeView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 110 ActionableView::GetAccessibleState(state); | 110 ActionableView::GetAccessibleNodeData(node_data); |
| 111 state->role = ui::AX_ROLE_TIME; | 111 node_data->role = ui::AX_ROLE_TIME; |
| 112 } | 112 } |
| 113 | 113 |
| 114 BaseDateTimeView::BaseDateTimeView(SystemTrayItem* owner) | 114 BaseDateTimeView::BaseDateTimeView(SystemTrayItem* owner) |
| 115 : ActionableView(owner), | 115 : ActionableView(owner), |
| 116 hour_type_(WmShell::Get()->system_tray_controller()->hour_clock_type()) { | 116 hour_type_(WmShell::Get()->system_tray_controller()->hour_clock_type()) { |
| 117 SetTimer(base::Time::Now()); | 117 SetTimer(base::Time::Now()); |
| 118 SetFocusBehavior(FocusBehavior::NEVER); | 118 SetFocusBehavior(FocusBehavior::NEVER); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void BaseDateTimeView::SetTimer(const base::Time& now) { | 121 void BaseDateTimeView::SetTimer(const base::Time& now) { |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 } | 398 } |
| 399 | 399 |
| 400 void TimeView::SetupLabel(views::Label* label) { | 400 void TimeView::SetupLabel(views::Label* label) { |
| 401 label->set_owned_by_client(); | 401 label->set_owned_by_client(); |
| 402 SetupLabelForTray(label); | 402 SetupLabelForTray(label); |
| 403 label->SetElideBehavior(gfx::NO_ELIDE); | 403 label->SetElideBehavior(gfx::NO_ELIDE); |
| 404 } | 404 } |
| 405 | 405 |
| 406 } // namespace tray | 406 } // namespace tray |
| 407 } // namespace ash | 407 } // namespace ash |
| OLD | NEW |