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

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

Issue 1859453002: components/autofill: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 4 years, 8 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/phone_number_i18n.h" 5 #include "components/autofill/core/browser/phone_number_i18n.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 PhoneObject::PhoneObject(const base::string16& number, 240 PhoneObject::PhoneObject(const base::string16& number,
241 const std::string& region) { 241 const std::string& region) {
242 DCHECK_EQ(2u, region.size()); 242 DCHECK_EQ(2u, region.size());
243 // TODO(isherman): Autofill profiles should always have a |region| set, but in 243 // TODO(isherman): Autofill profiles should always have a |region| set, but in
244 // some cases it should be marked as implicit. Otherwise, phone numbers 244 // some cases it should be marked as implicit. Otherwise, phone numbers
245 // might behave differently when they are synced across computers: 245 // might behave differently when they are synced across computers:
246 // [ http://crbug.com/100845 ]. Once the bug is fixed, add a DCHECK here to 246 // [ http://crbug.com/100845 ]. Once the bug is fixed, add a DCHECK here to
247 // verify. 247 // verify.
248 248
249 scoped_ptr<PhoneNumber> i18n_number(new PhoneNumber); 249 std::unique_ptr<PhoneNumber> i18n_number(new PhoneNumber);
250 if (ParsePhoneNumber(number, region, &country_code_, &city_code_, &number_, 250 if (ParsePhoneNumber(number, region, &country_code_, &city_code_, &number_,
251 &region_, i18n_number.get())) { 251 &region_, i18n_number.get())) {
252 // The phone number was successfully parsed, so store the parsed version. 252 // The phone number was successfully parsed, so store the parsed version.
253 // The formatted and normalized versions will be set on the first call to 253 // The formatted and normalized versions will be set on the first call to
254 // the coresponding methods. 254 // the coresponding methods.
255 i18n_number_ = std::move(i18n_number); 255 i18n_number_ = std::move(i18n_number);
256 } else { 256 } else {
257 // Parsing failed. Store passed phone "as is" into |whole_number_|. 257 // Parsing failed. Store passed phone "as is" into |whole_number_|.
258 whole_number_ = number; 258 whole_number_ = number;
259 } 259 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 number_ = other.number_; 307 number_ = other.number_;
308 308
309 formatted_number_ = other.formatted_number_; 309 formatted_number_ = other.formatted_number_;
310 whole_number_ = other.whole_number_; 310 whole_number_ = other.whole_number_;
311 311
312 return *this; 312 return *this;
313 } 313 }
314 314
315 } // namespace i18n 315 } // namespace i18n
316 } // namespace autofill 316 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/phone_number_i18n.h ('k') | components/autofill/core/browser/test_autofill_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698