Chromium Code Reviews| OLD | NEW |
|---|---|
| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #import "base/ios/weak_nsobject.h" | 15 #import "base/ios/weak_nsobject.h" |
| 16 #include "base/json/json_reader.h" | 16 #include "base/json/json_reader.h" |
| 17 #include "base/json/json_writer.h" | 17 #include "base/json/json_writer.h" |
| 18 #include "base/mac/foundation_util.h" | 18 #include "base/mac/foundation_util.h" |
| 19 #include "base/mac/scoped_nsobject.h" | 19 #include "base/mac/scoped_nsobject.h" |
| 20 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
| 22 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
|
jdoerrie
2017/04/12 12:37:46
#include "base/values.h"
vabr (Chromium)
2017/04/12 12:55:04
Done.
| |
| 24 #include "components/autofill/core/common/password_form.h" | 24 #include "components/autofill/core/common/password_form.h" |
| 25 #include "components/autofill/core/common/password_form_fill_data.h" | 25 #include "components/autofill/core/common/password_form_fill_data.h" |
| 26 #include "components/browser_sync/profile_sync_service.h" | 26 #include "components/browser_sync/profile_sync_service.h" |
| 27 #include "components/infobars/core/infobar_manager.h" | 27 #include "components/infobars/core/infobar_manager.h" |
| 28 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 28 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
| 29 #include "components/password_manager/core/browser/password_generation_manager.h " | 29 #include "components/password_manager/core/browser/password_generation_manager.h " |
| 30 #include "components/password_manager/core/browser/password_manager.h" | 30 #include "components/password_manager/core/browser/password_manager.h" |
| 31 #include "components/password_manager/core/browser/password_manager_client.h" | 31 #include "components/password_manager/core/browser/password_manager_client.h" |
| 32 #include "components/password_manager/core/browser/password_manager_driver.h" | 32 #include "components/password_manager/core/browser/password_manager_driver.h" |
| 33 #include "components/sync/driver/sync_service.h" | 33 #include "components/sync/driver/sync_service.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 rootDict.SetString("action", formData.action.spec()); | 213 rootDict.SetString("action", formData.action.spec()); |
| 214 | 214 |
| 215 // Input elements in the form. The list does not necessarily contain | 215 // Input elements in the form. The list does not necessarily contain |
| 216 // all elements from the form, but all elements listed here are required | 216 // all elements from the form, but all elements listed here are required |
| 217 // to identify the right form to fill. | 217 // to identify the right form to fill. |
| 218 auto fieldList = base::MakeUnique<base::ListValue>(); | 218 auto fieldList = base::MakeUnique<base::ListValue>(); |
| 219 | 219 |
| 220 auto usernameField = base::MakeUnique<base::DictionaryValue>(); | 220 auto usernameField = base::MakeUnique<base::DictionaryValue>(); |
| 221 usernameField->SetString("name", formData.username_field.name); | 221 usernameField->SetString("name", formData.username_field.name); |
| 222 usernameField->SetString("value", formData.username_field.value); | 222 usernameField->SetString("value", formData.username_field.value); |
| 223 fieldList->Append(usernameField.release()); | 223 fieldList->Append(std::move(usernameField)); |
| 224 | 224 |
| 225 auto passwordField = base::MakeUnique<base::DictionaryValue>(); | 225 auto passwordField = base::MakeUnique<base::DictionaryValue>(); |
| 226 passwordField->SetString("name", formData.password_field.name); | 226 passwordField->SetString("name", formData.password_field.name); |
| 227 passwordField->SetString("value", formData.password_field.value); | 227 passwordField->SetString("value", formData.password_field.value); |
| 228 fieldList->Append(passwordField.release()); | 228 fieldList->Append(std::move(passwordField)); |
| 229 | 229 |
| 230 rootDict.Set("fields", fieldList.release()); | 230 rootDict.Set("fields", std::move(fieldList)); |
| 231 | 231 |
| 232 std::string jsonString; | 232 std::string jsonString; |
| 233 base::JSONWriter::Write(rootDict, &jsonString); | 233 base::JSONWriter::Write(rootDict, &jsonString); |
| 234 return base::SysUTF8ToNSString(jsonString); | 234 return base::SysUTF8ToNSString(jsonString); |
| 235 } | 235 } |
| 236 | 236 |
| 237 // Returns true if the trust level for the current page URL of |web_state| is | 237 // Returns true if the trust level for the current page URL of |web_state| is |
| 238 // kAbsolute. If |page_url| is not null, fills it with the current page URL. | 238 // kAbsolute. If |page_url| is not null, fills it with the current page URL. |
| 239 bool GetPageURLAndCheckTrustLevel(web::WebState* web_state, GURL* page_url) { | 239 bool GetPageURLAndCheckTrustLevel(web::WebState* web_state, GURL* page_url) { |
| 240 auto trustLevel = web::URLVerificationTrustLevel::kNone; | 240 auto trustLevel = web::URLVerificationTrustLevel::kNone; |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 break; | 874 break; |
| 875 | 875 |
| 876 case PasswordInfoBarType::UPDATE: | 876 case PasswordInfoBarType::UPDATE: |
| 877 IOSChromeUpdatePasswordInfoBarDelegate::Create( | 877 IOSChromeUpdatePasswordInfoBarDelegate::Create( |
| 878 isSmartLockBrandingEnabled, infoBarManager, std::move(form)); | 878 isSmartLockBrandingEnabled, infoBarManager, std::move(form)); |
| 879 break; | 879 break; |
| 880 } | 880 } |
| 881 } | 881 } |
| 882 | 882 |
| 883 @end | 883 @end |
| OLD | NEW |