| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/downloads_dom_handler.h" | 5 #include "chrome/browser/ui/webui/downloads_dom_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_PAUSE); | 409 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_PAUSE); |
| 410 content::DownloadItem* file = GetDownloadByValue(args); | 410 content::DownloadItem* file = GetDownloadByValue(args); |
| 411 if (file) | 411 if (file) |
| 412 file->TogglePause(); | 412 file->TogglePause(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void DownloadsDOMHandler::HandleRemove(const base::ListValue* args) { | 415 void DownloadsDOMHandler::HandleRemove(const base::ListValue* args) { |
| 416 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_REMOVE); | 416 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_REMOVE); |
| 417 content::DownloadItem* file = GetDownloadByValue(args); | 417 content::DownloadItem* file = GetDownloadByValue(args); |
| 418 if (file) { | 418 if (file) { |
| 419 DCHECK(file->IsPersisted()); | |
| 420 file->Remove(); | 419 file->Remove(); |
| 421 } | 420 } |
| 422 } | 421 } |
| 423 | 422 |
| 424 void DownloadsDOMHandler::HandleCancel(const base::ListValue* args) { | 423 void DownloadsDOMHandler::HandleCancel(const base::ListValue* args) { |
| 425 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_CANCEL); | 424 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_CANCEL); |
| 426 content::DownloadItem* file = GetDownloadByValue(args); | 425 content::DownloadItem* file = GetDownloadByValue(args); |
| 427 if (file) | 426 if (file) |
| 428 file->Cancel(true); | 427 file->Cancel(true); |
| 429 } | 428 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 } | 523 } |
| 525 | 524 |
| 526 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 525 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
| 527 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 526 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
| 528 } | 527 } |
| 529 | 528 |
| 530 void DownloadsDOMHandler::CallDownloadUpdated( | 529 void DownloadsDOMHandler::CallDownloadUpdated( |
| 531 const base::ListValue& download_item) { | 530 const base::ListValue& download_item) { |
| 532 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 531 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
| 533 } | 532 } |
| OLD | NEW |