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

Side by Side Diff: components/ntp_snippets/ntp_snippets_service.cc

Issue 2095553002: Make callers of FromUTC(Local)Exploded in components/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/ntp_snippets/ntp_snippets_service.h" 5 #include "components/ntp_snippets/ntp_snippets_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } else if (exploded.hour < kWifiFetchingHourMax) { 133 } else if (exploded.hour < kWifiFetchingHourMax) {
134 exploded.hour = kWifiFetchingHourMax; 134 exploded.hour = kWifiFetchingHourMax;
135 } else { 135 } else {
136 next_day = true; 136 next_day = true;
137 exploded.hour = kWifiFetchingHourMin; 137 exploded.hour = kWifiFetchingHourMin;
138 } 138 }
139 // In any case, reschedule at the full hour. 139 // In any case, reschedule at the full hour.
140 exploded.minute = 0; 140 exploded.minute = 0;
141 exploded.second = 0; 141 exploded.second = 0;
142 exploded.millisecond = 0; 142 exploded.millisecond = 0;
143 base::Time reschedule = base::Time::FromLocalExploded(exploded); 143 base::Time reschedule;
144 if (!base::Time::FromLocalExploded(exploded, &reschedule)) {
sfiera 2016/06/28 14:13:28 Here, we are combining YMD of a valid date (from L
maksims (do not use this acc) 2016/06/29 05:48:59 [1] Me neither. Well, it seems like it shouldn't
sfiera 2016/06/29 09:15:11 TL;DR this code can fail in Western Greenland. Se
maksims (do not use this acc) 2016/06/30 07:33:14 Check the latests patch. Is it fine now? Did I und
sfiera 2016/06/30 08:41:50 I was suggesting: return GetRescheduleTime(now
maksims (do not use this acc) 2016/07/04 07:34:04 Done.
sfiera 2016/07/04 07:48:20 Thanks! I also looked at the other changes you've
145 // TODO(maksims): implement error handling here.
146 // We might just return |reschedule|, which is Time(0) here.
147 NOTIMPLEMENTED();
148 return reschedule;
149 }
150
144 if (next_day) 151 if (next_day)
145 reschedule += base::TimeDelta::FromDays(1); 152 reschedule += base::TimeDelta::FromDays(1);
146 153
147 return reschedule; 154 return reschedule;
148 } 155 }
149 156
150 // Extracts the hosts from |suggestions| and returns them in a set. 157 // Extracts the hosts from |suggestions| and returns them in a set.
151 std::set<std::string> GetSuggestionsHostsImpl( 158 std::set<std::string> GetSuggestionsHostsImpl(
152 const SuggestionsProfile& suggestions) { 159 const SuggestionsProfile& suggestions) {
153 std::set<std::string> hosts; 160 std::set<std::string> hosts;
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 return; 813 return;
807 } 814 }
808 } 815 }
809 816
810 void NTPSnippetsService::ClearDeprecatedPrefs() { 817 void NTPSnippetsService::ClearDeprecatedPrefs() {
811 pref_service_->ClearPref(prefs::kDeprecatedSnippets); 818 pref_service_->ClearPref(prefs::kDeprecatedSnippets);
812 pref_service_->ClearPref(prefs::kDeprecatedDiscardedSnippets); 819 pref_service_->ClearPref(prefs::kDeprecatedDiscardedSnippets);
813 } 820 }
814 821
815 } // namespace ntp_snippets 822 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698