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

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

Issue 8313003: Wrap TimeFormat unittests into unnamed namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 2 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
« no previous file with comments | « no previous file | chrome/common/time_format_unittest.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) 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 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 #include "base/basictypes.h"
10
11 #include "base/string16.h" 10 #include "base/string16.h"
12 11
13 namespace base { 12 namespace base {
14 class Time; 13 class Time;
15 class TimeDelta; 14 class TimeDelta;
16 } 15 }
17 16
17 // Methods to format time values as strings.
18 class TimeFormat { 18 class TimeFormat {
19 public: 19 public:
20 // TimeElapsed, TimeRemaining and TimeRemainingShort functions: 20 // TimeElapsed, TimeRemaining and TimeRemainingShort functions:
21 // These functions return a localized string of approximate time duration. The 21 // These functions return a localized string of approximate time duration. The
22 // conditions are simpler than PastTime since these functions are used for 22 // conditions are simpler than PastTime since these functions are used for
23 // in-progress operations and users have different expectations of units. 23 // in-progress operations and users have different expectations of units.
24 24
25 // Returns times in elapsed-format: "3 mins ago", "2 days ago". 25 // Returns times in elapsed-format: "3 mins ago", "2 days ago".
26 static string16 TimeElapsed(const base::TimeDelta& delta); 26 static string16 TimeElapsed(const base::TimeDelta& delta);
27 27
(...skipping 11 matching lines...) Expand all
39 // TODO(tc): This should be able to do things like "Last week". This 39 // TODO(tc): This should be able to do things like "Last week". This
40 // requires handling singluar/plural for all languages. 40 // requires handling singluar/plural for all languages.
41 // 41 //
42 // The second parameter is optional, it is midnight of "Now" for relative day 42 // The second parameter is optional, it is midnight of "Now" for relative day
43 // computations: Time::Now().LocalMidnight() 43 // computations: Time::Now().LocalMidnight()
44 // If NULL, the current day's midnight will be retrieved, which can be 44 // If NULL, the current day's midnight will be retrieved, which can be
45 // slow. If many items are being processed, it is best to get the current 45 // slow. If many items are being processed, it is best to get the current
46 // time once at the beginning and pass it for each computation. 46 // time once at the beginning and pass it for each computation.
47 static string16 RelativeDate(const base::Time& time, 47 static string16 RelativeDate(const base::Time& time,
48 const base::Time* optional_midnight_today); 48 const base::Time* optional_midnight_today);
49
50 private:
51 DISALLOW_IMPLICIT_CONSTRUCTORS(TimeFormat);
49 }; 52 };
50 53
51 #endif // CHROME_COMMON_TIME_FORMAT_H__ 54 #endif // CHROME_COMMON_TIME_FORMAT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/common/time_format_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698