Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(969)

Unified Diff: ui/message_center/views/notification_header_view.cc

Issue 2945303006: Add percentage of progress in notification header. (Closed)
Patch Set: Resolve review comments. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/message_center/views/notification_header_view.h ('k') | ui/message_center/views/notification_view_md.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/notification_header_view.cc
diff --git a/ui/message_center/views/notification_header_view.cc b/ui/message_center/views/notification_header_view.cc
index 97cdd3615e5f54a81311eeb736c30e2a68671d70..091160954390f8a727815ba7911e92d188d3258f 100644
--- a/ui/message_center/views/notification_header_view.cc
+++ b/ui/message_center/views/notification_header_view.cc
@@ -4,6 +4,8 @@
#include "ui/message_center/views/notification_header_view.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/utf_string_conversions.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/font_list.h"
@@ -28,6 +30,8 @@ constexpr int kExpandIconSize = 12;
constexpr gfx::Insets kHeaderPadding(0, 12, 0, 2);
constexpr int kHeaderHorizontalSpacing = 2;
constexpr int kAppInfoConatainerTopPadding = 12;
+// Bullet character. The divider symbol between different parts of the header.
+constexpr base::char16 kNotificationHeaderDividerSymbol = 0x2022;
} // namespace
@@ -62,6 +66,23 @@ NotificationHeaderView::NotificationHeaderView(views::ButtonListener* listener)
app_name_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
app_info_container->AddChildView(app_name_view_);
+ // Summary text divider
+ summary_text_divider_ =
+ new views::Label(base::ASCIIToUTF16(" ") +
+ base::string16(1, kNotificationHeaderDividerSymbol) +
+ base::ASCIIToUTF16(" "));
+ summary_text_divider_->SetFontList(font_list);
+ summary_text_divider_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ summary_text_divider_->SetVisible(false);
+ app_info_container->AddChildView(summary_text_divider_);
+
+ // Summary text view
+ summary_text_view_ = new views::Label(base::string16());
+ summary_text_view_->SetFontList(font_list);
+ summary_text_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ summary_text_view_->SetVisible(false);
+ app_info_container->AddChildView(summary_text_view_);
+
// Expand button view
expand_button_ = new views::ImageButton(listener);
expand_button_->SetImage(
@@ -106,6 +127,18 @@ void NotificationHeaderView::SetAppName(const base::string16& name) {
app_name_view_->SetText(name);
}
+void NotificationHeaderView::SetProgress(int progress) {
+ summary_text_view_->SetText(l10n_util::GetStringFUTF16Int(
+ IDS_MESSAGE_CENTER_NOTIFICATION_PROGRESS_PERCENTAGE, progress));
+ has_summary_text_ = true;
+ UpdateSummaryTextVisibility();
+}
+
+void NotificationHeaderView::ClearProgress() {
+ has_summary_text_ = false;
+ UpdateSummaryTextVisibility();
+}
+
void NotificationHeaderView::SetExpandButtonEnabled(bool enabled) {
expand_button_->SetVisible(enabled);
}
@@ -159,4 +192,10 @@ void NotificationHeaderView::UpdateControlButtonsVisibility() {
Layout();
}
+void NotificationHeaderView::UpdateSummaryTextVisibility() {
+ summary_text_divider_->SetVisible(has_summary_text_);
+ summary_text_view_->SetVisible(has_summary_text_);
+ Layout();
+}
+
} // namespace message_center
« no previous file with comments | « ui/message_center/views/notification_header_view.h ('k') | ui/message_center/views/notification_view_md.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698