| 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 { |
| 249 // User interacted with a field of this kind of form. Logged only once per |
| 250 // page load. |
| 251 // TODO(waltercacau): All histograms here seem to start with 0, |
| 252 // but the histogram code seems to expect a minimum of 1. Strangely, |
| 253 // they seem to succeed all the assertions as long as there is more then |
| 254 // one enum value. |
| 255 INTERACTED_ONCE = 1, |
| 256 NUM_AUTOFILL_FORM_EVENTS, |
| 257 }; |
| 258 |
| 246 // For measuring the network request time of various Wallet API calls. See | 259 // For measuring the network request time of various Wallet API calls. See |
| 247 // WalletClient::RequestType. | 260 // WalletClient::RequestType. |
| 248 enum WalletApiCallMetric { | 261 enum WalletApiCallMetric { |
| 249 UNKNOWN_API_CALL, // Catch all. Should never be used. | 262 UNKNOWN_API_CALL, // Catch all. Should never be used. |
| 250 ACCEPT_LEGAL_DOCUMENTS, | 263 ACCEPT_LEGAL_DOCUMENTS, |
| 251 AUTHENTICATE_INSTRUMENT, | 264 AUTHENTICATE_INSTRUMENT, |
| 252 GET_FULL_WALLET, | 265 GET_FULL_WALLET, |
| 253 GET_WALLET_ITEMS, | 266 GET_WALLET_ITEMS, |
| 254 SAVE_TO_WALLET, | 267 SAVE_TO_WALLET, |
| 255 NUM_WALLET_API_CALLS | 268 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. | 421 // This should be called each time a new profile is launched. |
| 409 static void LogIsAutofillEnabledAtStartup(bool enabled); | 422 static void LogIsAutofillEnabledAtStartup(bool enabled); |
| 410 | 423 |
| 411 // This should be called each time a new profile is launched. | 424 // This should be called each time a new profile is launched. |
| 412 static void LogStoredProfileCount(size_t num_profiles); | 425 static void LogStoredProfileCount(size_t num_profiles); |
| 413 | 426 |
| 414 // Log the number of Autofill suggestions presented to the user when filling a | 427 // Log the number of Autofill suggestions presented to the user when filling a |
| 415 // form. | 428 // form. |
| 416 static void LogAddressSuggestionsCount(size_t num_suggestions); | 429 static void LogAddressSuggestionsCount(size_t num_suggestions); |
| 417 | 430 |
| 431 // Utility to autofill form events in the relevant histograms depending on |
| 432 // the presence of server and/or local data. |
| 433 class FormEventLogger { |
| 434 public: |
| 435 FormEventLogger(bool is_credit_card); |
| 436 |
| 437 // Sets if server data is available or not. If not called assumed false. |
| 438 void set_is_server_data_available(bool is_server_data_available); |
| 439 |
| 440 // Sets if server data is available or not. If not called assumed false. |
| 441 void set_is_local_data_available(bool is_local_data_available); |
| 442 |
| 443 // Should be called when the user interacted with an autofillable form. |
| 444 void OnDidInteractWithAutofillableForm(); |
| 445 |
| 446 private: |
| 447 // Logs a form event. |
| 448 void Log(AutofillFormEvent event) const; |
| 449 |
| 450 bool is_credit_card_; |
| 451 bool is_server_data_available_; |
| 452 bool is_local_data_available_; |
| 453 bool has_logged_interacted_; |
| 454 }; |
| 455 |
| 418 private: | 456 private: |
| 419 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); | 457 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); |
| 420 }; | 458 }; |
| 421 | 459 |
| 422 } // namespace autofill | 460 } // namespace autofill |
| 423 | 461 |
| 424 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 462 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
| OLD | NEW |