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

Side by Side Diff: net/base/net_util.h

Issue 7005011: Fix bug 79905: Drag and drop of "DownloadURL" type ignores specified filename for data URLs. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 #ifndef NET_BASE_NET_UTIL_H_ 5 #ifndef NET_BASE_NET_UTIL_H_
6 #define NET_BASE_NET_UTIL_H_ 6 #define NET_BASE_NET_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // Both |name| and |raw_bytes| are escaped internally. 235 // Both |name| and |raw_bytes| are escaped internally.
236 std::string GetDirectoryListingEntry(const string16& name, 236 std::string GetDirectoryListingEntry(const string16& name,
237 const std::string& raw_bytes, 237 const std::string& raw_bytes,
238 bool is_dir, int64 size, 238 bool is_dir, int64 size,
239 base::Time modified); 239 base::Time modified);
240 240
241 // If text starts with "www." it is removed, otherwise text is returned 241 // If text starts with "www." it is removed, otherwise text is returned
242 // unmodified. 242 // unmodified.
243 string16 StripWWW(const string16& text); 243 string16 StripWWW(const string16& text);
244 244
245 // Gets the filename from the raw Content-Disposition header (as read from the 245 // Gets the filename in the following order:
246 // network). Otherwise uses the last path component name or hostname from 246 // 1) the raw Content-Disposition header (as read from the network).
247 // |url|. If there is no filename or it can't be used, the given |default_name|, 247 // |referrer_charset| is used as one of charsets to interpret a raw 8bit
248 // will be used unless it is empty. 248 // string in C-D header (after interpreting as UTF-8 fails).
249 249 // See the comment for GetFilenameFromCD for more details.
250 // Note: it's possible for the suggested filename to be empty (e.g., 250 // 2) the suggested name
251 // file:///). referrer_charset is used as one of charsets 251 // 3) the last path component name or hostname from |url|
252 // to interpret a raw 8bit string in C-D header (after interpreting 252 // 4) the given |default_name|
253 // as UTF-8 fails). See the comment for GetFilenameFromCD for more details. 253 // 5) the hard-coded name "download", as the last resort
254 string16 GetSuggestedFilename(const GURL& url, 254 string16 GetSuggestedFilename(const GURL& url,
255 const std::string& content_disposition, 255 const std::string& content_disposition,
256 const std::string& referrer_charset, 256 const std::string& referrer_charset,
257 const std::string& suggested_name,
257 const string16& default_name); 258 const string16& default_name);
258 259
259 // Checks the given port against a list of ports which are restricted by 260 // Checks the given port against a list of ports which are restricted by
260 // default. Returns true if the port is allowed, false if it is restricted. 261 // default. Returns true if the port is allowed, false if it is restricted.
261 bool IsPortAllowedByDefault(int port); 262 bool IsPortAllowedByDefault(int port);
262 263
263 // Checks the given port against a list of ports which are restricted by the 264 // Checks the given port against a list of ports which are restricted by the
264 // FTP protocol. Returns true if the port is allowed, false if it is 265 // FTP protocol. Returns true if the port is allowed, false if it is
265 // restricted. 266 // restricted.
266 bool IsPortAllowedByFtp(int port); 267 bool IsPortAllowedByFtp(int port);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 453
453 // Returns list of network interfaces except loopback interface. If an 454 // Returns list of network interfaces except loopback interface. If an
454 // interface has more than one address, a separate entry is added to 455 // interface has more than one address, a separate entry is added to
455 // the list for each address. 456 // the list for each address.
456 // Can be called only on a thread that allows IO. 457 // Can be called only on a thread that allows IO.
457 bool GetNetworkList(NetworkInterfaceList* networks); 458 bool GetNetworkList(NetworkInterfaceList* networks);
458 459
459 } // namespace net 460 } // namespace net
460 461
461 #endif // NET_BASE_NET_UTIL_H_ 462 #endif // NET_BASE_NET_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698