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

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

Issue 10867077: Fix crash in DownloadsDOMHandler::GetDownloadByValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS); 507 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
508 item->DangerousDownloadValidated(); 508 item->DangerousDownloadValidated();
509 } 509 }
510 510
511 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( 511 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue(
512 const base::ListValue* args) { 512 const base::ListValue* args) {
513 int id = -1; 513 int id = -1;
514 if (!ExtractIntegerValue(args, &id)) 514 if (!ExtractIntegerValue(args, &id))
515 return NULL; 515 return NULL;
516 content::DownloadItem* download_item = download_manager_->GetDownload(id); 516 content::DownloadItem* download_item = download_manager_->GetDownload(id);
517 if (download_item == NULL) 517 if (!download_item && original_profile_download_manager_)
518 download_item = original_profile_download_manager_->GetDownload(id); 518 download_item = original_profile_download_manager_->GetDownload(id);
519 return download_item; 519 return download_item;
520 } 520 }
521 521
522 content::WebContents* DownloadsDOMHandler::GetWebUIWebContents() { 522 content::WebContents* DownloadsDOMHandler::GetWebUIWebContents() {
523 return web_ui()->GetWebContents(); 523 return web_ui()->GetWebContents();
524 } 524 }
525 525
526 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { 526 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) {
527 web_ui()->CallJavascriptFunction("downloadsList", downloads); 527 web_ui()->CallJavascriptFunction("downloadsList", downloads);
528 } 528 }
529 529
530 void DownloadsDOMHandler::CallDownloadUpdated( 530 void DownloadsDOMHandler::CallDownloadUpdated(
531 const base::ListValue& download_item) { 531 const base::ListValue& download_item) {
532 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); 532 web_ui()->CallJavascriptFunction("downloadUpdated", download_item);
533 } 533 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698