Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #import "ios/chrome/browser/passwords/credential_manager.h" | 5 #import "ios/chrome/browser/passwords/credential_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
| 10 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 base::WeakPtr<CredentialManager> weak_this = weak_factory_.GetWeakPtr(); | 277 base::WeakPtr<CredentialManager> weak_this = weak_factory_.GetWeakPtr(); |
| 278 [js_manager_ | 278 [js_manager_ |
| 279 resolvePromiseWithRequestID:request_id | 279 resolvePromiseWithRequestID:request_id |
| 280 credential:WebCredentialFromCredentialInfo(credential) | 280 credential:WebCredentialFromCredentialInfo(credential) |
| 281 completionHandler:^(BOOL) { | 281 completionHandler:^(BOOL) { |
| 282 if (weak_this) | 282 if (weak_this) |
| 283 weak_this->pending_request_.reset(); | 283 weak_this->pending_request_.reset(); |
| 284 }]; | 284 }]; |
| 285 } | 285 } |
| 286 | 286 |
| 287 void CredentialManager::SendPasswordForm(int request_id, | |
| 288 const autofill::PasswordForm* form) { | |
| 289 password_manager::CredentialInfo info; | |
| 290 if (form) { | |
| 291 password_manager::CredentialType type_to_return = | |
| 292 form->federation_origin.unique() | |
| 293 ? password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD | |
| 294 : password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED; | |
| 295 info = password_manager::CredentialInfo(*form, type_to_return); | |
| 296 // TODO(vasilii): update |skip_zero_click| in the store. | |
|
vabr (Chromium)
2016/03/29 16:02:58
nit: Please refer the bug: TODO(crbug.com/...)
vasilii
2016/03/29 16:07:42
Done.
| |
| 297 } | |
| 298 SendCredential(request_id, info); | |
| 299 } | |
| 300 | |
| 287 password_manager::PasswordManagerClient* CredentialManager::client() const { | 301 password_manager::PasswordManagerClient* CredentialManager::client() const { |
| 288 return client_; | 302 return client_; |
| 289 } | 303 } |
| 290 | 304 |
| 291 autofill::PasswordForm CredentialManager::GetSynthesizedFormForOrigin() const { | 305 autofill::PasswordForm CredentialManager::GetSynthesizedFormForOrigin() const { |
| 292 autofill::PasswordForm synthetic_form; | 306 autofill::PasswordForm synthetic_form; |
| 293 synthetic_form.origin = web_state()->GetLastCommittedURL().GetOrigin(); | 307 synthetic_form.origin = web_state()->GetLastCommittedURL().GetOrigin(); |
| 294 synthetic_form.signon_realm = synthetic_form.origin.spec(); | 308 synthetic_form.signon_realm = synthetic_form.origin.spec(); |
| 295 synthetic_form.scheme = autofill::PasswordForm::SCHEME_HTML; | 309 synthetic_form.scheme = autofill::PasswordForm::SCHEME_HTML; |
| 296 synthetic_form.ssl_valid = synthetic_form.origin.SchemeIsCryptographic() && | 310 synthetic_form.ssl_valid = synthetic_form.origin.SchemeIsCryptographic() && |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { | 369 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { |
| 356 web::URLVerificationTrustLevel trust_level = | 370 web::URLVerificationTrustLevel trust_level = |
| 357 web::URLVerificationTrustLevel::kNone; | 371 web::URLVerificationTrustLevel::kNone; |
| 358 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); | 372 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); |
| 359 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { | 373 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { |
| 360 *page_url = possibly_untrusted_url; | 374 *page_url = possibly_untrusted_url; |
| 361 return true; | 375 return true; |
| 362 } | 376 } |
| 363 return false; | 377 return false; |
| 364 } | 378 } |
| OLD | NEW |