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
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_VARIATIONS_METRICS_H_
6 #define COMPONENTS_VARIATIONS_METRICS_H_
7 
8 #include "build/build_config.h"
9 
10 namespace variations {
11 
12 #if defined(OS_ANDROID)
13 // The result of importing a seed during Android first run.
14 // Note: UMA histogram enum - don't re-order or remove entries.
15 enum class FirstRunSeedImportResult {
16   SUCCESS,
17   FAIL_NO_CALLBACK,
18   FAIL_NO_FIRST_RUN_SEED,
19   FAIL_STORE_FAILED,
20   FAIL_INVALID_RESPONSE_DATE,
21   ENUM_SIZE
22 };
23 #endif  // OS_ANDROID
24 
25 // The result of attempting to load a variations seed on startup.
26 // Note: UMA histogram enum - don't re-order or remove entries.
27 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.variations
28 enum class LoadSeedResult {
29   SUCCESS,
30   EMPTY,
31   CORRUPT,
32   INVALID_SIGNATURE,
33   CORRUPT_BASE64,
34   CORRUPT_PROTOBUF,
35   CORRUPT_GZIP,
36   LOAD_TIMED_OUT,
37   LOAD_INTERRUPTED,
38   LOAD_OTHER_FAILURE,
39   ENUM_SIZE
40 };
41 
42 // The result of attempting to store a variations seed received from the server.
43 // Note: UMA histogram enum - don't re-order or remove entries.
44 enum class StoreSeedResult {
45   SUCCESS,
46   FAILED_EMPTY,
47   FAILED_PARSE,
48   FAILED_SIGNATURE,
49   FAILED_GZIP,
50   DELTA_COUNT_OBSOLETE,
51   FAILED_DELTA_READ_SEED,
52   FAILED_DELTA_APPLY,
53   FAILED_DELTA_STORE,
54   FAILED_UNGZIP,
55   FAILED_EMPTY_GZIP_CONTENTS,
56   FAILED_UNSUPPORTED_SEED_FORMAT,
57   // The following are not so much a result of the seed store, but rather
58   // counting the types of seeds the SeedStore() function saw. Kept in the same
59   // histogram for efficiency and convenience of comparing against the other
60   // values.
61   GZIP_DELTA_COUNT,
62   NON_GZIP_DELTA_COUNT,
63   GZIP_FULL_COUNT,
64   NON_GZIP_FULL_COUNT,
65   ENUM_SIZE
66 };
67 
68 // The result of updating the date associated with an existing stored variations
69 // seed.
70 // Note: UMA histogram enum - don't re-order or remove entries.
71 enum class UpdateSeedDateResult {
72   NO_OLD_DATE,
73   NEW_DATE_IS_OLDER,
74   SAME_DAY,
75   NEW_DAY,
76   ENUM_SIZE
77 };
78 
79 // The result of verifying a variation seed's signature.
80 // Note: UMA histogram enum - don't re-order or remove entries.
81 enum class VerifySignatureResult {
82   MISSING_SIGNATURE,
83   DECODE_FAILED,
84   INVALID_SIGNATURE,
85   INVALID_SEED,
86   VALID_SIGNATURE,
87   ENUM_SIZE
88 };
89 
90 #if defined(OS_ANDROID)
91 // Records the result of importing a seed during Android first run.
92 void RecordFirstRunSeedImportResult(FirstRunSeedImportResult result);
93 #endif  // OS_ANDROID
94 
95 // Records the result of attempting to load the latest variations seed on
96 // startup.
97 void RecordLoadSeedResult(LoadSeedResult state);
98 
99 // Records the result of attempting to load the safe variations seed on startup.
100 void RecordLoadSafeSeedResult(LoadSeedResult state);
101 
102 // Records the result of attempting to store a variations seed received from the
103 // server.
104 void RecordStoreSeedResult(StoreSeedResult result);
105 
106 }  // namespace variations
107 
108 #endif  // COMPONENTS_VARIATIONS_METRICS_H_
109