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