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

Side by Side Diff: ash/common/system/web_notification/web_notification_tray.cc

Issue 2721213002: Adjust RTL formatting for web notifications in cros system tray. (Closed)
Patch Set: Created 3 years, 9 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 | no next file » | 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/common/system/web_notification/web_notification_tray.h" 5 #include "ash/common/system/web_notification/web_notification_tray.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/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
9 #include "ash/common/shelf/shelf_constants.h" 9 #include "ash/common/shelf/shelf_constants.h"
10 #include "ash/common/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 260 }
261 261
262 void SetNotificationCount(bool small_icons_exist, size_t notification_count) { 262 void SetNotificationCount(bool small_icons_exist, size_t notification_count) {
263 notification_count = std::min(notification_count, 263 notification_count = std::min(notification_count,
264 kMaximumNotificationNumber); // cap with 99 264 kMaximumNotificationNumber); // cap with 99
265 265
266 // TODO(yoshiki): Use a string for "99" and "+99". 266 // TODO(yoshiki): Use a string for "99" and "+99".
267 267
268 base::string16 str = base::FormatNumber(notification_count); 268 base::string16 str = base::FormatNumber(notification_count);
269 if (small_icons_exist) { 269 if (small_icons_exist) {
270 if (!base::i18n::IsRTL()) 270 str = base::ASCIIToUTF16("+") + str;
271 str = base::ASCIIToUTF16("+") + str; 271 if (base::i18n::IsRTL())
272 else 272 base::i18n::WrapStringWithRTLFormatting(&str);
mohsen 2017/03/02 21:45:21 If I understand correctly, when the context is RTL
Evan Stade 2017/03/02 22:22:52 We want to show "99+" in RTL. That is what Chrome
mohsen 2017/03/03 04:25:35 I see. I agree that your change is a better way of
273 str = str + base::ASCIIToUTF16("+");
274 } 273 }
275 274
276 view_->SetText(str); 275 view_->SetText(str);
277 view_->SetEnabledColor(kWebNotificationColorWithUnread); 276 view_->SetEnabledColor(kWebNotificationColorWithUnread);
278 SchedulePaint(); 277 SchedulePaint();
279 } 278 }
280 279
281 private: 280 private:
282 views::Label* view_; 281 views::Label* view_;
283 282
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 657
659 message_center::MessageCenterBubble* 658 message_center::MessageCenterBubble*
660 WebNotificationTray::GetMessageCenterBubbleForTest() { 659 WebNotificationTray::GetMessageCenterBubbleForTest() {
661 if (!message_center_bubble()) 660 if (!message_center_bubble())
662 return nullptr; 661 return nullptr;
663 return static_cast<message_center::MessageCenterBubble*>( 662 return static_cast<message_center::MessageCenterBubble*>(
664 message_center_bubble()->bubble()); 663 message_center_bubble()->bubble());
665 } 664 }
666 665
667 } // namespace ash 666 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698