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

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

Issue 7796014: Make cancel remove cancelled download from active queues at time of cancel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final Cancel arg fix. Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/active_downloads_ui.h" 5 #include "chrome/browser/ui/webui/active_downloads_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 void ActiveDownloadsHandler::HandleAllowDownload(const ListValue* args) { 263 void ActiveDownloadsHandler::HandleAllowDownload(const ListValue* args) {
264 DownloadItem* item = GetDownloadById(args); 264 DownloadItem* item = GetDownloadById(args);
265 if (item) 265 if (item)
266 item->DangerousDownloadValidated(); 266 item->DangerousDownloadValidated();
267 } 267 }
268 268
269 void ActiveDownloadsHandler::HandleCancelDownload(const ListValue* args) { 269 void ActiveDownloadsHandler::HandleCancelDownload(const ListValue* args) {
270 DownloadItem* item = GetDownloadById(args); 270 DownloadItem* item = GetDownloadById(args);
271 if (item) { 271 if (item) {
272 if (item->IsPartialDownload()) 272 if (item->IsPartialDownload())
273 item->Cancel(true); 273 item->Cancel();
274 item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); 274 item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD);
275 } 275 }
276 } 276 }
277 277
278 bool ActiveDownloadsHandler::SelectTab(const GURL& url) { 278 bool ActiveDownloadsHandler::SelectTab(const GURL& url) {
279 for (TabContentsIterator it; !it.done(); ++it) { 279 for (TabContentsIterator it; !it.done(); ++it) {
280 TabContents* tab_contents = it->tab_contents(); 280 TabContents* tab_contents = it->tab_contents();
281 if (tab_contents->GetURL() == url) { 281 if (tab_contents->GetURL() == url) {
282 static_cast<RenderViewHostDelegate*>(tab_contents)->Activate(); 282 static_cast<RenderViewHostDelegate*>(tab_contents)->Activate();
283 return true; 283 return true;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 return (*it); 430 return (*it);
431 } 431 }
432 } 432 }
433 } 433 }
434 return NULL; 434 return NULL;
435 } 435 }
436 436
437 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { 437 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const {
438 return handler_->downloads(); 438 return handler_->downloads();
439 } 439 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698