| 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/ui/webui/md_downloads/downloads_list_tracker.h" | 5 #include "chrome/browser/ui/webui/md_downloads/downloads_list_tracker.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 break; | 272 break; |
| 273 } | 273 } |
| 274 | 274 |
| 275 case content::DownloadItem::INTERRUPTED: | 275 case content::DownloadItem::INTERRUPTED: |
| 276 state = "INTERRUPTED"; | 276 state = "INTERRUPTED"; |
| 277 progress_status_text = download_model.GetTabProgressStatusText(); | 277 progress_status_text = download_model.GetTabProgressStatusText(); |
| 278 | 278 |
| 279 if (download_item->CanResume()) | 279 if (download_item->CanResume()) |
| 280 percent = download_item->PercentComplete(); | 280 percent = download_item->PercentComplete(); |
| 281 | 281 |
| 282 last_reason_text = download_model.GetInterruptReasonText(); | 282 // TODO(asanka): last_reason_text should be set via |
| 283 // download_model.GetInterruptReasonText(). But we are using |
| 284 // GetStatusText() as a temporary measure until the layout is fixed to |
| 285 // accommodate the longer string. http://crbug.com/609255 |
| 286 last_reason_text = download_model.GetStatusText(); |
| 283 if (content::DOWNLOAD_INTERRUPT_REASON_CRASH == | 287 if (content::DOWNLOAD_INTERRUPT_REASON_CRASH == |
| 284 download_item->GetLastReason() && !download_item->CanResume()) { | 288 download_item->GetLastReason() && !download_item->CanResume()) { |
| 285 retry = true; | 289 retry = true; |
| 286 } | 290 } |
| 287 break; | 291 break; |
| 288 | 292 |
| 289 case content::DownloadItem::CANCELLED: | 293 case content::DownloadItem::CANCELLED: |
| 290 state = "CANCELLED"; | 294 state = "CANCELLED"; |
| 291 retry = true; | 295 retry = true; |
| 292 break; | 296 break; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 size_t index = GetIndex(remove); | 417 size_t index = GetIndex(remove); |
| 414 if (index < sent_to_page_) { | 418 if (index < sent_to_page_) { |
| 415 web_ui_->CallJavascriptFunction( | 419 web_ui_->CallJavascriptFunction( |
| 416 "downloads.Manager.removeItem", | 420 "downloads.Manager.removeItem", |
| 417 base::FundamentalValue(static_cast<int>(index))); | 421 base::FundamentalValue(static_cast<int>(index))); |
| 418 sent_to_page_--; | 422 sent_to_page_--; |
| 419 } | 423 } |
| 420 } | 424 } |
| 421 sorted_items_.erase(remove); | 425 sorted_items_.erase(remove); |
| 422 } | 426 } |
| OLD | NEW |