OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 USER_DID_AUTOFILL, | 236 USER_DID_AUTOFILL, |
237 // Same as above, but only logged once per page load. | 237 // Same as above, but only logged once per page load. |
238 USER_DID_AUTOFILL_ONCE, | 238 USER_DID_AUTOFILL_ONCE, |
239 // User edited a previously autofilled field. | 239 // User edited a previously autofilled field. |
240 USER_DID_EDIT_AUTOFILLED_FIELD, | 240 USER_DID_EDIT_AUTOFILLED_FIELD, |
241 // Same as above, but only logged once per page load. | 241 // Same as above, but only logged once per page load. |
242 USER_DID_EDIT_AUTOFILLED_FIELD_ONCE, | 242 USER_DID_EDIT_AUTOFILLED_FIELD_ONCE, |
243 NUM_USER_HAPPINESS_METRICS, | 243 NUM_USER_HAPPINESS_METRICS, |
244 }; | 244 }; |
245 | 245 |
246 // Form Events for autofill. | |
247 // These events are triggered separetly for address and credit card forms. | |
248 enum AutofillFormEvent { | |
Ilya Sherman
2015/02/02 22:32:16
Since this enum is already in a class that has "Au
Walter Cacau
2015/02/03 00:47:40
Done.
| |
249 // User interacted with a field of this kind of form. Logged only once per | |
250 // page load. | |
251 INTERACTED_ONCE_FORM_EVENT = 0, | |
Ilya Sherman
2015/02/02 22:32:16
nit: By convention, FORM_EVENT should be the prefi
Walter Cacau
2015/02/03 00:47:40
Done.
| |
252 // TODO(waltercacau): Remove the 2 here once we add more events. | |
253 // This circunvents an assertion that gets triggered when you have | |
Ilya Sherman
2015/02/02 22:32:16
nit: "circunvents" -> "circumvents"
Walter Cacau
2015/02/03 00:47:40
Done.
| |
254 // only one bucket. | |
255 NUM_AUTOFILL_FORM_EVENTS = 2, | |
256 }; | |
257 | |
246 // For measuring the network request time of various Wallet API calls. See | 258 // For measuring the network request time of various Wallet API calls. See |
247 // WalletClient::RequestType. | 259 // WalletClient::RequestType. |
248 enum WalletApiCallMetric { | 260 enum WalletApiCallMetric { |
249 UNKNOWN_API_CALL, // Catch all. Should never be used. | 261 UNKNOWN_API_CALL, // Catch all. Should never be used. |
250 ACCEPT_LEGAL_DOCUMENTS, | 262 ACCEPT_LEGAL_DOCUMENTS, |
251 AUTHENTICATE_INSTRUMENT, | 263 AUTHENTICATE_INSTRUMENT, |
252 GET_FULL_WALLET, | 264 GET_FULL_WALLET, |
253 GET_WALLET_ITEMS, | 265 GET_WALLET_ITEMS, |
254 SAVE_TO_WALLET, | 266 SAVE_TO_WALLET, |
255 NUM_WALLET_API_CALLS | 267 NUM_WALLET_API_CALLS |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 // This should be called each time a new profile is launched. | 420 // This should be called each time a new profile is launched. |
409 static void LogIsAutofillEnabledAtStartup(bool enabled); | 421 static void LogIsAutofillEnabledAtStartup(bool enabled); |
410 | 422 |
411 // This should be called each time a new profile is launched. | 423 // This should be called each time a new profile is launched. |
412 static void LogStoredProfileCount(size_t num_profiles); | 424 static void LogStoredProfileCount(size_t num_profiles); |
413 | 425 |
414 // Log the number of Autofill suggestions presented to the user when filling a | 426 // Log the number of Autofill suggestions presented to the user when filling a |
415 // form. | 427 // form. |
416 static void LogAddressSuggestionsCount(size_t num_suggestions); | 428 static void LogAddressSuggestionsCount(size_t num_suggestions); |
417 | 429 |
430 // Utility to autofill form events in the relevant histograms depending on | |
431 // the presence of server and/or local data. | |
432 class FormEventLogger { | |
433 public: | |
434 FormEventLogger(bool is_credit_card); | |
435 | |
436 // Sets if server data is available or not. If not called assumed false. | |
437 void set_is_server_data_available(bool is_server_data_available); | |
Evan Stade
2015/02/02 23:13:12
inline this function
Walter Cacau
2015/02/03 00:47:40
Done.
| |
438 | |
439 // Sets if server data is available or not. If not called assumed false. | |
440 void set_is_local_data_available(bool is_local_data_available); | |
Evan Stade
2015/02/02 23:13:12
inline this function
Walter Cacau
2015/02/03 00:47:40
Done.
| |
441 | |
442 // Should be called when the user interacted with an autofillable form. | |
443 void OnDidInteractWithAutofillableForm(); | |
Evan Stade
2015/02/02 23:13:12
move above the setters
Walter Cacau
2015/02/03 00:47:40
Done.
| |
444 | |
445 private: | |
446 // Logs a form event. | |
447 void Log(AutofillFormEvent event) const; | |
448 | |
449 bool is_credit_card_; | |
Evan Stade
2015/02/02 23:13:12
nit: variable name doesn't sound quite right. It's
Walter Cacau
2015/02/03 00:47:40
You are right. Doing is_for_credit_card_ just beca
| |
450 bool is_server_data_available_; | |
451 bool is_local_data_available_; | |
452 bool has_logged_interacted_; | |
453 }; | |
454 | |
418 private: | 455 private: |
419 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); | 456 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); |
420 }; | 457 }; |
421 | 458 |
422 } // namespace autofill | 459 } // namespace autofill |
423 | 460 |
424 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 461 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
OLD | NEW |