TabStripModel::GetActiveWebContents() might return NULL, and will cause a crash if...
[chromium-blink-merge.git] / net / ftp / ftp_util.h
blob3e8a899c7d4e7d95d78c561f3dd7f005895b09d0
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
3 // found in the LICENSE file.
5 #ifndef NET_FTP_FTP_UTIL_H_
6 #define NET_FTP_FTP_UTIL_H_
8 #include <string>
10 #include "base/strings/string16.h"
11 #include "net/base/net_export.h"
13 namespace base {
14 class Time;
17 namespace net {
19 class NET_EXPORT_PRIVATE FtpUtil {
20 public:
21 // Converts Unix file path to VMS path (must be a file, and not a directory).
22 static std::string UnixFilePathToVMS(const std::string& unix_path);
24 // Converts Unix directory path to VMS path (must be a directory).
25 static std::string UnixDirectoryPathToVMS(const std::string& unix_path);
27 // Converts VMS path to Unix-style path.
28 static std::string VMSPathToUnix(const std::string& vms_path);
30 // Converts abbreviated month (like Nov) to its number (in range 1-12).
31 // Note: in some locales abbreviations are more than three letters long,
32 // and this function also handles them correctly.
33 static bool AbbreviatedMonthToNumber(const base::string16& text, int* number);
35 // Converts a "ls -l" date listing to time. The listing comes in three
36 // columns. The first one contains month, the second one contains day
37 // of month. The third one is either a time (and then we guess the year based
38 // on |current_time|), or is a year (and then we don't know the time).
39 static bool LsDateListingToTime(const base::string16& month,
40 const base::string16& day,
41 const base::string16& rest,
42 const base::Time& current_time,
43 base::Time* result);
45 // Converts a Windows date listing to time. Returns true on success.
46 static bool WindowsDateListingToTime(const base::string16& date,
47 const base::string16& time,
48 base::Time* result);
50 // Skips |columns| columns from |text| (whitespace-delimited), and returns the
51 // remaining part, without leading/trailing whitespace.
52 static base::string16 GetStringPartAfterColumns(const base::string16& text,
53 int columns);
56 } // namespace net
58 #endif // NET_FTP_FTP_UTIL_H_