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

Side by Side Diff: chrome/browser/extensions/api/autofill_private/autofill_private_api.cc

Issue 2028903002: Update Autofill Private API to provide a list of available countries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extensions/api/autofill_private/autofill_private_api.h" 5 #include "chrome/browser/extensions/api/autofill_private/autofill_private_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 profile.set_guid(base::GenerateGUID()); 272 profile.set_guid(base::GenerateGUID());
273 personal_data->AddProfile(profile); 273 personal_data->AddProfile(profile);
274 } else { 274 } else {
275 personal_data->UpdateProfile(profile); 275 personal_data->UpdateProfile(profile);
276 } 276 }
277 277
278 return RespondNow(NoArguments()); 278 return RespondNow(NoArguments());
279 } 279 }
280 280
281 //////////////////////////////////////////////////////////////////////////////// 281 ////////////////////////////////////////////////////////////////////////////////
282 // AutofillPrivateGetCountryListFunction
283
284 AutofillPrivateGetCountryListFunction::AutofillPrivateGetCountryListFunction()
285 : chrome_details_(this) {}
286
287 AutofillPrivateGetCountryListFunction::
288 ~AutofillPrivateGetCountryListFunction() {}
289
290 ExtensionFunction::ResponseAction
291 AutofillPrivateGetCountryListFunction::Run() {
292 autofill::PersonalDataManager* personal_data =
293 autofill::PersonalDataManagerFactory::GetForProfile(
294 chrome_details_.GetProfile());
295 DCHECK(personal_data && personal_data->IsDataLoaded());
stevenjb 2016/06/08 03:43:23 Assuming data is loaded asynchronously, it would b
hcarmona 2016/06/08 15:05:50 Done.
296
297 autofill_util::CountryEntryList countryList =
298 extensions::autofill_util::GenerateCountryList(*personal_data);
299
300 return RespondNow(ArgumentList(
301 api::autofill_private::GetCountryList::Results::Create(countryList)));
302 }
303
304 ////////////////////////////////////////////////////////////////////////////////
282 // AutofillPrivateGetAddressComponentsFunction 305 // AutofillPrivateGetAddressComponentsFunction
283 306
284 AutofillPrivateGetAddressComponentsFunction:: 307 AutofillPrivateGetAddressComponentsFunction::
285 ~AutofillPrivateGetAddressComponentsFunction() {} 308 ~AutofillPrivateGetAddressComponentsFunction() {}
286 309
287 ExtensionFunction::ResponseAction 310 ExtensionFunction::ResponseAction
288 AutofillPrivateGetAddressComponentsFunction::Run() { 311 AutofillPrivateGetAddressComponentsFunction::Run() {
289 std::unique_ptr<api::autofill_private::GetAddressComponents::Params> 312 std::unique_ptr<api::autofill_private::GetAddressComponents::Params>
290 parameters = 313 parameters =
291 api::autofill_private::GetAddressComponents::Params::Create(*args_); 314 api::autofill_private::GetAddressComponents::Params::Create(*args_);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 504
482 autofill_util::CreditCardEntryList creditCardList = 505 autofill_util::CreditCardEntryList creditCardList =
483 extensions::autofill_util::GenerateCreditCardList(*personal_data); 506 extensions::autofill_util::GenerateCreditCardList(*personal_data);
484 507
485 return RespondNow( 508 return RespondNow(
486 ArgumentList(api::autofill_private::GetCreditCardList::Results::Create( 509 ArgumentList(api::autofill_private::GetCreditCardList::Results::Create(
487 creditCardList))); 510 creditCardList)));
488 } 511 }
489 512
490 } // namespace extensions 513 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698