| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/history/core/browser/history_types.h" | 5 #include "components/history/core/browser/history_types.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 QueryOptions::QueryOptions() | 157 QueryOptions::QueryOptions() |
| 158 : max_count(0), | 158 : max_count(0), |
| 159 duplicate_policy(QueryOptions::REMOVE_ALL_DUPLICATES) { | 159 duplicate_policy(QueryOptions::REMOVE_ALL_DUPLICATES) { |
| 160 } | 160 } |
| 161 | 161 |
| 162 void QueryOptions::SetRecentDayRange(int days_ago) { | 162 void QueryOptions::SetRecentDayRange(int days_ago) { |
| 163 end_time = base::Time::Now(); | 163 end_time = base::Time::Now(); |
| 164 begin_time = end_time - base::TimeDelta::FromDays(days_ago); | 164 begin_time = end_time - base::TimeDelta::FromDays(days_ago); |
| 165 } | 165 } |
| 166 | 166 |
| 167 int64 QueryOptions::EffectiveBeginTime() const { | 167 int64_t QueryOptions::EffectiveBeginTime() const { |
| 168 return begin_time.ToInternalValue(); | 168 return begin_time.ToInternalValue(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 int64 QueryOptions::EffectiveEndTime() const { | 171 int64_t QueryOptions::EffectiveEndTime() const { |
| 172 return end_time.is_null() ? | 172 return end_time.is_null() ? std::numeric_limits<int64_t>::max() |
| 173 std::numeric_limits<int64>::max() : end_time.ToInternalValue(); | 173 : end_time.ToInternalValue(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 int QueryOptions::EffectiveMaxCount() const { | 176 int QueryOptions::EffectiveMaxCount() const { |
| 177 return max_count ? max_count : std::numeric_limits<int>::max(); | 177 return max_count ? max_count : std::numeric_limits<int>::max(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 // QueryURLResult ------------------------------------------------------------- | 180 // QueryURLResult ------------------------------------------------------------- |
| 181 | 181 |
| 182 QueryURLResult::QueryURLResult() : success(false) { | 182 QueryURLResult::QueryURLResult() : success(false) { |
| 183 } | 183 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 void ExpireHistoryArgs::SetTimeRangeForOneDay(base::Time time) { | 322 void ExpireHistoryArgs::SetTimeRangeForOneDay(base::Time time) { |
| 323 begin_time = time.LocalMidnight(); | 323 begin_time = time.LocalMidnight(); |
| 324 | 324 |
| 325 // Due to DST, leap seconds, etc., the next day at midnight may be more than | 325 // Due to DST, leap seconds, etc., the next day at midnight may be more than |
| 326 // 24 hours away, so add 36 hours and round back down to midnight. | 326 // 24 hours away, so add 36 hours and round back down to midnight. |
| 327 end_time = (begin_time + base::TimeDelta::FromHours(36)).LocalMidnight(); | 327 end_time = (begin_time + base::TimeDelta::FromHours(36)).LocalMidnight(); |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace history | 330 } // namespace history |
| OLD | NEW |