sfiera | 635d21d | 2016-08-04 07:56:09 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_NTP_TILES_NTP_TILE_H_ |
| 6 | #define COMPONENTS_NTP_TILES_NTP_TILE_H_ |
| 7 | |
| 8 | #include <vector> |
| 9 | |
| 10 | #include "base/files/file_path.h" |
| 11 | #include "base/macros.h" |
| 12 | #include "base/strings/string16.h" |
Mikel Astiz | a0f98cc | 2017-10-12 19:48:48 | [diff] [blame] | 13 | #include "base/time/time.h" |
treib | 231212e | 2017-04-04 17:09:22 | [diff] [blame] | 14 | #include "components/ntp_tiles/tile_source.h" |
Friedrich Horschig | efec081 | 2017-09-28 18:50:17 | [diff] [blame] | 15 | #include "components/ntp_tiles/tile_title_source.h" |
sfiera | 635d21d | 2016-08-04 07:56:09 | [diff] [blame] | 16 | #include "url/gurl.h" |
| 17 | |
| 18 | namespace ntp_tiles { |
| 19 | |
sfiera | 635d21d | 2016-08-04 07:56:09 | [diff] [blame] | 20 | // A suggested site shown on the New Tab Page. |
| 21 | struct NTPTile { |
| 22 | base::string16 title; |
| 23 | GURL url; |
Friedrich Horschig | efec081 | 2017-09-28 18:50:17 | [diff] [blame] | 24 | TileTitleSource title_source; |
treib | 231212e | 2017-04-04 17:09:22 | [diff] [blame] | 25 | TileSource source; |
sfiera | 635d21d | 2016-08-04 07:56:09 | [diff] [blame] | 26 | |
sfiera | 51fb981 | 2016-12-08 18:36:02 | [diff] [blame] | 27 | // Empty unless whitelists are enabled and this site is in a whitelist. |
| 28 | // However, may be non-empty even if |source| is not |WHITELIST|, if this tile |
| 29 | // is also available from another, higher-priority source. |
sfiera | 635d21d | 2016-08-04 07:56:09 | [diff] [blame] | 30 | base::FilePath whitelist_icon_path; |
| 31 | |
treib | bb0c5af5 | 2016-12-09 17:34:15 | [diff] [blame] | 32 | // This won't be empty, but might 404 etc. |
| 33 | GURL favicon_url; |
| 34 | |
Mikel Astiz | a0f98cc | 2017-10-12 19:48:48 | [diff] [blame] | 35 | // Timestamp representing when the tile was originally generated (produced by |
| 36 | // a ranking algorithm). |
| 37 | base::Time data_generation_time; |
| 38 | |
Kristi Park | e0e9f51 | 2019-03-01 23:26:04 | [diff] [blame] | 39 | // True if this tile is a custom link and was initialized from a Most Visited |
| 40 | // item. Used for debugging. |
| 41 | bool from_most_visited = false; |
| 42 | |
sfiera | 635d21d | 2016-08-04 07:56:09 | [diff] [blame] | 43 | NTPTile(); |
sfiera | 08b57f8 | 2016-09-22 10:14:27 | [diff] [blame] | 44 | NTPTile(const NTPTile&); |
sfiera | 635d21d | 2016-08-04 07:56:09 | [diff] [blame] | 45 | ~NTPTile(); |
sfiera | 635d21d | 2016-08-04 07:56:09 | [diff] [blame] | 46 | }; |
| 47 | |
sfiera | 3140e14 | 2017-03-07 16:00:48 | [diff] [blame] | 48 | bool operator==(const NTPTile& a, const NTPTile& b); |
| 49 | bool operator!=(const NTPTile& a, const NTPTile& b); |
| 50 | |
sfiera | 635d21d | 2016-08-04 07:56:09 | [diff] [blame] | 51 | using NTPTilesVector = std::vector<NTPTile>; |
| 52 | |
| 53 | } // namespace ntp_tiles |
| 54 | |
| 55 | #endif // COMPONENTS_NTP_TILES_NTP_TILE_H_ |