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

Side by Side Diff: chrome/browser/download/notification/download_item_notification.cc

Issue 2329633003: Implement progress bar spec (determinate and indeterminate). (Closed)
Patch Set: attempt to unbreak mac and unit test Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/download/notification/download_item_notification.h" 5 #include "chrome/browser/download/notification/download_item_notification.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } else { 380 } else {
381 switch (item_->GetState()) { 381 switch (item_->GetState()) {
382 case content::DownloadItem::IN_PROGRESS: { 382 case content::DownloadItem::IN_PROGRESS: {
383 int percent_complete = item_->PercentComplete(); 383 int percent_complete = item_->PercentComplete();
384 if (percent_complete >= 0) { 384 if (percent_complete >= 0) {
385 notification_->set_progress(percent_complete); 385 notification_->set_progress(percent_complete);
386 } else { 386 } else {
387 // Negative progress value shows an indeterminate progress bar. 387 // Negative progress value shows an indeterminate progress bar.
388 notification_->set_progress(-1); 388 notification_->set_progress(-1);
389 } 389 }
390
390 notification_->set_type(message_center::NOTIFICATION_TYPE_PROGRESS); 391 notification_->set_type(message_center::NOTIFICATION_TYPE_PROGRESS);
391 break; 392 break;
392 } 393 }
393 case content::DownloadItem::COMPLETE: 394 case content::DownloadItem::COMPLETE:
394 DCHECK(item_->IsDone()); 395 DCHECK(item_->IsDone());
395 notification_->set_priority(message_center::DEFAULT_PRIORITY); 396 notification_->set_priority(message_center::DEFAULT_PRIORITY);
396 notification_->set_type(message_center::NOTIFICATION_TYPE_BASE_FORMAT); 397 notification_->set_type(message_center::NOTIFICATION_TYPE_BASE_FORMAT);
397 notification_->set_progress(100); 398 notification_->set_progress(100);
398 break; 399 break;
399 case content::DownloadItem::CANCELLED: 400 case content::DownloadItem::CANCELLED:
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 const std::string notification_id_in_message_center = notification->id(); 936 const std::string notification_id_in_message_center = notification->id();
936 937
937 message_center::NotificationList::Notifications visible_notifications = 938 message_center::NotificationList::Notifications visible_notifications =
938 message_center_->GetVisibleNotifications(); 939 message_center_->GetVisibleNotifications();
939 for (auto* notification : visible_notifications) { 940 for (auto* notification : visible_notifications) {
940 if (notification->id() == notification_id_in_message_center) 941 if (notification->id() == notification_id_in_message_center)
941 return true; 942 return true;
942 } 943 }
943 return false; 944 return false;
944 } 945 }
OLDNEW
« no previous file with comments | « ash/autoclick/common/autoclick_ring_handler.cc ('k') | chrome/browser/ui/views/status_bubble_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698