| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } else if (exploded.hour < kWifiFetchingHourMax) { | 132 } else if (exploded.hour < kWifiFetchingHourMax) { |
| 133 exploded.hour = kWifiFetchingHourMax; | 133 exploded.hour = kWifiFetchingHourMax; |
| 134 } else { | 134 } else { |
| 135 next_day = true; | 135 next_day = true; |
| 136 exploded.hour = kWifiFetchingHourMin; | 136 exploded.hour = kWifiFetchingHourMin; |
| 137 } | 137 } |
| 138 // In any case, reschedule at the full hour. | 138 // In any case, reschedule at the full hour. |
| 139 exploded.minute = 0; | 139 exploded.minute = 0; |
| 140 exploded.second = 0; | 140 exploded.second = 0; |
| 141 exploded.millisecond = 0; | 141 exploded.millisecond = 0; |
| 142 base::Time reschedule = base::Time::FromLocalExploded(exploded); | 142 base::Time reschedule; |
| 143 if (!base::Time::FromLocalExploded(exploded, &reschedule)) { |
| 144 return GetRescheduleTime(now + base::TimeDelta::FromDays(1)); |
| 145 } |
| 146 |
| 143 if (next_day) | 147 if (next_day) |
| 144 reschedule += base::TimeDelta::FromDays(1); | 148 reschedule += base::TimeDelta::FromDays(1); |
| 145 | 149 |
| 146 return reschedule; | 150 return reschedule; |
| 147 } | 151 } |
| 148 | 152 |
| 149 // Extracts the hosts from |suggestions| and returns them in a set. | 153 // Extracts the hosts from |suggestions| and returns them in a set. |
| 150 std::set<std::string> GetSuggestionsHostsImpl( | 154 std::set<std::string> GetSuggestionsHostsImpl( |
| 151 const SuggestionsProfile& suggestions) { | 155 const SuggestionsProfile& suggestions) { |
| 152 std::set<std::string> hosts; | 156 std::set<std::string> hosts; |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 return; | 761 return; |
| 758 } | 762 } |
| 759 } | 763 } |
| 760 | 764 |
| 761 void NTPSnippetsService::ClearDeprecatedPrefs() { | 765 void NTPSnippetsService::ClearDeprecatedPrefs() { |
| 762 pref_service_->ClearPref(prefs::kDeprecatedSnippets); | 766 pref_service_->ClearPref(prefs::kDeprecatedSnippets); |
| 763 pref_service_->ClearPref(prefs::kDeprecatedDiscardedSnippets); | 767 pref_service_->ClearPref(prefs::kDeprecatedDiscardedSnippets); |
| 764 } | 768 } |
| 765 | 769 |
| 766 } // namespace ntp_snippets | 770 } // namespace ntp_snippets |
| OLD | NEW |