Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: ash/system/chromeos/network/tray_sms.cc

Issue 2002783002: Use plural formats and native digits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: plural: use "=1" instead of "one" for pop-up block infobar Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/strings/string_number_conversions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/system/chromeos/network/tray_sms.h" 5 #include "ash/system/chromeos/network/tray_sms.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/fixed_sized_scroll_view.h" 8 #include "ash/system/tray/fixed_sized_scroll_view.h"
9 #include "ash/system/tray/system_tray.h" 9 #include "ash/system/tray/system_tray.h"
10 #include "ash/system/tray/system_tray_bubble.h" 10 #include "ash/system/tray/system_tray_bubble.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 : TrayItemMore(owner, true) { 60 : TrayItemMore(owner, true) {
61 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 61 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
62 IDR_AURA_UBER_TRAY_SMS)); 62 IDR_AURA_UBER_TRAY_SMS));
63 Update(); 63 Update();
64 } 64 }
65 65
66 ~SmsDefaultView() override {} 66 ~SmsDefaultView() override {}
67 67
68 void Update() { 68 void Update() {
69 int message_count = static_cast<TraySms*>(owner())->messages().GetSize(); 69 int message_count = static_cast<TraySms*>(owner())->messages().GetSize();
70 base::string16 label = l10n_util::GetStringFUTF16( 70 // TODO(jshin): Currently, a tabular format is used ("SMS Messages:
71 IDS_ASH_STATUS_TRAY_SMS_MESSAGES, base::IntToString16(message_count)); 71 // <count>"). Check with UX if '<count> SMS messages' with a proper plural
72 // support is desired.
73 base::string16 label = l10n_util::GetStringFUTF16Int(
74 IDS_ASH_STATUS_TRAY_SMS_MESSAGES, message_count);
72 SetLabel(label); 75 SetLabel(label);
73 SetAccessibleName(label); 76 SetAccessibleName(label);
74 } 77 }
75 78
76 private: 79 private:
77 DISALLOW_COPY_AND_ASSIGN(SmsDefaultView); 80 DISALLOW_COPY_AND_ASSIGN(SmsDefaultView);
78 }; 81 };
79 82
80 // An entry (row) in SmsDetailedView or NotificationView. 83 // An entry (row) in SmsDetailedView or NotificationView.
81 class TraySms::SmsMessageView : public views::View, 84 class TraySms::SmsMessageView : public views::View,
82 public views::ButtonListener { 85 public views::ButtonListener {
83 public: 86 public:
84 enum ViewType { 87 enum ViewType {
85 VIEW_DETAILED, 88 VIEW_DETAILED,
86 VIEW_NOTIFICATION 89 VIEW_NOTIFICATION
87 }; 90 };
88 91
89 SmsMessageView(TraySms* owner, 92 SmsMessageView(TraySms* owner,
90 ViewType view_type, 93 ViewType view_type,
91 size_t index, 94 size_t index,
92 const std::string& number, 95 const std::string& number,
93 const std::string& message) 96 const std::string& message)
94 : owner_(owner), 97 : owner_(owner),
95 index_(index) { 98 index_(index) {
99 // TODO(jshin): Convert ASCII digits in |number| (phone number) to native
100 // digits if necessary. |number| can contain non-digit characters and may
101 // have to be converted one-by-one or use libphonenumber's formating API.
96 number_label_ = new views::Label( 102 number_label_ = new views::Label(
97 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_SMS_NUMBER, 103 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_SMS_NUMBER,
98 base::UTF8ToUTF16(number)), 104 base::UTF8ToUTF16(number)),
99 ui::ResourceBundle::GetSharedInstance().GetFontList( 105 ui::ResourceBundle::GetSharedInstance().GetFontList(
100 ui::ResourceBundle::BoldFont)); 106 ui::ResourceBundle::BoldFont));
101 number_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 107 number_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
102 108
103 message_label_ = new views::Label(base::UTF8ToUTF16(message)); 109 message_label_ = new views::Label(base::UTF8ToUTF16(message));
104 message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 110 message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
105 message_label_->SetMultiLine(true); 111 message_label_->SetMultiLine(true);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 std::string number, text; 409 std::string number, text;
404 if (GetLatestMessage(&index, &number, &text)) 410 if (GetLatestMessage(&index, &number, &text))
405 notification_->Update(index, number, text); 411 notification_->Update(index, number, text);
406 } else if (notify) { 412 } else if (notify) {
407 ShowNotificationView(); 413 ShowNotificationView();
408 } 414 }
409 } 415 }
410 } 416 }
411 417
412 } // namespace ash 418 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | base/strings/string_number_conversions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698