| 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 #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 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <limits> | 11 #include <limits> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/containers/adapters.h" | 19 #include "base/containers/adapters.h" |
| 20 #include "base/feature_list.h" | 20 #include "base/feature_list.h" |
| 21 #include "base/files/file_util.h" | 21 #include "base/files/file_util.h" |
| 22 #include "base/guid.h" | 22 #include "base/guid.h" |
| 23 #include "base/logging.h" | 23 #include "base/logging.h" |
| 24 #include "base/memory/ptr_util.h" | 24 #include "base/memory/ptr_util.h" |
| 25 #include "base/message_loop/message_loop.h" | 25 #include "base/message_loop/message_loop.h" |
| 26 #include "base/path_service.h" | 26 #include "base/path_service.h" |
| 27 #include "base/strings/string16.h" | 27 #include "base/strings/string16.h" |
| 28 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
| 29 #include "base/strings/string_piece.h" |
| 29 #include "base/strings/string_split.h" | 30 #include "base/strings/string_split.h" |
| 30 #include "base/strings/string_util.h" | 31 #include "base/strings/string_util.h" |
| 31 #include "base/strings/utf_string_conversions.h" | 32 #include "base/strings/utf_string_conversions.h" |
| 32 #include "base/threading/sequenced_worker_pool.h" | 33 #include "base/threading/sequenced_worker_pool.h" |
| 33 #include "base/threading/thread_restrictions.h" | 34 #include "base/threading/thread_restrictions.h" |
| 34 #include "build/build_config.h" | 35 #include "build/build_config.h" |
| 35 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 36 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
| 36 #include "components/autofill/core/browser/autofill_client.h" | 37 #include "components/autofill/core/browser/autofill_client.h" |
| 37 #include "components/autofill/core/browser/autofill_data_model.h" | 38 #include "components/autofill/core/browser/autofill_data_model.h" |
| 38 #include "components/autofill/core/browser/autofill_experiments.h" | 39 #include "components/autofill/core/browser/autofill_experiments.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // If |name| consists of three whitespace-separated parts and the second of the | 124 // If |name| consists of three whitespace-separated parts and the second of the |
| 124 // three parts is a single character or a single character followed by a period, | 125 // three parts is a single character or a single character followed by a period, |
| 125 // returns the result of joining the first and third parts with a space. | 126 // returns the result of joining the first and third parts with a space. |
| 126 // Otherwise, returns |name|. | 127 // Otherwise, returns |name|. |
| 127 // | 128 // |
| 128 // Note that a better way to do this would be to use SplitName from | 129 // Note that a better way to do this would be to use SplitName from |
| 129 // src/components/autofill/core/browser/contact_info.cc. However, for now we | 130 // src/components/autofill/core/browser/contact_info.cc. However, for now we |
| 130 // want the logic of which variations of names are considered to be the same to | 131 // want the logic of which variations of names are considered to be the same to |
| 131 // exactly match the logic applied on the Payments server. | 132 // exactly match the logic applied on the Payments server. |
| 132 base::string16 RemoveMiddleInitial(const base::string16& name) { | 133 base::string16 RemoveMiddleInitial(const base::string16& name) { |
| 133 std::vector<base::string16> parts = | 134 std::vector<base::StringPiece16> parts = |
| 134 base::SplitString(name, base::kWhitespaceUTF16, base::KEEP_WHITESPACE, | 135 base::SplitStringPiece(name, base::kWhitespaceUTF16, |
| 135 base::SPLIT_WANT_NONEMPTY); | 136 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 136 if (parts.size() == 3 && (parts[1].length() == 1 || | 137 if (parts.size() == 3 && (parts[1].length() == 1 || |
| 137 (parts[1].length() == 2 && | 138 (parts[1].length() == 2 && |
| 138 base::EndsWith(parts[1], base::ASCIIToUTF16("."), | 139 base::EndsWith(parts[1], base::ASCIIToUTF16("."), |
| 139 base::CompareCase::SENSITIVE)))) { | 140 base::CompareCase::SENSITIVE)))) { |
| 140 parts.erase(parts.begin() + 1); | 141 parts.erase(parts.begin() + 1); |
| 141 return base::JoinString(parts, base::ASCIIToUTF16(" ")); | 142 return base::JoinString(parts, base::ASCIIToUTF16(" ")); |
| 142 } | 143 } |
| 143 return name; | 144 return name; |
| 144 } | 145 } |
| 145 | 146 |
| (...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 } | 2198 } |
| 2198 #endif // ENABLE_FORM_DEBUG_DUMP | 2199 #endif // ENABLE_FORM_DEBUG_DUMP |
| 2199 | 2200 |
| 2200 void AutofillManager::LogCardUploadDecisionUkm( | 2201 void AutofillManager::LogCardUploadDecisionUkm( |
| 2201 AutofillMetrics::CardUploadDecisionMetric upload_decision) { | 2202 AutofillMetrics::CardUploadDecisionMetric upload_decision) { |
| 2202 AutofillMetrics::LogCardUploadDecisionUkm( | 2203 AutofillMetrics::LogCardUploadDecisionUkm( |
| 2203 client_->GetUkmService(), pending_upload_request_url_, upload_decision); | 2204 client_->GetUkmService(), pending_upload_request_url_, upload_decision); |
| 2204 } | 2205 } |
| 2205 | 2206 |
| 2206 } // namespace autofill | 2207 } // namespace autofill |
| OLD | NEW |