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

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

Issue 7294013: Modified cancel and interrupt processing to avoid race with history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed various problems surfaced by trybots. Created 9 years, 5 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/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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 DownloadItem* file = GetDownloadByValue(args); 212 DownloadItem* file = GetDownloadByValue(args);
213 // TODO(rdsmith): Change to DCHECK when http://crbug.com/84508 is fixed. 213 // TODO(rdsmith): Change to DCHECK when http://crbug.com/84508 is fixed.
214 CHECK_NE(DownloadHistory::kUninitializedHandle, file->db_handle()); 214 CHECK_NE(DownloadHistory::kUninitializedHandle, file->db_handle());
215 if (file) 215 if (file)
216 file->Remove(); 216 file->Remove();
217 } 217 }
218 218
219 void DownloadsDOMHandler::HandleCancel(const ListValue* args) { 219 void DownloadsDOMHandler::HandleCancel(const ListValue* args) {
220 DownloadItem* file = GetDownloadByValue(args); 220 DownloadItem* file = GetDownloadByValue(args);
221 if (file) 221 if (file)
222 file->Cancel(true); 222 file->Cancel();
223 } 223 }
224 224
225 void DownloadsDOMHandler::HandleClearAll(const ListValue* args) { 225 void DownloadsDOMHandler::HandleClearAll(const ListValue* args) {
226 download_manager_->RemoveAllDownloads(); 226 download_manager_->RemoveAllDownloads();
227 } 227 }
228 228
229 // DownloadsDOMHandler, private: ---------------------------------------------- 229 // DownloadsDOMHandler, private: ----------------------------------------------
230 230
231 void DownloadsDOMHandler::SendCurrentDownloads() { 231 void DownloadsDOMHandler::SendCurrentDownloads() {
232 ListValue results_value; 232 ListValue results_value;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 return NULL; 265 return NULL;
266 } 266 }
267 267
268 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { 268 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) {
269 int id; 269 int id;
270 if (ExtractIntegerValue(args, &id)) { 270 if (ExtractIntegerValue(args, &id)) {
271 return GetDownloadById(id); 271 return GetDownloadById(id);
272 } 272 }
273 return NULL; 273 return NULL;
274 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698