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

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

Issue 1130773004: mac: Add histograms to measure impact of Address Book integration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from isherman, round five. Created 5 years, 7 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 #include "components/autofill/core/browser/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/guid.h" 16 #include "base/guid.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/metrics/field_trial.h" 19 #include "base/metrics/field_trial.h"
20 #include "base/metrics/histogram_macros.h"
20 #include "base/prefs/pref_service.h" 21 #include "base/prefs/pref_service.h"
21 #include "base/strings/string16.h" 22 #include "base/strings/string16.h"
22 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
23 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
24 #include "base/threading/sequenced_worker_pool.h" 25 #include "base/threading/sequenced_worker_pool.h"
25 #include "components/autofill/core/browser/autocomplete_history_manager.h" 26 #include "components/autofill/core/browser/autocomplete_history_manager.h"
26 #include "components/autofill/core/browser/autofill_client.h" 27 #include "components/autofill/core/browser/autofill_client.h"
27 #include "components/autofill/core/browser/autofill_data_model.h" 28 #include "components/autofill/core/browser/autofill_data_model.h"
28 #include "components/autofill/core/browser/autofill_experiments.h" 29 #include "components/autofill/core/browser/autofill_experiments.h"
29 #include "components/autofill/core/browser/autofill_external_delegate.h" 30 #include "components/autofill/core/browser/autofill_external_delegate.h"
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 FillOrPreviewDataModelForm(action, query_id, form, field, profile, variant, 610 FillOrPreviewDataModelForm(action, query_id, form, field, profile, variant,
610 false /* is_credit_card */); 611 false /* is_credit_card */);
611 } 612 }
612 613
613 void AutofillManager::FillOrPreviewForm( 614 void AutofillManager::FillOrPreviewForm(
614 AutofillDriver::RendererFormDataAction action, 615 AutofillDriver::RendererFormDataAction action,
615 int query_id, 616 int query_id,
616 const FormData& form, 617 const FormData& form,
617 const FormFieldData& field, 618 const FormFieldData& field,
618 int unique_id) { 619 int unique_id) {
620 #if defined(OS_MACOSX) && !defined(OS_IOS)
621 EmitIsFromAddressBookMetric(unique_id);
622 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
623
619 if (!IsValidFormData(form) || !IsValidFormFieldData(field)) 624 if (!IsValidFormData(form) || !IsValidFormFieldData(field))
620 return; 625 return;
621 626
622 // NOTE: RefreshDataModels may invalidate |data_model| because it causes the 627 // NOTE: RefreshDataModels may invalidate |data_model| because it causes the
623 // PersonalDataManager to reload Mac address book entries. Thus it must come 628 // PersonalDataManager to reload Mac address book entries. Thus it must come
624 // before GetProfile or GetCreditCard. 629 // before GetProfile or GetCreditCard.
625 if (!RefreshDataModels() || !driver_->RendererIsAvailable()) 630 if (!RefreshDataModels() || !driver_->RendererIsAvailable())
626 return; 631 return;
627 632
628 size_t variant = 0; 633 size_t variant = 0;
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 if (driver_->IsOffTheRecord()) 1515 if (driver_->IsOffTheRecord())
1511 return false; 1516 return false;
1512 1517
1513 // Disregard forms that we wouldn't ever autofill in the first place. 1518 // Disregard forms that we wouldn't ever autofill in the first place.
1514 if (!form.ShouldBeParsed()) 1519 if (!form.ShouldBeParsed())
1515 return false; 1520 return false;
1516 1521
1517 return true; 1522 return true;
1518 } 1523 }
1519 1524
1525 #if defined(OS_MACOSX) && !defined(OS_IOS)
1526 void AutofillManager::EmitIsFromAddressBookMetric(int unique_id) {
1527 size_t variant = 0;
1528 const AutofillProfile* profile = nullptr;
1529 bool result = GetProfile(unique_id, &profile, &variant);
1530 if (!result)
1531 return;
1532
1533 bool is_from_address_book =
1534 profile->record_type() == AutofillProfile::AUXILIARY_PROFILE;
1535 UMA_HISTOGRAM_BOOLEAN(
1536 "Autofill.MacAddressBook.AcceptedSuggestionIsFromAddressBook",
1537 is_from_address_book);
1538 }
1539 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
1540
1520 } // namespace autofill 1541 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | components/autofill/core/browser/personal_data_manager_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698