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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 void DownloadsDOMHandler::HandlePause(const base::ListValue* args) { | 408 void DownloadsDOMHandler::HandlePause(const base::ListValue* args) { |
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 } | |
422 } | 420 } |
423 | 421 |
424 void DownloadsDOMHandler::HandleCancel(const base::ListValue* args) { | 422 void DownloadsDOMHandler::HandleCancel(const base::ListValue* args) { |
425 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_CANCEL); | 423 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_CANCEL); |
426 content::DownloadItem* file = GetDownloadByValue(args); | 424 content::DownloadItem* file = GetDownloadByValue(args); |
427 if (file) | 425 if (file) |
428 file->Cancel(true); | 426 file->Cancel(true); |
429 } | 427 } |
430 | 428 |
431 void DownloadsDOMHandler::HandleClearAll(const base::ListValue* args) { | 429 void DownloadsDOMHandler::HandleClearAll(const base::ListValue* args) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 522 } |
525 | 523 |
526 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { | 524 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { |
527 web_ui()->CallJavascriptFunction("downloadsList", downloads); | 525 web_ui()->CallJavascriptFunction("downloadsList", downloads); |
528 } | 526 } |
529 | 527 |
530 void DownloadsDOMHandler::CallDownloadUpdated( | 528 void DownloadsDOMHandler::CallDownloadUpdated( |
531 const base::ListValue& download_item) { | 529 const base::ListValue& download_item) { |
532 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); | 530 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); |
533 } | 531 } |
OLD | NEW |