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

Side by Side Diff: ios/chrome/browser/passwords/password_controller.mm

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #import "ios/chrome/browser/passwords/password_controller.h" 5 #import "ios/chrome/browser/passwords/password_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 std::string JSONString = base::SysNSStringToUTF8(JSONNSString); 448 std::string JSONString = base::SysNSStringToUTF8(JSONNSString);
449 if (JSONString.empty()) { 449 if (JSONString.empty()) {
450 VLOG(1) << "Error in password controller javascript."; 450 VLOG(1) << "Error in password controller javascript.";
451 return; 451 return;
452 } 452 }
453 453
454 int errorCode = 0; 454 int errorCode = 0;
455 std::string errorMessage; 455 std::string errorMessage;
456 std::unique_ptr<base::Value> jsonData(base::JSONReader::ReadAndReturnError( 456 std::unique_ptr<base::Value> jsonData(base::JSONReader::ReadAndReturnError(
457 JSONString, false, &errorCode, &errorMessage)); 457 JSONString, false, &errorCode, &errorMessage));
458 if (errorCode || !jsonData || !jsonData->IsType(base::Value::TYPE_LIST)) { 458 if (errorCode || !jsonData || !jsonData->IsType(base::Value::Type::LIST)) {
459 VLOG(1) << "JSON parse error " << errorMessage 459 VLOG(1) << "JSON parse error " << errorMessage
460 << " JSON string: " << JSONString; 460 << " JSON string: " << JSONString;
461 return; 461 return;
462 } 462 }
463 463
464 const base::ListValue* formDataList; 464 const base::ListValue* formDataList;
465 if (!jsonData->GetAsList(&formDataList)) 465 if (!jsonData->GetAsList(&formDataList))
466 return; 466 return;
467 for (size_t i = 0; i != formDataList->GetSize(); ++i) { 467 for (size_t i = 0; i != formDataList->GetSize(); ++i) {
468 const base::DictionaryValue* formData; 468 const base::DictionaryValue* formData;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 std::unique_ptr<const base::Value> JSONData( 521 std::unique_ptr<const base::Value> JSONData(
522 base::JSONReader::ReadAndReturnError(JSONString, false, &errorCode, 522 base::JSONReader::ReadAndReturnError(JSONString, false, &errorCode,
523 &errorMessage)); 523 &errorMessage));
524 524
525 // If the the JSON string contains null, there is no identifiable password 525 // If the the JSON string contains null, there is no identifiable password
526 // form on the page. 526 // form on the page.
527 if (!errorCode && !JSONData) { 527 if (!errorCode && !JSONData) {
528 return NO; 528 return NO;
529 } 529 }
530 530
531 if (errorCode || !JSONData->IsType(base::Value::TYPE_DICTIONARY)) { 531 if (errorCode || !JSONData->IsType(base::Value::Type::DICTIONARY)) {
532 VLOG(1) << "JSON parse error " << errorMessage 532 VLOG(1) << "JSON parse error " << errorMessage
533 << " JSON string: " << JSONString; 533 << " JSON string: " << JSONString;
534 return NO; 534 return NO;
535 } 535 }
536 536
537 const base::DictionaryValue* passwordJsonData; 537 const base::DictionaryValue* passwordJsonData;
538 return JSONData->GetAsDictionary(&passwordJsonData) && 538 return JSONData->GetAsDictionary(&passwordJsonData) &&
539 [self getPasswordForm:form 539 [self getPasswordForm:form
540 fromDictionary:passwordJsonData 540 fromDictionary:passwordJsonData
541 pageURL:pageURL]; 541 pageURL:pageURL];
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 break; 865 break;
866 866
867 case PasswordInfoBarType::UPDATE: 867 case PasswordInfoBarType::UPDATE:
868 IOSChromeUpdatePasswordInfoBarDelegate::Create( 868 IOSChromeUpdatePasswordInfoBarDelegate::Create(
869 isSmartLockBrandingEnabled, infoBarManager, std::move(form)); 869 isSmartLockBrandingEnabled, infoBarManager, std::move(form));
870 break; 870 break;
871 } 871 }
872 } 872 }
873 873
874 @end 874 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/find_in_page/js_findinpage_manager.mm ('k') | ios/chrome/browser/web_resource/web_resource_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698