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 12 matching lines...) Expand all Loading... |
23 #include "ui/gfx/skia_util.h" | 23 #include "ui/gfx/skia_util.h" |
24 #include "ui/gfx/text_elider.h" | 24 #include "ui/gfx/text_elider.h" |
25 #include "ui/message_center/message_center.h" | 25 #include "ui/message_center/message_center.h" |
26 #include "ui/message_center/message_center_style.h" | 26 #include "ui/message_center/message_center_style.h" |
27 #include "ui/message_center/notification.h" | 27 #include "ui/message_center/notification.h" |
28 #include "ui/message_center/notification_types.h" | 28 #include "ui/message_center/notification_types.h" |
29 #include "ui/message_center/views/bounded_label.h" | 29 #include "ui/message_center/views/bounded_label.h" |
30 #include "ui/message_center/views/constants.h" | 30 #include "ui/message_center/views/constants.h" |
31 #include "ui/message_center/views/message_center_controller.h" | 31 #include "ui/message_center/views/message_center_controller.h" |
32 #include "ui/message_center/views/notification_button.h" | 32 #include "ui/message_center/views/notification_button.h" |
33 #include "ui/message_center/views/notification_progress_bar.h" | |
34 #include "ui/message_center/views/padded_button.h" | 33 #include "ui/message_center/views/padded_button.h" |
35 #include "ui/message_center/views/proportional_image_view.h" | 34 #include "ui/message_center/views/proportional_image_view.h" |
36 #include "ui/native_theme/native_theme.h" | 35 #include "ui/native_theme/native_theme.h" |
37 #include "ui/resources/grit/ui_resources.h" | 36 #include "ui/resources/grit/ui_resources.h" |
38 #include "ui/strings/grit/ui_strings.h" | 37 #include "ui/strings/grit/ui_strings.h" |
39 #include "ui/views/background.h" | 38 #include "ui/views/background.h" |
40 #include "ui/views/border.h" | 39 #include "ui/views/border.h" |
41 #include "ui/views/controls/button/image_button.h" | 40 #include "ui/views/controls/button/image_button.h" |
42 #include "ui/views/controls/image_view.h" | 41 #include "ui/views/controls/image_view.h" |
43 #include "ui/views/controls/label.h" | 42 #include "ui/views/controls/label.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 525 |
527 bool is_indeterminate = (notification.progress() < 0); | 526 bool is_indeterminate = (notification.progress() < 0); |
528 if (progress_bar_view_ && | 527 if (progress_bar_view_ && |
529 progress_bar_view_->is_indeterminate() != is_indeterminate) { | 528 progress_bar_view_->is_indeterminate() != is_indeterminate) { |
530 delete progress_bar_view_; | 529 delete progress_bar_view_; |
531 progress_bar_view_ = NULL; | 530 progress_bar_view_ = NULL; |
532 } | 531 } |
533 | 532 |
534 if (!progress_bar_view_) { | 533 if (!progress_bar_view_) { |
535 if (!is_indeterminate) | 534 if (!is_indeterminate) |
536 progress_bar_view_ = new NotificationProgressBar(); | 535 progress_bar_view_ = new views::DeterminateProgressBar(); |
537 else | 536 else |
538 progress_bar_view_ = new NotificationIndeterminateProgressBar(); | 537 progress_bar_view_ = new views::IndeterminateProgressBar(); |
539 | 538 |
540 progress_bar_view_->SetBorder(MakeProgressBarBorder( | 539 progress_bar_view_->SetBorder(MakeProgressBarBorder( |
541 message_center::kProgressBarTopPadding, kProgressBarBottomPadding)); | 540 message_center::kProgressBarTopPadding, kProgressBarBottomPadding)); |
542 top_view_->AddChildView(progress_bar_view_); | 541 top_view_->AddChildView(progress_bar_view_); |
543 } | 542 } |
544 | 543 |
545 if (!is_indeterminate) | 544 if (!is_indeterminate) |
546 progress_bar_view_->SetValue(notification.progress() / 100.0); | 545 progress_bar_view_->SetValue(notification.progress() / 100.0); |
547 | 546 |
548 progress_bar_view_->SetVisible(notification.items().empty()); | 547 progress_bar_view_->SetVisible(notification.items().empty()); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 | 703 |
705 return message_line_limit; | 704 return message_line_limit; |
706 } | 705 } |
707 | 706 |
708 int NotificationView::GetMessageHeight(int width, int limit) const { | 707 int NotificationView::GetMessageHeight(int width, int limit) const { |
709 return message_view_ ? | 708 return message_view_ ? |
710 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; | 709 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; |
711 } | 710 } |
712 | 711 |
713 } // namespace message_center | 712 } // namespace message_center |
OLD | NEW |