| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_NTP_TILES_METRICS_H_ | 5 #ifndef COMPONENTS_NTP_TILES_METRICS_H_ |
| 6 #define COMPONENTS_NTP_TILES_METRICS_H_ | 6 #define COMPONENTS_NTP_TILES_METRICS_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "components/ntp_tiles/ntp_tile.h" | 11 #include "components/ntp_tiles/ntp_tile.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 namespace rappor { |
| 15 class RapporService; |
| 16 } // namespace rappor |
| 12 | 17 |
| 13 namespace ntp_tiles { | 18 namespace ntp_tiles { |
| 14 namespace metrics { | 19 namespace metrics { |
| 15 | 20 |
| 16 // The visual type of a most visited tile. | 21 // The visual type of a most visited tile. |
| 17 // | 22 // |
| 18 // These values must stay in sync with the MostVisitedTileType enum | 23 // These values must stay in sync with the MostVisitedTileType enum |
| 19 // in histograms.xml. | 24 // in histograms.xml. |
| 20 // | 25 // |
| 21 // A Java counterpart will be generated for this enum. | 26 // A Java counterpart will be generated for this enum. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 // The number of different tile types that get recorded. Entries below this | 37 // The number of different tile types that get recorded. Entries below this |
| 33 // are not recorded in UMA. | 38 // are not recorded in UMA. |
| 34 NUM_RECORDED_TILE_TYPES, | 39 NUM_RECORDED_TILE_TYPES, |
| 35 // The item displays a thumbnail of the page. Used on desktop. | 40 // The item displays a thumbnail of the page. Used on desktop. |
| 36 THUMBNAIL, | 41 THUMBNAIL, |
| 37 // The tile type has not been determined yet. Used on iOS, until we can detect | 42 // The tile type has not been determined yet. Used on iOS, until we can detect |
| 38 // when all tiles have loaded. | 43 // when all tiles have loaded. |
| 39 UNKNOWN_TILE_TYPE, | 44 UNKNOWN_TILE_TYPE, |
| 40 }; | 45 }; |
| 41 | 46 |
| 47 struct TileImpression { |
| 48 TileImpression(NTPTileSource source, |
| 49 MostVisitedTileType type, |
| 50 const GURL& url) |
| 51 : source(source), type(type), url(url) {} |
| 52 |
| 53 NTPTileSource source; |
| 54 MostVisitedTileType type; |
| 55 GURL url; |
| 56 }; |
| 57 |
| 42 // Records an NTP impression, after all tiles have loaded. | 58 // Records an NTP impression, after all tiles have loaded. |
| 43 // Includes the visual types (see above) of all visible tiles. | 59 // Includes the visual types (see above) of all visible tiles. If |
| 44 void RecordPageImpression( | 60 // |rappor_service| is null, no rappor metrics will be reported. |
| 45 const std::vector<std::pair<NTPTileSource, MostVisitedTileType>>& tiles); | 61 void RecordPageImpression(const std::vector<TileImpression>& tiles, |
| 62 rappor::RapporService* rappor_service); |
| 46 | 63 |
| 47 // Records a click on a tile. | 64 // Records a click on a tile. |
| 48 void RecordTileClick(int index, | 65 void RecordTileClick(int index, |
| 49 NTPTileSource source, | 66 NTPTileSource source, |
| 50 MostVisitedTileType tile_type); | 67 MostVisitedTileType tile_type); |
| 51 | 68 |
| 52 } // namespace metrics | 69 } // namespace metrics |
| 53 } // namespace ntp_tiles | 70 } // namespace ntp_tiles |
| 54 | 71 |
| 55 #endif | 72 #endif |
| OLD | NEW |