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

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

Issue 10260018: Test downloads.download() disallows unsafe headers (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: DownloadHidden Created 8 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
« no previous file with comments | « chrome/browser/download/download_hidden.cc ('k') | chrome/chrome_browser.gypi » ('j') | 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 &download_items_); 205 &download_items_);
206 // If we have a parent DownloadManager, let it add its downloads to the 206 // If we have a parent DownloadManager, let it add its downloads to the
207 // results. 207 // results.
208 if (original_profile_download_manager_) { 208 if (original_profile_download_manager_) {
209 original_profile_download_manager_->SearchDownloads( 209 original_profile_download_manager_->SearchDownloads(
210 WideToUTF16(search_text_), &download_items_); 210 WideToUTF16(search_text_), &download_items_);
211 } 211 }
212 212
213 sort(download_items_.begin(), download_items_.end(), DownloadItemSorter()); 213 sort(download_items_.begin(), download_items_.end(), DownloadItemSorter());
214 214
215 // Remove any extension downloads. 215 // Remove any extension downloads and hidden downloads.
216 for (size_t i = 0; i < download_items_.size();) { 216 for (size_t i = 0; i < download_items_.size();) {
217 if (download_crx_util::IsExtensionDownload(*download_items_[i])) 217 if (download_crx_util::IsExtensionDownload(*download_items_[i]) ||
218 DownloadHidden::Get(download_items_[i]))
218 download_items_.erase(download_items_.begin() + i); 219 download_items_.erase(download_items_.begin() + i);
219 else 220 else
220 i++; 221 i++;
221 } 222 }
222 223
223 // Add ourself to all download items as an observer. 224 // Add ourself to all download items as an observer.
224 for (OrderedDownloads::iterator it = download_items_.begin(); 225 for (OrderedDownloads::iterator it = download_items_.begin();
225 it != download_items_.end(); ++it) { 226 it != download_items_.end(); ++it) {
226 if (static_cast<int>(it - download_items_.begin()) > kMaxDownloads) 227 if (static_cast<int>(it - download_items_.begin()) > kMaxDownloads)
227 break; 228 break;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 405 }
405 406
406 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( 407 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue(
407 const ListValue* args) { 408 const ListValue* args) {
408 int id; 409 int id;
409 if (ExtractIntegerValue(args, &id)) { 410 if (ExtractIntegerValue(args, &id)) {
410 return GetDownloadById(id); 411 return GetDownloadById(id);
411 } 412 }
412 return NULL; 413 return NULL;
413 } 414 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_hidden.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698