| 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 #ifndef COMPONENTS_DOODLE_DOODLE_TYPES_H_ | 5 #ifndef COMPONENTS_DOODLE_DOODLE_TYPES_H_ |
| 6 #define COMPONENTS_DOODLE_DOODLE_TYPES_H_ | 6 #define COMPONENTS_DOODLE_DOODLE_TYPES_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" |
| 8 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 9 | 10 |
| 10 namespace doodle { | 11 namespace doodle { |
| 11 | 12 |
| 12 enum class DoodleState { | 13 enum class DoodleState { |
| 13 AVAILABLE, | 14 AVAILABLE, |
| 14 NO_DOODLE, | 15 NO_DOODLE, |
| 15 DOWNLOAD_ERROR, | 16 DOWNLOAD_ERROR, |
| 16 PARSING_ERROR, | 17 PARSING_ERROR, |
| 17 }; | 18 }; |
| 18 | 19 |
| 19 enum class DoodleType { | 20 enum class DoodleType { |
| 20 UNKNOWN, | 21 UNKNOWN, |
| 21 SIMPLE, | 22 SIMPLE, |
| 22 RANDOM, | 23 RANDOM, |
| 23 VIDEO, | 24 VIDEO, |
| 24 INTERACTIVE, | 25 INTERACTIVE, |
| 25 INLINE_INTERACTIVE, | 26 INLINE_INTERACTIVE, |
| 26 SLIDESHOW, | 27 SLIDESHOW, |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 // Information about a Doodle image. If the image is invalid, the |url| will be | 30 // Information about a Doodle image. If the image is invalid, the |url| will be |
| 30 // empty and invalid. By default the dimensions are 0. | 31 // empty and invalid. By default the dimensions are 0. |
| 31 struct DoodleImage { | 32 struct DoodleImage { |
| 32 DoodleImage(); | 33 DoodleImage(); |
| 33 ~DoodleImage(); | 34 ~DoodleImage(); |
| 34 | 35 |
| 36 bool operator==(const DoodleImage& other) const; |
| 37 bool operator!=(const DoodleImage& other) const; |
| 38 |
| 35 GURL url; | 39 GURL url; |
| 36 int height; | 40 int height; |
| 37 int width; | 41 int width; |
| 38 bool is_animated_gif; | 42 bool is_animated_gif; |
| 39 bool is_cta; | 43 bool is_cta; |
| 40 | 44 |
| 41 // Copying and assignment allowed. | 45 // Copying and assignment allowed. |
| 42 }; | 46 }; |
| 43 | 47 |
| 44 // All information about a current doodle that can be fetched from the remote | 48 // All information about a current doodle that can be fetched from the remote |
| 45 // end. By default, all URLs are empty and therefore invalid. | 49 // end. By default, all URLs are empty and therefore invalid. |
| 46 struct DoodleConfig { | 50 struct DoodleConfig { |
| 47 DoodleConfig(); | 51 DoodleConfig(); |
| 48 DoodleConfig(const DoodleConfig& config); // = default; | 52 DoodleConfig(const DoodleConfig& config); // = default; |
| 49 ~DoodleConfig(); | 53 ~DoodleConfig(); |
| 50 | 54 |
| 55 // Checks whether this config is "equivalent" to the other. This compares all |
| 56 // fields for equality, except for |expiry_date|. |
| 57 bool IsEquivalent(const DoodleConfig& other) const; |
| 58 |
| 51 DoodleType doodle_type; | 59 DoodleType doodle_type; |
| 52 std::string alt_text; | 60 std::string alt_text; |
| 53 std::string interactive_html; | 61 std::string interactive_html; |
| 54 | 62 |
| 55 base::Time expiry_date; | |
| 56 GURL search_url; | 63 GURL search_url; |
| 57 GURL target_url; | 64 GURL target_url; |
| 58 GURL fullpage_interactive_url; | 65 GURL fullpage_interactive_url; |
| 59 | 66 |
| 60 DoodleImage large_image; | 67 DoodleImage large_image; |
| 61 DoodleImage large_cta_image; | 68 DoodleImage large_cta_image; |
| 62 DoodleImage transparent_large_image; | 69 DoodleImage transparent_large_image; |
| 70 |
| 71 // TODO(treib,fhorschig): Don't expose this? Clients don't care about it. |
| 72 base::Time expiry_date; |
| 73 |
| 74 // Copying and assignment allowed. |
| 63 }; | 75 }; |
| 64 | 76 |
| 65 } // namespace doodle | 77 } // namespace doodle |
| 66 | 78 |
| 67 #endif // COMPONENTS_DOODLE_DOODLE_TYPES_H_ | 79 #endif // COMPONENTS_DOODLE_DOODLE_TYPES_H_ |
| OLD | NEW |