OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_BASE_DIRECTORY_LISTING_H_ |
| 6 #define NET_BASE_DIRECTORY_LISTING_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 #include <string> |
| 10 |
| 11 #include "base/strings/string16.h" |
| 12 #include "net/base/net_export.h" |
| 13 |
| 14 namespace base { |
| 15 class Time; |
| 16 } |
| 17 |
| 18 namespace net { |
| 19 |
| 20 // Call these functions to get the html snippet for a directory listing. |
| 21 // The return values of both functions are in UTF-8. |
| 22 NET_EXPORT std::string GetDirectoryListingHeader(const base::string16& title); |
| 23 |
| 24 // Given the name of a file in a directory (ftp or local) and |
| 25 // other information (is_dir, size, modification time), it returns |
| 26 // the html snippet to add the entry for the file to the directory listing. |
| 27 // Currently, it's a script tag containing a call to a Javascript function |
| 28 // |addRow|. |
| 29 // |
| 30 // |name| is the file name to be displayed. |raw_bytes| will be used |
| 31 // as the actual target of the link (so for example, ftp links should use |
| 32 // server's encoding). If |raw_bytes| is an empty string, UTF-8 encoded |name| |
| 33 // will be used. |
| 34 // |
| 35 // Both |name| and |raw_bytes| are escaped internally. |
| 36 NET_EXPORT std::string GetDirectoryListingEntry(const base::string16& name, |
| 37 const std::string& raw_bytes, |
| 38 bool is_dir, |
| 39 int64_t size, |
| 40 base::Time modified); |
| 41 |
| 42 } // namespace net |
| 43 |
| 44 #endif // NET_BASE_DIRECTORY_LISTING_H_ |
OLD | NEW |