| 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 "components/ntp_tiles/tile_visual_type.h" |
| 12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 namespace rappor { | 15 namespace rappor { |
| 15 class RapporService; | 16 class RapporService; |
| 16 } // namespace rappor | 17 } // namespace rappor |
| 17 | 18 |
| 18 namespace ntp_tiles { | 19 namespace ntp_tiles { |
| 19 namespace metrics { | 20 namespace metrics { |
| 20 | 21 |
| 21 // The visual type of a most visited tile. | |
| 22 // | |
| 23 // These values must stay in sync with the MostVisitedTileType enum | |
| 24 // in histograms.xml. | |
| 25 // | |
| 26 // A Java counterpart will be generated for this enum. | |
| 27 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ntp | |
| 28 enum MostVisitedTileType { | |
| 29 // The icon or thumbnail hasn't loaded yet. | |
| 30 NONE, | |
| 31 // The item displays a site's actual favicon or touch icon. | |
| 32 ICON_REAL, | |
| 33 // The item displays a color derived from the site's favicon or touch icon. | |
| 34 ICON_COLOR, | |
| 35 // The item displays a default gray box in place of an icon. | |
| 36 ICON_DEFAULT, | |
| 37 // The number of different tile types that get recorded. Entries below this | |
| 38 // are not recorded in UMA. | |
| 39 NUM_RECORDED_TILE_TYPES, | |
| 40 // The item displays a thumbnail of the page. Used on desktop. | |
| 41 THUMBNAIL, | |
| 42 // The tile type has not been determined yet. Used on iOS, until we can detect | |
| 43 // when all tiles have loaded. | |
| 44 UNKNOWN_TILE_TYPE, | |
| 45 }; | |
| 46 | |
| 47 struct TileImpression { | 22 struct TileImpression { |
| 48 TileImpression(NTPTileSource source, | 23 TileImpression(TileSource source, TileVisualType type, const GURL& url) |
| 49 MostVisitedTileType type, | |
| 50 const GURL& url) | |
| 51 : source(source), type(type), url(url) {} | 24 : source(source), type(type), url(url) {} |
| 52 | 25 |
| 53 NTPTileSource source; | 26 TileSource source; |
| 54 MostVisitedTileType type; | 27 TileVisualType type; |
| 55 GURL url; | 28 GURL url; |
| 56 }; | 29 }; |
| 57 | 30 |
| 58 // Records an NTP impression, after all tiles have loaded. | 31 // Records an NTP impression, after all tiles have loaded. |
| 59 // Includes the visual types (see above) of all visible tiles. If | 32 // Includes the visual types (see above) of all visible tiles. If |
| 60 // |rappor_service| is null, no rappor metrics will be reported. | 33 // |rappor_service| is null, no rappor metrics will be reported. |
| 61 void RecordPageImpression(const std::vector<TileImpression>& tiles, | 34 void RecordPageImpression(const std::vector<TileImpression>& tiles, |
| 62 rappor::RapporService* rappor_service); | 35 rappor::RapporService* rappor_service); |
| 63 | 36 |
| 64 // Records a click on a tile. | 37 // Records a click on a tile. |
| 65 void RecordTileClick(int index, | 38 void RecordTileClick(int index, TileSource source, TileVisualType tile_type); |
| 66 NTPTileSource source, | |
| 67 MostVisitedTileType tile_type); | |
| 68 | 39 |
| 69 } // namespace metrics | 40 } // namespace metrics |
| 70 } // namespace ntp_tiles | 41 } // namespace ntp_tiles |
| 71 | 42 |
| 72 #endif | 43 #endif |
| OLD | NEW |