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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api.cc

Issue 2030013003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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/extensions/api/downloads/downloads_api.h" 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 RunDownloadQuery(params->query, 1186 RunDownloadQuery(params->query,
1187 manager, 1187 manager,
1188 incognito_manager, 1188 incognito_manager,
1189 &error_, 1189 &error_,
1190 &results); 1190 &results);
1191 if (!error_.empty()) 1191 if (!error_.empty())
1192 return false; 1192 return false;
1193 std::unique_ptr<base::ListValue> json_results(new base::ListValue()); 1193 std::unique_ptr<base::ListValue> json_results(new base::ListValue());
1194 for (DownloadManager::DownloadVector::const_iterator it = results.begin(); 1194 for (DownloadManager::DownloadVector::const_iterator it = results.begin();
1195 it != results.end(); ++it) { 1195 it != results.end(); ++it) {
1196 json_results->Append( 1196 json_results->AppendInteger(static_cast<int>((*it)->GetId()));
1197 new base::FundamentalValue(static_cast<int>((*it)->GetId())));
1198 (*it)->Remove(); 1197 (*it)->Remove();
1199 } 1198 }
1200 SetResult(std::move(json_results)); 1199 SetResult(std::move(json_results));
1201 RecordApiFunctions(DOWNLOADS_FUNCTION_ERASE); 1200 RecordApiFunctions(DOWNLOADS_FUNCTION_ERASE);
1202 return true; 1201 return true;
1203 } 1202 }
1204 1203
1205 DownloadsRemoveFileFunction::DownloadsRemoveFileFunction() { 1204 DownloadsRemoveFileFunction::DownloadsRemoveFileFunction() {
1206 } 1205 }
1207 1206
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 return; 1902 return;
1904 base::Time now(base::Time::Now()); 1903 base::Time now(base::Time::Now());
1905 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); 1904 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT();
1906 if (delta <= kFileExistenceRateLimitSeconds) 1905 if (delta <= kFileExistenceRateLimitSeconds)
1907 return; 1906 return;
1908 last_checked_removal_ = now; 1907 last_checked_removal_ = now;
1909 manager->CheckForHistoryFilesRemoval(); 1908 manager->CheckForHistoryFilesRemoval();
1910 } 1909 }
1911 1910
1912 } // namespace extensions 1911 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698