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

Side by Side Diff: components/autofill/core/browser/autofill_manager.h

Issue 884843002: Recording in UMA when a user interacted with an address form or a credit card form. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing isherman comments Created 5 years, 10 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 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_MANAGER_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/scoped_vector.h" 18 #include "base/memory/scoped_vector.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "components/autofill/core/browser/autocomplete_history_manager.h" 22 #include "components/autofill/core/browser/autocomplete_history_manager.h"
23 #include "components/autofill/core/browser/autofill_client.h" 23 #include "components/autofill/core/browser/autofill_client.h"
24 #include "components/autofill/core/browser/autofill_download_manager.h" 24 #include "components/autofill/core/browser/autofill_download_manager.h"
25 #include "components/autofill/core/browser/autofill_driver.h" 25 #include "components/autofill/core/browser/autofill_driver.h"
26 #include "components/autofill/core/browser/autofill_metrics.h"
26 #include "components/autofill/core/browser/card_unmask_delegate.h" 27 #include "components/autofill/core/browser/card_unmask_delegate.h"
27 #include "components/autofill/core/browser/form_structure.h" 28 #include "components/autofill/core/browser/form_structure.h"
28 #include "components/autofill/core/browser/personal_data_manager.h" 29 #include "components/autofill/core/browser/personal_data_manager.h"
29 #include "components/autofill/core/common/form_data.h" 30 #include "components/autofill/core/common/form_data.h"
30 31
31 namespace gfx { 32 namespace gfx {
32 class Rect; 33 class Rect;
33 class RectF; 34 class RectF;
34 } 35 }
35 36
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 void OnLoadedServerPredictions(const std::string& response_xml) override; 225 void OnLoadedServerPredictions(const std::string& response_xml) override;
225 226
226 // CardUnmaskDelegate: 227 // CardUnmaskDelegate:
227 void OnUnmaskResponse(const base::string16& cvc) override; 228 void OnUnmaskResponse(const base::string16& cvc) override;
228 void OnUnmaskPromptClosed() override; 229 void OnUnmaskPromptClosed() override;
229 230
230 // A toy method called when the (fake) unmasking process has finished. 231 // A toy method called when the (fake) unmasking process has finished.
231 void OnUnmaskVerificationResult(bool success); 232 void OnUnmaskVerificationResult(bool success);
232 233
233 // Returns false if Autofill is disabled or if no Autofill data is available. 234 // Returns false if Autofill is disabled or if no Autofill data is available.
234 bool RefreshDataModels() const; 235 bool RefreshDataModels();
235 236
236 // Unpacks |unique_id| and fills |form_group| and |variant| with the 237 // Unpacks |unique_id| and fills |form_group| and |variant| with the
237 // appropriate data source and variant index. Sets |is_credit_card| to true 238 // appropriate data source and variant index. Sets |is_credit_card| to true
238 // if |data_model| points to a CreditCard data model, false if it's a 239 // if |data_model| points to a CreditCard data model, false if it's a
239 // profile data model. 240 // profile data model.
240 // Returns false if the unpacked id cannot be found. 241 // Returns false if the unpacked id cannot be found.
241 bool GetProfileOrCreditCard(int unique_id, 242 bool GetProfileOrCreditCard(int unique_id,
242 const AutofillDataModel** data_model, 243 const AutofillDataModel** data_model,
243 size_t* variant, 244 size_t* variant,
244 bool* is_credit_card) const WARN_UNUSED_RESULT; 245 bool* is_credit_card) const WARN_UNUSED_RESULT;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 303
303 // If |initial_interaction_timestamp_| is unset or is set to a later time than 304 // If |initial_interaction_timestamp_| is unset or is set to a later time than
304 // |interaction_timestamp|, updates the cached timestamp. The latter check is 305 // |interaction_timestamp|, updates the cached timestamp. The latter check is
305 // needed because IPC messages can arrive out of order. 306 // needed because IPC messages can arrive out of order.
306 void UpdateInitialInteractionTimestamp( 307 void UpdateInitialInteractionTimestamp(
307 const base::TimeTicks& interaction_timestamp); 308 const base::TimeTicks& interaction_timestamp);
308 309
309 // Shared code to determine if |form| should be uploaded. 310 // Shared code to determine if |form| should be uploaded.
310 bool ShouldUploadForm(const FormStructure& form); 311 bool ShouldUploadForm(const FormStructure& form);
311 312
313 // Utility to log the form event.
314 void LogFormEvent(AutofillMetrics::AutofillFormEvent event,
315 bool is_credit_card);
316
312 // Provides driver-level context to the shared code of the component. Must 317 // Provides driver-level context to the shared code of the component. Must
313 // outlive this object. 318 // outlive this object.
314 AutofillDriver* driver_; 319 AutofillDriver* driver_;
315 320
316 AutofillClient* const client_; 321 AutofillClient* const client_;
317 322
318 std::string app_locale_; 323 std::string app_locale_;
319 324
320 // The personal data manager, used to save and load personal data to/from the 325 // The personal data manager, used to save and load personal data to/from the
321 // web database. This is overridden by the AutofillManagerTest. 326 // web database. This is overridden by the AutofillManagerTest.
322 // Weak reference. 327 // Weak reference.
323 // May be NULL. NULL indicates OTR. 328 // May be NULL. NULL indicates OTR.
324 PersonalDataManager* personal_data_; 329 PersonalDataManager* personal_data_;
325 330
326 std::list<std::string> autofilled_form_signatures_; 331 std::list<std::string> autofilled_form_signatures_;
327 332
328 // Handles queries and uploads to Autofill servers. Will be NULL if 333 // Handles queries and uploads to Autofill servers. Will be NULL if
329 // the download manager functionality is disabled. 334 // the download manager functionality is disabled.
330 scoped_ptr<AutofillDownloadManager> download_manager_; 335 scoped_ptr<AutofillDownloadManager> download_manager_;
331 336
332 // Handles single-field autocomplete form data. 337 // Handles single-field autocomplete form data.
333 scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_; 338 scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_;
334 339
340 // Utilities for logging form events.
341 scoped_ptr<AutofillMetrics::FormEventLogger> address_form_event_logger_;
342 scoped_ptr<AutofillMetrics::FormEventLogger> credit_card_form_event_logger_;
343
335 // Have we logged whether Autofill is enabled for this page load? 344 // Have we logged whether Autofill is enabled for this page load?
336 bool has_logged_autofill_enabled_; 345 bool has_logged_autofill_enabled_;
337 // Have we logged an address suggestions count metric for this page? 346 // Have we logged an address suggestions count metric for this page?
338 bool has_logged_address_suggestions_count_; 347 bool has_logged_address_suggestions_count_;
348 // Have we logged that the user interacted with a credit card form in
349 // this page?
350 bool has_logged_interacted_with_credit_card_form_;
351 // Have we logged that the user interacted with an address form in this page?
352 bool has_logged_interacted_with_address_form_;
339 // Have we shown Autofill suggestions at least once? 353 // Have we shown Autofill suggestions at least once?
340 bool did_show_suggestions_; 354 bool did_show_suggestions_;
341 // Has the user manually edited at least one form field among the autofillable 355 // Has the user manually edited at least one form field among the autofillable
342 // ones? 356 // ones?
343 bool user_did_type_; 357 bool user_did_type_;
344 // Has the user autofilled a form on this page? 358 // Has the user autofilled a form on this page?
345 bool user_did_autofill_; 359 bool user_did_autofill_;
346 // Has the user edited a field that was previously autofilled? 360 // Has the user edited a field that was previously autofilled?
347 bool user_did_edit_autofilled_field_; 361 bool user_did_edit_autofilled_field_;
348 // When the form finished loading. 362 // When the form finished loading.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, 421 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest,
408 AutocompleteOffRespected); 422 AutocompleteOffRespected);
409 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, 423 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest,
410 AutocompleteOffRespectedWithFlag); 424 AutocompleteOffRespectedWithFlag);
411 DISALLOW_COPY_AND_ASSIGN(AutofillManager); 425 DISALLOW_COPY_AND_ASSIGN(AutofillManager);
412 }; 426 };
413 427
414 } // namespace autofill 428 } // namespace autofill
415 429
416 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ 430 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698