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

Side by Side Diff: chrome/installer/util/google_update_experiment_util.cc

Issue 23579003: GCAPI should append to the existing experiment_labels instead of clobbering them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 7 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/installer/util/google_update_experiment_util.h" 5 #include "chrome/installer/util/google_update_experiment_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 13
14 namespace installer { 14 namespace installer {
15 15
16 namespace { 16 namespace {
17 17
18 const char* const kDays[] = 18 const char* const kDays[] =
19 { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; 19 { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
20 20
21 const char* const kMonths[] = 21 const char* const kMonths[] =
22 { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", 22 { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
23 "Oct", "Nov", "Dec"}; 23 "Oct", "Nov", "Dec"};
24 24
25 } 25 }
26 26
27 string16 BuildExperimentDateString() { 27 string16 BuildExperimentDateString(const base::Time& current_time) {
28 // The Google Update experiment_labels timestamp format is: 28 // The Google Update experiment_labels timestamp format is:
29 // "DAY, DD0 MON YYYY HH0:MI0:SE0 TZ" 29 // "DAY, DD0 MON YYYY HH0:MI0:SE0 TZ"
30 // DAY = 3 character day of week, 30 // DAY = 3 character day of week,
31 // DD0 = 2 digit day of month, 31 // DD0 = 2 digit day of month,
32 // MON = 3 character month of year, 32 // MON = 3 character month of year,
33 // YYYY = 4 digit year, 33 // YYYY = 4 digit year,
34 // HH0 = 2 digit hour, 34 // HH0 = 2 digit hour,
35 // MI0 = 2 digit minute, 35 // MI0 = 2 digit minute,
36 // SE0 = 2 digit second, 36 // SE0 = 2 digit second,
37 // TZ = 3 character timezone 37 // TZ = 3 character timezone
38 base::Time::Exploded then = {}; 38 base::Time::Exploded then = {};
39 base::Time::Now().UTCExplode(&then); 39 current_time.UTCExplode(&then);
40 then.year += 1; 40 then.year += 1;
41 DCHECK(then.HasValidValues()); 41 DCHECK(then.HasValidValues());
42 42
43 return UTF8ToUTF16(base::StringPrintf("%s, %02d %s %d %02d:%02d:%02d GMT", 43 return UTF8ToUTF16(base::StringPrintf("%s, %02d %s %d %02d:%02d:%02d GMT",
44 kDays[then.day_of_week], 44 kDays[then.day_of_week],
45 then.day_of_month, 45 then.day_of_month,
46 kMonths[then.month - 1], 46 kMonths[then.month - 1],
47 then.year, 47 then.year,
48 then.hour, 48 then.hour,
49 then.minute, 49 then.minute,
50 then.second)); 50 then.second));
51 } 51 }
52 52
53 } // namespace installer 53 } // namespace installer
54 54
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698