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

Side by Side Diff: chrome/browser/ui/webui/downloads_dom_handler.cc

Issue 10915180: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698