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

Side by Side Diff: chrome/common/time_format.h

Issue 3165009: Convert TimeFormat (chrome/common/time_format.*) to string16 (from wstring). (Closed)
Patch Set: bar Created 10 years, 4 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
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/common/time_format.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_COMMON_TIME_FORMAT_H__ 5 #ifndef CHROME_COMMON_TIME_FORMAT_H__
6 #define CHROME_COMMON_TIME_FORMAT_H__ 6 #define CHROME_COMMON_TIME_FORMAT_H__
7 #pragma once 7 #pragma once
8 8
9 // This file defines methods to format time values as strings. 9 // This file defines methods to format time values as strings.
10 10
11 #include <string> 11 #include "base/string16.h"
12 12
13 #include "unicode/smpdtfmt.h" 13 #include "unicode/smpdtfmt.h"
14 14
15 namespace base { 15 namespace base {
16 class Time; 16 class Time;
17 class TimeDelta; 17 class TimeDelta;
18 } 18 }
19 19
20 class TimeFormat { 20 class TimeFormat {
21 public: 21 public:
22 // TimeElapsed, TimeRemaining and TimeRemainingShort functions: 22 // TimeElapsed, TimeRemaining and TimeRemainingShort functions:
23 // These functions return a localized string of approximate time duration. The 23 // These functions return a localized string of approximate time duration. The
24 // conditions are simpler than PastTime since these functions are used for 24 // conditions are simpler than PastTime since these functions are used for
25 // in-progress operations and users have different expectations of units. 25 // in-progress operations and users have different expectations of units.
26 26
27 // Returns times in elapsed-format: "3 mins ago", "2 days ago". 27 // Returns times in elapsed-format: "3 mins ago", "2 days ago".
28 static std::wstring TimeElapsed(const base::TimeDelta& delta); 28 static string16 TimeElapsed(const base::TimeDelta& delta);
29 29
30 // Returns times in remaining-format: "3 mins left", "2 days left". 30 // Returns times in remaining-format: "3 mins left", "2 days left".
31 static std::wstring TimeRemaining(const base::TimeDelta& delta); 31 static string16 TimeRemaining(const base::TimeDelta& delta);
32 32
33 // Returns times in short-format: "3 mins", "2 days". 33 // Returns times in short-format: "3 mins", "2 days".
34 static std::wstring TimeRemainingShort(const base::TimeDelta& delta); 34 static string16 TimeRemainingShort(const base::TimeDelta& delta);
35 35
36 // For displaying a relative time in the past. This method returns either 36 // For displaying a relative time in the past. This method returns either
37 // "Today", "Yesterday", or an empty string if it's older than that. 37 // "Today", "Yesterday", or an empty string if it's older than that.
38 // 38 //
39 // TODO(brettw): This should be able to handle days in the future like 39 // TODO(brettw): This should be able to handle days in the future like
40 // "Tomorrow". 40 // "Tomorrow".
41 // TODO(tc): This should be able to do things like "Last week". This 41 // TODO(tc): This should be able to do things like "Last week". This
42 // requires handling singluar/plural for all languages. 42 // requires handling singluar/plural for all languages.
43 // 43 //
44 // The second parameter is optional, it is midnight of "Now" for relative day 44 // The second parameter is optional, it is midnight of "Now" for relative day
45 // computations: Time::Now().LocalMidnight() 45 // computations: Time::Now().LocalMidnight()
46 // If NULL, the current day's midnight will be retrieved, which can be 46 // If NULL, the current day's midnight will be retrieved, which can be
47 // slow. If many items are being processed, it is best to get the current 47 // slow. If many items are being processed, it is best to get the current
48 // time once at the beginning and pass it for each computation. 48 // time once at the beginning and pass it for each computation.
49 static std::wstring RelativeDate(const base::Time& time, 49 static string16 RelativeDate(const base::Time& time,
50 const base::Time* optional_midnight_today); 50 const base::Time* optional_midnight_today);
51 }; 51 };
52 52
53 #endif // CHROME_COMMON_TIME_FORMAT_H__ 53 #endif // CHROME_COMMON_TIME_FORMAT_H__
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/common/time_format.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698