| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |