| 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/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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 void DownloadsDOMHandler::HandleRemove(const ListValue* args) { | 195 void DownloadsDOMHandler::HandleRemove(const ListValue* args) { |
| 196 DownloadItem* file = GetDownloadByValue(args); | 196 DownloadItem* file = GetDownloadByValue(args); |
| 197 if (file) | 197 if (file) |
| 198 file->Remove(); | 198 file->Remove(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void DownloadsDOMHandler::HandleCancel(const ListValue* args) { | 201 void DownloadsDOMHandler::HandleCancel(const ListValue* args) { |
| 202 DownloadItem* file = GetDownloadByValue(args); | 202 DownloadItem* file = GetDownloadByValue(args); |
| 203 if (file) | 203 if (file) |
| 204 file->Cancel(true); | 204 file->Cancel(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void DownloadsDOMHandler::HandleClearAll(const ListValue* args) { | 207 void DownloadsDOMHandler::HandleClearAll(const ListValue* args) { |
| 208 download_manager_->RemoveAllDownloads(); | 208 download_manager_->RemoveAllDownloads(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 // DownloadsDOMHandler, private: ---------------------------------------------- | 211 // DownloadsDOMHandler, private: ---------------------------------------------- |
| 212 | 212 |
| 213 void DownloadsDOMHandler::SendCurrentDownloads() { | 213 void DownloadsDOMHandler::SendCurrentDownloads() { |
| 214 ListValue results_value; | 214 ListValue results_value; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 243 return NULL; | 243 return NULL; |
| 244 } | 244 } |
| 245 | 245 |
| 246 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { | 246 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { |
| 247 int id; | 247 int id; |
| 248 if (ExtractIntegerValue(args, &id)) { | 248 if (ExtractIntegerValue(args, &id)) { |
| 249 return GetDownloadById(id); | 249 return GetDownloadById(id); |
| 250 } | 250 } |
| 251 return NULL; | 251 return NULL; |
| 252 } | 252 } |
| OLD | NEW |