| 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/chromeos/network/tray_sms.h" | 5 #include "ash/common/system/chromeos/network/tray_sms.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/metrics/user_metrics_action.h" | 8 #include "ash/common/metrics/user_metrics_action.h" |
| 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" | 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
| 10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
| 11 #include "ash/common/system/tray/system_tray_bubble.h" | 11 #include "ash/common/system/tray/system_tray_bubble.h" |
| 12 #include "ash/common/system/tray/tray_constants.h" | 12 #include "ash/common/system/tray/tray_constants.h" |
| 13 #include "ash/common/system/tray/tray_details_view.h" | 13 #include "ash/common/system/tray/tray_details_view.h" |
| 14 #include "ash/common/system/tray/tray_item_more.h" | 14 #include "ash/common/system/tray/tray_item_more.h" |
| 15 #include "ash/common/system/tray/tray_item_view.h" | 15 #include "ash/common/system/tray/tray_item_view.h" |
| 16 #include "ash/common/system/tray/tray_notification_view.h" | 16 #include "ash/common/system/tray/tray_notification_view.h" |
| 17 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 17 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 18 #include "ash/resources/vector_icons/vector_icons.h" | 19 #include "ash/resources/vector_icons/vector_icons.h" |
| 19 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 21 #include "chromeos/network/network_event_log.h" | 22 #include "chromeos/network/network_event_log.h" |
| 22 #include "chromeos/network/network_handler.h" | 23 #include "chromeos/network/network_handler.h" |
| 23 #include "grit/ash_resources.h" | 24 #include "grit/ash_resources.h" |
| 24 #include "grit/ash_strings.h" | 25 #include "grit/ash_strings.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 int message_count = static_cast<TraySms*>(owner())->messages().GetSize(); | 77 int message_count = static_cast<TraySms*>(owner())->messages().GetSize(); |
| 77 // TODO(jshin): Currently, a tabular format is used ("SMS Messages: | 78 // TODO(jshin): Currently, a tabular format is used ("SMS Messages: |
| 78 // <count>"). Check with UX if '<count> SMS messages' with a proper plural | 79 // <count>"). Check with UX if '<count> SMS messages' with a proper plural |
| 79 // support is desired. | 80 // support is desired. |
| 80 base::string16 label = l10n_util::GetStringFUTF16Int( | 81 base::string16 label = l10n_util::GetStringFUTF16Int( |
| 81 IDS_ASH_STATUS_TRAY_SMS_MESSAGES, message_count); | 82 IDS_ASH_STATUS_TRAY_SMS_MESSAGES, message_count); |
| 82 SetLabel(label); | 83 SetLabel(label); |
| 83 SetAccessibleName(label); | 84 SetAccessibleName(label); |
| 84 } | 85 } |
| 85 | 86 |
| 87 protected: |
| 88 // TrayItemMore: |
| 89 std::unique_ptr<TrayPopupItemStyle> CreateStyle() const override { |
| 90 return base::MakeUnique<TrayPopupItemStyle>( |
| 91 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL); |
| 92 } |
| 93 |
| 86 private: | 94 private: |
| 87 DISALLOW_COPY_AND_ASSIGN(SmsDefaultView); | 95 DISALLOW_COPY_AND_ASSIGN(SmsDefaultView); |
| 88 }; | 96 }; |
| 89 | 97 |
| 90 // An entry (row) in SmsDetailedView or NotificationView. | 98 // An entry (row) in SmsDetailedView or NotificationView. |
| 91 class TraySms::SmsMessageView : public views::View, | 99 class TraySms::SmsMessageView : public views::View, |
| 92 public views::ButtonListener { | 100 public views::ButtonListener { |
| 93 public: | 101 public: |
| 94 enum ViewType { VIEW_DETAILED, VIEW_NOTIFICATION }; | 102 enum ViewType { VIEW_DETAILED, VIEW_NOTIFICATION }; |
| 95 | 103 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 std::string number, text; | 424 std::string number, text; |
| 417 if (GetLatestMessage(&index, &number, &text)) | 425 if (GetLatestMessage(&index, &number, &text)) |
| 418 notification_->Update(index, number, text); | 426 notification_->Update(index, number, text); |
| 419 } else if (notify) { | 427 } else if (notify) { |
| 420 ShowNotificationView(); | 428 ShowNotificationView(); |
| 421 } | 429 } |
| 422 } | 430 } |
| 423 } | 431 } |
| 424 | 432 |
| 425 } // namespace ash | 433 } // namespace ash |
| OLD | NEW |