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

Side by Side Diff: chrome/installer/gcapi/gcapi_omaha_experiment.cc

Issue 2111103002: Make callers of FromUTC(Local)Exploded in chrome/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: modified comments in code Created 4 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gcapi/gcapi_omaha_experiment.h" 5 #include "chrome/installer/gcapi/gcapi_omaha_experiment.h"
6 6
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chrome/installer/gcapi/gcapi.h" 12 #include "chrome/installer/gcapi/gcapi.h"
13 #include "chrome/installer/util/google_update_constants.h" 13 #include "chrome/installer/util/google_update_constants.h"
14 #include "chrome/installer/util/google_update_settings.h" 14 #include "chrome/installer/util/google_update_settings.h"
15 #include "components/variations/variations_experiment_util.h" 15 #include "components/variations/variations_experiment_util.h"
16 16
17 namespace { 17 namespace {
18 18
19 // Returns the number of weeks since 2/3/2003. 19 // Returns the number of weeks since 2/3/2003.
20 int GetCurrentRlzWeek(const base::Time& current_time) { 20 int GetCurrentRlzWeek(const base::Time& current_time) {
21 base::Time::Exploded february_third_2003_exploded = 21 base::Time::Exploded february_third_2003_exploded =
Lei Zhang 2016/07/06 17:44:30 const, if you don't mind.
maksims (do not use this acc) 2016/07/07 05:48:14 Done.
Lei Zhang 2016/07/07 05:50:55 Thanks!
22 {2003, 2, 1, 3, 0, 0, 0, 0}; 22 {2003, 2, 1, 3, 0, 0, 0, 0};
23 base::Time f = base::Time::FromUTCExploded(february_third_2003_exploded); 23 base::Time f;
24 bool conversion_success =
25 base::Time::FromUTCExploded(february_third_2003_exploded, &f);
26 DCHECK(conversion_success);
24 base::TimeDelta delta = current_time - f; 27 base::TimeDelta delta = current_time - f;
25 return delta.InDays() / 7; 28 return delta.InDays() / 7;
26 } 29 }
27 30
28 bool SetExperimentLabel(const wchar_t* brand_code, 31 bool SetExperimentLabel(const wchar_t* brand_code,
29 const base::string16& label, 32 const base::string16& label,
30 int shell_mode) { 33 int shell_mode) {
31 if (!brand_code) { 34 if (!brand_code) {
32 return false; 35 return false;
33 } 36 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool SetReactivationExperimentLabels(const wchar_t* brand_code, 103 bool SetReactivationExperimentLabels(const wchar_t* brand_code,
101 int shell_mode) { 104 int shell_mode) {
102 return SetExperimentLabel(brand_code, gcapi_internals::kReactivationLabel, 105 return SetExperimentLabel(brand_code, gcapi_internals::kReactivationLabel,
103 shell_mode); 106 shell_mode);
104 } 107 }
105 108
106 bool SetRelaunchExperimentLabels(const wchar_t* brand_code, int shell_mode) { 109 bool SetRelaunchExperimentLabels(const wchar_t* brand_code, int shell_mode) {
107 return SetExperimentLabel(brand_code, gcapi_internals::kRelaunchLabel, 110 return SetExperimentLabel(brand_code, gcapi_internals::kRelaunchLabel,
108 shell_mode); 111 shell_mode);
109 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698