Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |