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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 const views::FocusManager* focus_manager = GetFocusManager(); | 401 const views::FocusManager* focus_manager = GetFocusManager(); |
402 return focus_manager && | 402 return focus_manager && |
403 focus_manager->GetFocusedView() == close_button_.get(); | 403 focus_manager->GetFocusedView() == close_button_.get(); |
404 } | 404 } |
405 | 405 |
406 void NotificationView::RequestFocusOnCloseButton() { | 406 void NotificationView::RequestFocusOnCloseButton() { |
407 if (close_button_) | 407 if (close_button_) |
408 close_button_->RequestFocus(); | 408 close_button_->RequestFocus(); |
409 } | 409 } |
410 | 410 |
411 bool NotificationView::IsPinned() const { | |
412 return !close_button_; | |
413 } | |
414 | |
415 void NotificationView::CreateOrUpdateTitleView( | 411 void NotificationView::CreateOrUpdateTitleView( |
416 const Notification& notification) { | 412 const Notification& notification) { |
417 if (notification.title().empty()) { | 413 if (notification.title().empty()) { |
418 // Deletion will also remove |title_view_| from its parent. | 414 // Deletion will also remove |title_view_| from its parent. |
419 delete title_view_; | 415 delete title_view_; |
420 title_view_ = nullptr; | 416 title_view_ = nullptr; |
421 return; | 417 return; |
422 } | 418 } |
423 | 419 |
424 DCHECK(top_view_); | 420 DCHECK(top_view_); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 755 |
760 return message_line_limit; | 756 return message_line_limit; |
761 } | 757 } |
762 | 758 |
763 int NotificationView::GetMessageHeight(int width, int limit) const { | 759 int NotificationView::GetMessageHeight(int width, int limit) const { |
764 return message_view_ ? | 760 return message_view_ ? |
765 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; | 761 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; |
766 } | 762 } |
767 | 763 |
768 } // namespace message_center | 764 } // namespace message_center |
OLD | NEW |