| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 if (file) { | 213 if (file) { |
| 214 // TODO(rdsmith): Change to DCHECK when http://crbug.com/84508 is fixed. | 214 // TODO(rdsmith): Change to DCHECK when http://crbug.com/84508 is fixed. |
| 215 CHECK_NE(DownloadHistory::kUninitializedHandle, file->db_handle()); | 215 CHECK_NE(DownloadHistory::kUninitializedHandle, file->db_handle()); |
| 216 file->Remove(); | 216 file->Remove(); |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 | 219 |
| 220 void DownloadsDOMHandler::HandleCancel(const ListValue* args) { | 220 void DownloadsDOMHandler::HandleCancel(const ListValue* args) { |
| 221 DownloadItem* file = GetDownloadByValue(args); | 221 DownloadItem* file = GetDownloadByValue(args); |
| 222 if (file) | 222 if (file) |
| 223 file->Cancel(true); | 223 file->Cancel(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void DownloadsDOMHandler::HandleClearAll(const ListValue* args) { | 226 void DownloadsDOMHandler::HandleClearAll(const ListValue* args) { |
| 227 download_manager_->RemoveAllDownloads(); | 227 download_manager_->RemoveAllDownloads(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 // DownloadsDOMHandler, private: ---------------------------------------------- | 230 // DownloadsDOMHandler, private: ---------------------------------------------- |
| 231 | 231 |
| 232 void DownloadsDOMHandler::SendCurrentDownloads() { | 232 void DownloadsDOMHandler::SendCurrentDownloads() { |
| 233 ListValue results_value; | 233 ListValue results_value; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 return NULL; | 266 return NULL; |
| 267 } | 267 } |
| 268 | 268 |
| 269 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { | 269 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { |
| 270 int id; | 270 int id; |
| 271 if (ExtractIntegerValue(args, &id)) { | 271 if (ExtractIntegerValue(args, &id)) { |
| 272 return GetDownloadById(id); | 272 return GetDownloadById(id); |
| 273 } | 273 } |
| 274 return NULL; | 274 return NULL; |
| 275 } | 275 } |
| OLD | NEW |