Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: components/ntp_tiles/metrics.h

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

Powered by Google App Engine
This is Rietveld 408576698