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 "ui/message_center/views/notification_view.h" | 5 #include "ui/message_center/views/notification_view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 } | 522 } |
523 | 523 |
524 message_view_->SetVisible(!notification.items().size()); | 524 message_view_->SetVisible(!notification.items().size()); |
525 } | 525 } |
526 | 526 |
527 base::string16 NotificationView::FormatContextMessage( | 527 base::string16 NotificationView::FormatContextMessage( |
528 const Notification& notification) const { | 528 const Notification& notification) const { |
529 if (notification.UseOriginAsContextMessage()) { | 529 if (notification.UseOriginAsContextMessage()) { |
530 const GURL url = notification.origin_url(); | 530 const GURL url = notification.origin_url(); |
531 DCHECK(url.is_valid()); | 531 DCHECK(url.is_valid()); |
532 // TODO(palmer): Find a way to get the Profile's real languages. | 532 return gfx::ElideText( |
533 // crbug.com/496965. | 533 url_formatter::FormatUrlForSecurityDisplayOmitScheme(url), |
534 return gfx::ElideText(url_formatter::FormatUrlForSecurityDisplayOmitScheme( | 534 views::Label().font_list(), kContextMessageViewWidth, |
535 url, std::string()), | 535 gfx::ELIDE_HEAD); |
536 views::Label().font_list(), kContextMessageViewWidth, | |
537 gfx::ELIDE_HEAD); | |
538 } | 536 } |
539 | 537 |
540 return gfx::TruncateString(notification.context_message(), | 538 return gfx::TruncateString(notification.context_message(), |
541 kContextMessageCharacterLimit, gfx::WORD_BREAK); | 539 kContextMessageCharacterLimit, gfx::WORD_BREAK); |
542 } | 540 } |
543 | 541 |
544 void NotificationView::CreateOrUpdateContextMessageView( | 542 void NotificationView::CreateOrUpdateContextMessageView( |
545 const Notification& notification) { | 543 const Notification& notification) { |
546 if (notification.context_message().empty() && | 544 if (notification.context_message().empty() && |
547 !notification.UseOriginAsContextMessage()) { | 545 !notification.UseOriginAsContextMessage()) { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 void NotificationView::RequestFocusOnCloseButton() { | 838 void NotificationView::RequestFocusOnCloseButton() { |
841 if (close_button_) | 839 if (close_button_) |
842 close_button_->RequestFocus(); | 840 close_button_->RequestFocus(); |
843 } | 841 } |
844 | 842 |
845 bool NotificationView::IsPinned() { | 843 bool NotificationView::IsPinned() { |
846 return !close_button_; | 844 return !close_button_; |
847 } | 845 } |
848 | 846 |
849 } // namespace message_center | 847 } // namespace message_center |
OLD | NEW |