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

Side by Side Diff: ui/message_center/views/notification_view_md.cc

Issue 2945303006: Add percentage of progress in notification header. (Closed)
Patch Set: Resolve review comments. Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « ui/message_center/views/notification_header_view.cc ('k') | ui/strings/ui_strings.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_md.h" 5 #include "ui/message_center/views/notification_view_md.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "ui/base/cursor/cursor.h" 10 #include "ui/base/cursor/cursor.h"
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 compact_title_message_view_->set_title(notification.title()); 544 compact_title_message_view_->set_title(notification.title());
545 compact_title_message_view_->set_message(notification.message()); 545 compact_title_message_view_->set_message(notification.message());
546 left_content_->InvalidateLayout(); 546 left_content_->InvalidateLayout();
547 } 547 }
548 548
549 void NotificationViewMD::CreateOrUpdateProgressBarView( 549 void NotificationViewMD::CreateOrUpdateProgressBarView(
550 const Notification& notification) { 550 const Notification& notification) {
551 if (notification.type() != NOTIFICATION_TYPE_PROGRESS) { 551 if (notification.type() != NOTIFICATION_TYPE_PROGRESS) {
552 left_content_->RemoveChildView(progress_bar_view_); 552 left_content_->RemoveChildView(progress_bar_view_);
553 progress_bar_view_ = nullptr; 553 progress_bar_view_ = nullptr;
554 header_row_->ClearProgress();
554 return; 555 return;
555 } 556 }
556 557
557 DCHECK(left_content_); 558 DCHECK(left_content_);
558 559
559 if (!progress_bar_view_) { 560 if (!progress_bar_view_) {
560 progress_bar_view_ = new views::ProgressBar(kProgressBarHeight, 561 progress_bar_view_ = new views::ProgressBar(kProgressBarHeight,
561 /* allow_round_corner */ false); 562 /* allow_round_corner */ false);
562 progress_bar_view_->SetBorder(views::CreateEmptyBorder( 563 progress_bar_view_->SetBorder(views::CreateEmptyBorder(
563 message_center::kProgressBarTopPadding, 0, 0, 0)); 564 message_center::kProgressBarTopPadding, 0, 0, 0));
564 left_content_->AddChildView(progress_bar_view_); 565 left_content_->AddChildView(progress_bar_view_);
565 } 566 }
566 567
567 progress_bar_view_->SetValue(notification.progress() / 100.0); 568 progress_bar_view_->SetValue(notification.progress() / 100.0);
568 progress_bar_view_->SetVisible(notification.items().empty()); 569 progress_bar_view_->SetVisible(notification.items().empty());
570
571 header_row_->SetProgress(notification.progress());
569 } 572 }
570 573
571 void NotificationViewMD::CreateOrUpdateListItemViews( 574 void NotificationViewMD::CreateOrUpdateListItemViews(
572 const Notification& notification) { 575 const Notification& notification) {
573 for (auto* item_view : item_views_) 576 for (auto* item_view : item_views_)
574 delete item_view; 577 delete item_view;
575 item_views_.clear(); 578 item_views_.clear();
576 579
577 const std::vector<NotificationItem>& items = notification.items(); 580 const std::vector<NotificationItem>& items = notification.items();
578 581
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 header_row_->expand_button()->HasFocus()) || 776 header_row_->expand_button()->HasFocus()) ||
774 (header_row_->IsCloseButtonEnabled() && 777 (header_row_->IsCloseButtonEnabled() &&
775 header_row_->close_button()->HasFocus()) || 778 header_row_->close_button()->HasFocus()) ||
776 (header_row_->IsSettingsButtonEnabled() && 779 (header_row_->IsSettingsButtonEnabled() &&
777 header_row_->settings_button()->HasFocus()); 780 header_row_->settings_button()->HasFocus());
778 781
779 header_row_->SetControlButtonsVisible(target_visibility); 782 header_row_->SetControlButtonsVisible(target_visibility);
780 } 783 }
781 784
782 } // namespace message_center 785 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/notification_header_view.cc ('k') | ui/strings/ui_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698