| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 message_center::kProgressBarTopPadding, kProgressBarBottomPadding)); | 535 message_center::kProgressBarTopPadding, kProgressBarBottomPadding)); |
| 536 top_view_->AddChildView(progress_bar_view_); | 536 top_view_->AddChildView(progress_bar_view_); |
| 537 } | 537 } |
| 538 | 538 |
| 539 progress_bar_view_->SetValue(notification.progress() / 100.0); | 539 progress_bar_view_->SetValue(notification.progress() / 100.0); |
| 540 progress_bar_view_->SetVisible(notification.items().empty()); | 540 progress_bar_view_->SetVisible(notification.items().empty()); |
| 541 } | 541 } |
| 542 | 542 |
| 543 void NotificationView::CreateOrUpdateListItemViews( | 543 void NotificationView::CreateOrUpdateListItemViews( |
| 544 const Notification& notification) { | 544 const Notification& notification) { |
| 545 for (auto item_view : item_views_) | 545 for (auto* item_view : item_views_) |
| 546 delete item_view; | 546 delete item_view; |
| 547 item_views_.clear(); | 547 item_views_.clear(); |
| 548 | 548 |
| 549 int padding = kMessageLineHeight - views::Label().font_list().GetHeight(); | 549 int padding = kMessageLineHeight - views::Label().font_list().GetHeight(); |
| 550 std::vector<NotificationItem> items = notification.items(); | 550 std::vector<NotificationItem> items = notification.items(); |
| 551 | 551 |
| 552 if (items.size() == 0) | 552 if (items.size() == 0) |
| 553 return; | 553 return; |
| 554 | 554 |
| 555 DCHECK(top_view_); | 555 DCHECK(top_view_); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 SK_ColorTRANSPARENT) | 616 SK_ColorTRANSPARENT) |
| 617 : NULL); | 617 : NULL); |
| 618 } | 618 } |
| 619 | 619 |
| 620 void NotificationView::CreateOrUpdateActionButtonViews( | 620 void NotificationView::CreateOrUpdateActionButtonViews( |
| 621 const Notification& notification) { | 621 const Notification& notification) { |
| 622 std::vector<ButtonInfo> buttons = notification.buttons(); | 622 std::vector<ButtonInfo> buttons = notification.buttons(); |
| 623 bool new_buttons = action_buttons_.size() != buttons.size(); | 623 bool new_buttons = action_buttons_.size() != buttons.size(); |
| 624 | 624 |
| 625 if (new_buttons || buttons.size() == 0) { | 625 if (new_buttons || buttons.size() == 0) { |
| 626 for (auto item : separators_) | 626 for (auto* item : separators_) |
| 627 delete item; | 627 delete item; |
| 628 separators_.clear(); | 628 separators_.clear(); |
| 629 for (auto item : action_buttons_) | 629 for (auto* item : action_buttons_) |
| 630 delete item; | 630 delete item; |
| 631 action_buttons_.clear(); | 631 action_buttons_.clear(); |
| 632 } | 632 } |
| 633 | 633 |
| 634 DCHECK(bottom_view_); | 634 DCHECK(bottom_view_); |
| 635 DCHECK_EQ(this, bottom_view_->parent()); | 635 DCHECK_EQ(this, bottom_view_->parent()); |
| 636 | 636 |
| 637 for (size_t i = 0; i < buttons.size(); ++i) { | 637 for (size_t i = 0; i < buttons.size(); ++i) { |
| 638 ButtonInfo button_info = buttons[i]; | 638 ButtonInfo button_info = buttons[i]; |
| 639 if (new_buttons) { | 639 if (new_buttons) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 | 720 |
| 721 return message_line_limit; | 721 return message_line_limit; |
| 722 } | 722 } |
| 723 | 723 |
| 724 int NotificationView::GetMessageHeight(int width, int limit) const { | 724 int NotificationView::GetMessageHeight(int width, int limit) const { |
| 725 return message_view_ ? | 725 return message_view_ ? |
| 726 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; | 726 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; |
| 727 } | 727 } |
| 728 | 728 |
| 729 } // namespace message_center | 729 } // namespace message_center |
| OLD | NEW |