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 FormEvent { |
| 249 // User interacted with a field of this kind of form. Logged only once per |
| 250 // page load. |
| 251 FORM_EVENT_INTERACTED_ONCE = 0, |
| 252 // TODO(waltercacau): Remove the 2 here once we add more events. |
| 253 // This circumvents an assertion that gets triggered when you have |
| 254 // only one bucket. |
| 255 NUM_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_for_credit_card); |
| 435 |
| 436 // Should be called when the user interacted with an autofillable form. |
| 437 void OnDidInteractWithAutofillableForm(); |
| 438 |
| 439 // Sets if server data is available or not. If not called assumed false. |
| 440 inline void set_is_server_data_available(bool is_server_data_available) { |
| 441 is_server_data_available_ = is_server_data_available; |
| 442 } |
| 443 |
| 444 // Sets if server data is available or not. If not called assumed false. |
| 445 inline void set_is_local_data_available(bool is_local_data_available) { |
| 446 is_local_data_available_ = is_local_data_available; |
| 447 } |
| 448 |
| 449 private: |
| 450 // Logs a form event. |
| 451 void Log(FormEvent event) const; |
| 452 |
| 453 bool is_for_credit_card_; |
| 454 bool is_server_data_available_; |
| 455 bool is_local_data_available_; |
| 456 bool has_logged_interacted_; |
| 457 }; |
| 458 |
418 private: | 459 private: |
419 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); | 460 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); |
420 }; | 461 }; |
421 | 462 |
422 } // namespace autofill | 463 } // namespace autofill |
423 | 464 |
424 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 465 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
OLD | NEW |