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

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: Fix some unit tests. 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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 } 694 }
694 695
695 void AutofillManager::OnHidePopup() { 696 void AutofillManager::OnHidePopup() {
696 if (!IsAutofillEnabled()) 697 if (!IsAutofillEnabled())
697 return; 698 return;
698 699
699 autocomplete_history_manager_->CancelPendingQuery(); 700 autocomplete_history_manager_->CancelPendingQuery();
700 client_->HideAutofillPopup(); 701 client_->HideAutofillPopup();
701 } 702 }
702 703
704 void AutofillManager::OnUserDidAcceptAutofillSuggestion(int unique_id) {
705 #if defined(OS_MACOSX) && !defined(OS_IOS)
706 size_t variant = 0;
707 const AutofillProfile* profile = nullptr;
708 bool result = GetProfile(unique_id, &profile, &variant);
Ilya Sherman 2015/05/18 21:36:22 Rather than changing the test code, I think the pr
erikchen 2015/05/18 23:29:40 It does not resolve all of the test failures. I
Ilya Sherman 2015/05/18 23:31:23 It's not an opaque object. What does your code do
709 if (!result)
710 return;
711
712 bool is_from_address_book =
713 profile->record_type() == AutofillProfile::AUXILIARY_PROFILE;
714 UMA_HISTOGRAM_BOOLEAN(
715 "Autofill.MacAddressBook.AcceptedSuggestionIsFromAddressBook",
716 is_from_address_book);
717 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
718 }
719
703 bool AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { 720 bool AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) {
704 std::string guid; 721 std::string guid;
705 size_t variant = 0; 722 size_t variant = 0;
706 const CreditCard* credit_card = nullptr; 723 const CreditCard* credit_card = nullptr;
707 const AutofillProfile* profile = nullptr; 724 const AutofillProfile* profile = nullptr;
708 if (GetCreditCard(unique_id, &credit_card)) { 725 if (GetCreditCard(unique_id, &credit_card)) {
709 if (credit_card->record_type() != CreditCard::LOCAL_CARD) 726 if (credit_card->record_type() != CreditCard::LOCAL_CARD)
710 return false; 727 return false;
711 728
712 guid = credit_card->guid(); 729 guid = credit_card->guid();
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 return false; 1528 return false;
1512 1529
1513 // Disregard forms that we wouldn't ever autofill in the first place. 1530 // Disregard forms that we wouldn't ever autofill in the first place.
1514 if (!form.ShouldBeParsed()) 1531 if (!form.ShouldBeParsed())
1515 return false; 1532 return false;
1516 1533
1517 return true; 1534 return true;
1518 } 1535 }
1519 1536
1520 } // namespace autofill 1537 } // 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