OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/autofill_manager.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // The rate for positive/negative matches potentially could be different. | 32 // The rate for positive/negative matches potentially could be different. |
33 const double kAutoFillPositiveUploadRateDefaultValue = 0.01; | 33 const double kAutoFillPositiveUploadRateDefaultValue = 0.01; |
34 const double kAutoFillNegativeUploadRateDefaultValue = 0.01; | 34 const double kAutoFillNegativeUploadRateDefaultValue = 0.01; |
35 | 35 |
36 // Size and offset of the prefix and suffix portions of phone numbers. | 36 // Size and offset of the prefix and suffix portions of phone numbers. |
37 const int kAutoFillPhoneNumberPrefixOffset = 0; | 37 const int kAutoFillPhoneNumberPrefixOffset = 0; |
38 const int kAutoFillPhoneNumberPrefixCount = 3; | 38 const int kAutoFillPhoneNumberPrefixCount = 3; |
39 const int kAutoFillPhoneNumberSuffixOffset = 3; | 39 const int kAutoFillPhoneNumberSuffixOffset = 3; |
40 const int kAutoFillPhoneNumberSuffixCount = 4; | 40 const int kAutoFillPhoneNumberSuffixCount = 4; |
41 | 41 |
42 const string16::value_type kCreditCardPrefix[] = {'*', 0}; | 42 const string16::value_type kCreditCardPrefix[] = {'*',0}; |
43 const string16::value_type kLabelSeparator[] = {';',' ', '*', 0}; | 43 const string16::value_type kLabelSeparator[] = {';',' ','*',0}; |
44 | 44 |
45 // Combines the |label| string with the last four digits of the credit card | 45 // Combines the |label| string with the last four digits of the credit card |
46 // |cc|. If one, the other, or both are empty strings we omit the separator. | 46 // |cc|. If one, the other, or both are empty strings we omit the separator. |
47 string16 CombineLabelAndCreditCard(const string16& label, | 47 string16 CombineLabelAndCreditCard(const string16& label, |
48 const CreditCard* cc) { | 48 const CreditCard* cc) { |
49 if (label.empty()) | 49 if (label.empty()) |
50 return kCreditCardPrefix + cc->LastFourDigits(); | 50 return kCreditCardPrefix + cc->LastFourDigits(); |
51 else if (cc->LastFourDigits().empty()) | 51 else if (cc->LastFourDigits().empty()) |
52 return label; | 52 return label; |
53 else | 53 else |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 795 |
796 // When receiving IDs (across processes) from the renderer we unpack credit card | 796 // When receiving IDs (across processes) from the renderer we unpack credit card |
797 // and profile IDs from a single integer. Credit card IDs are stored in the | 797 // and profile IDs from a single integer. Credit card IDs are stored in the |
798 // high word and profile IDs are stored in the low word. | 798 // high word and profile IDs are stored in the low word. |
799 // static | 799 // static |
800 void AutoFillManager::UnpackIDs(int id, int* cc_id, int* profile_id) { | 800 void AutoFillManager::UnpackIDs(int id, int* cc_id, int* profile_id) { |
801 *cc_id = id >> std::numeric_limits<unsigned short>::digits & | 801 *cc_id = id >> std::numeric_limits<unsigned short>::digits & |
802 std::numeric_limits<unsigned short>::max(); | 802 std::numeric_limits<unsigned short>::max(); |
803 *profile_id = id & std::numeric_limits<unsigned short>::max(); | 803 *profile_id = id & std::numeric_limits<unsigned short>::max(); |
804 } | 804 } |
OLD | NEW |