Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/doodle/doodle_types.h" | 5 #include "components/doodle/doodle_types.h" |
| 6 | 6 |
| 7 namespace doodle { | 7 namespace doodle { |
| 8 | 8 |
| 9 bool DoodleImage::operator==(const DoodleImage& other) const { | 9 bool DoodleImage::operator==(const DoodleImage& other) const { |
| 10 return url == other.url && height == other.height && width == other.width && | 10 return url == other.url && height == other.height && width == other.width && |
| 11 is_animated_gif == other.is_animated_gif && is_cta == other.is_cta; | 11 is_animated_gif == other.is_animated_gif && is_cta == other.is_cta; |
| 12 } | 12 } |
| 13 | 13 |
| 14 bool DoodleImage::operator!=(const DoodleImage& other) const { | 14 bool DoodleImage::operator!=(const DoodleImage& other) const { |
| 15 return !(*this == other); | 15 return !(*this == other); |
| 16 } | 16 } |
| 17 | 17 |
| 18 bool DoodleConfig::IsEquivalent(const DoodleConfig& other) const { | 18 bool DoodleConfig::IsEquivalent(const DoodleConfig& other) const { |
| 19 // Note: This compares all fields except for |expiry_date|. The reason is that | 19 // Note: This compares all fields except for |time_to_live|, which by |
| 20 // |expiry_date| gets computed as "now + time_to_live", so when an identical | 20 // definition isn't constant over time, and shouldn't be in DoodleConfig in |
| 21 // config gets re-fetched, the expiry date will generally end up slightly | 21 // the first place. |
|
mastiz
2017/03/02 13:50:13
Nit: it's not obvious to me that time_to_live isn'
Marc Treib
2017/03/02 13:53:04
Well, it's a TimeDelta, so it's relative to "now".
| |
| 22 // different. | |
| 23 return doodle_type == other.doodle_type && alt_text == other.alt_text && | 22 return doodle_type == other.doodle_type && alt_text == other.alt_text && |
| 24 interactive_html == other.interactive_html && | 23 interactive_html == other.interactive_html && |
| 25 search_url == other.search_url && target_url == other.target_url && | 24 search_url == other.search_url && target_url == other.target_url && |
| 26 fullpage_interactive_url == other.fullpage_interactive_url && | 25 fullpage_interactive_url == other.fullpage_interactive_url && |
| 27 large_image == other.large_image && | 26 large_image == other.large_image && |
| 28 large_cta_image == other.large_cta_image && | 27 large_cta_image == other.large_cta_image && |
| 29 transparent_large_image == other.transparent_large_image; | 28 transparent_large_image == other.transparent_large_image; |
| 30 } | 29 } |
| 31 | 30 |
| 32 } // namespace doodle | 31 } // namespace doodle |
| OLD | NEW |