| OLD | NEW |
| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 void ActiveDownloadsHandler::HandleAllowDownload(const ListValue* args) { | 267 void ActiveDownloadsHandler::HandleAllowDownload(const ListValue* args) { |
| 268 DownloadItem* item = GetDownloadById(args); | 268 DownloadItem* item = GetDownloadById(args); |
| 269 if (item) | 269 if (item) |
| 270 item->DangerousDownloadValidated(); | 270 item->DangerousDownloadValidated(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void ActiveDownloadsHandler::HandleCancelDownload(const ListValue* args) { | 273 void ActiveDownloadsHandler::HandleCancelDownload(const ListValue* args) { |
| 274 DownloadItem* item = GetDownloadById(args); | 274 DownloadItem* item = GetDownloadById(args); |
| 275 if (item) { | 275 if (item) { |
| 276 if (item->IsPartialDownload()) | 276 if (item->IsPartialDownload()) |
| 277 item->Cancel(true); | 277 item->Cancel(); |
| 278 item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 278 item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 bool ActiveDownloadsHandler::SelectTab(const GURL& url) { | 282 bool ActiveDownloadsHandler::SelectTab(const GURL& url) { |
| 283 for (TabContentsIterator it; !it.done(); ++it) { | 283 for (TabContentsIterator it; !it.done(); ++it) { |
| 284 TabContents* tab_contents = it->tab_contents(); | 284 TabContents* tab_contents = it->tab_contents(); |
| 285 if (tab_contents->GetURL() == url) { | 285 if (tab_contents->GetURL() == url) { |
| 286 static_cast<RenderViewHostDelegate*>(tab_contents)->Activate(); | 286 static_cast<RenderViewHostDelegate*>(tab_contents)->Activate(); |
| 287 return true; | 287 return true; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 return (*it); | 433 return (*it); |
| 434 } | 434 } |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 return NULL; | 437 return NULL; |
| 438 } | 438 } |
| 439 | 439 |
| 440 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { | 440 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { |
| 441 return handler_->downloads(); | 441 return handler_->downloads(); |
| 442 } | 442 } |
| OLD | NEW |