| 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 525 |
| 526 message_view_->SetVisible(!notification.items().size()); | 526 message_view_->SetVisible(!notification.items().size()); |
| 527 } | 527 } |
| 528 | 528 |
| 529 base::string16 NotificationView::FormatContextMessage( | 529 base::string16 NotificationView::FormatContextMessage( |
| 530 const Notification& notification) const { | 530 const Notification& notification) const { |
| 531 if (notification.UseOriginAsContextMessage()) { | 531 if (notification.UseOriginAsContextMessage()) { |
| 532 const GURL url = notification.origin_url(); | 532 const GURL url = notification.origin_url(); |
| 533 DCHECK(url.is_valid()); | 533 DCHECK(url.is_valid()); |
| 534 return gfx::ElideText( | 534 return gfx::ElideText( |
| 535 url_formatter::FormatUrlForSecurityDisplayOmitScheme(url), | 535 url_formatter::FormatUrlForSecurityDisplay( |
| 536 views::Label().font_list(), kContextMessageViewWidth, | 536 url, url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS), |
| 537 gfx::ELIDE_HEAD); | 537 views::Label().font_list(), kContextMessageViewWidth, gfx::ELIDE_HEAD); |
| 538 } | 538 } |
| 539 | 539 |
| 540 return gfx::TruncateString(notification.context_message(), | 540 return gfx::TruncateString(notification.context_message(), |
| 541 kContextMessageCharacterLimit, gfx::WORD_BREAK); | 541 kContextMessageCharacterLimit, gfx::WORD_BREAK); |
| 542 } | 542 } |
| 543 | 543 |
| 544 void NotificationView::CreateOrUpdateContextMessageView( | 544 void NotificationView::CreateOrUpdateContextMessageView( |
| 545 const Notification& notification) { | 545 const Notification& notification) { |
| 546 if (notification.context_message().empty() && | 546 if (notification.context_message().empty() && |
| 547 !notification.UseOriginAsContextMessage()) { | 547 !notification.UseOriginAsContextMessage()) { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 void NotificationView::RequestFocusOnCloseButton() { | 840 void NotificationView::RequestFocusOnCloseButton() { |
| 841 if (close_button_) | 841 if (close_button_) |
| 842 close_button_->RequestFocus(); | 842 close_button_->RequestFocus(); |
| 843 } | 843 } |
| 844 | 844 |
| 845 bool NotificationView::IsPinned() { | 845 bool NotificationView::IsPinned() { |
| 846 return !close_button_; | 846 return !close_button_; |
| 847 } | 847 } |
| 848 | 848 |
| 849 } // namespace message_center | 849 } // namespace message_center |
| OLD | NEW |