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

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

Issue 1822303002: [Extensions] Convert APIs to use movable types [4] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 if (!net::IsSafePortableRelativePath(creator_suggested_filename)) { 981 if (!net::IsSafePortableRelativePath(creator_suggested_filename)) {
982 error_ = errors::kInvalidFilename; 982 error_ = errors::kInvalidFilename;
983 return false; 983 return false;
984 } 984 }
985 } 985 }
986 986
987 if (options.save_as.get()) 987 if (options.save_as.get())
988 download_params->set_prompt(*options.save_as.get()); 988 download_params->set_prompt(*options.save_as.get());
989 989
990 if (options.headers.get()) { 990 if (options.headers.get()) {
991 typedef downloads::HeaderNameValuePair HeaderNameValuePair; 991 typedef downloads::HeaderNameValuePair HeaderNameValuePair;
lazyboy 2016/03/23 21:26:58 optional nit: can get rid of this typedef since it
Devlin 2016/03/24 20:56:26 Done.
992 for (std::vector<linked_ptr<HeaderNameValuePair> >::const_iterator iter = 992 for (const HeaderNameValuePair& name_value : *options.headers) {
993 options.headers->begin();
994 iter != options.headers->end();
995 ++iter) {
996 const HeaderNameValuePair& name_value = **iter;
997 if (!net::HttpUtil::IsValidHeaderName(name_value.name)) { 993 if (!net::HttpUtil::IsValidHeaderName(name_value.name)) {
998 error_ = errors::kInvalidHeaderName; 994 error_ = errors::kInvalidHeaderName;
999 return false; 995 return false;
1000 } 996 }
1001 if (!net::HttpUtil::IsSafeHeader(name_value.name)) { 997 if (!net::HttpUtil::IsSafeHeader(name_value.name)) {
1002 error_ = errors::kInvalidHeaderUnsafe; 998 error_ = errors::kInvalidHeaderUnsafe;
1003 return false; 999 return false;
1004 } 1000 }
1005 if (!net::HttpUtil::IsValidHeaderValue(name_value.value)) { 1001 if (!net::HttpUtil::IsValidHeaderValue(name_value.value)) {
1006 error_ = errors::kInvalidHeaderValue; 1002 error_ = errors::kInvalidHeaderValue;
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 return; 1899 return;
1904 base::Time now(base::Time::Now()); 1900 base::Time now(base::Time::Now());
1905 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); 1901 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT();
1906 if (delta <= kFileExistenceRateLimitSeconds) 1902 if (delta <= kFileExistenceRateLimitSeconds)
1907 return; 1903 return;
1908 last_checked_removal_ = now; 1904 last_checked_removal_ = now;
1909 manager->CheckForHistoryFilesRemoval(); 1905 manager->CheckForHistoryFilesRemoval();
1910 } 1906 }
1911 1907
1912 } // namespace extensions 1908 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698