| 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> |
| 8 |
| 7 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
| 8 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
| 9 #include "base/mac/bind_objc_block.h" | 11 #include "base/mac/bind_objc_block.h" |
| 10 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 11 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 13 #include "components/password_manager/core/browser/password_store_consumer.h" | 15 #include "components/password_manager/core/browser/password_store_consumer.h" |
| 14 #include "components/password_manager/core/common/credential_manager_types.h" | 16 #include "components/password_manager/core/common/credential_manager_types.h" |
| 15 #include "components/password_manager/core/common/password_manager_pref_names.h" | 17 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 16 #import "ios/chrome/browser/passwords/js_credential_manager.h" | 18 #import "ios/chrome/browser/passwords/js_credential_manager.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 297 } |
| 296 | 298 |
| 297 void CredentialManager::OnProvisionalSaveComplete() { | 299 void CredentialManager::OnProvisionalSaveComplete() { |
| 298 // Invoked after a credential sent up by the page was stored in a FormManager | 300 // Invoked after a credential sent up by the page was stored in a FormManager |
| 299 // by |SignedIn|, this function asks the user if the password should be stored | 301 // by |SignedIn|, this function asks the user if the password should be stored |
| 300 // in the password manager. | 302 // in the password manager. |
| 301 DCHECK(form_manager_); | 303 DCHECK(form_manager_); |
| 302 if (client_->IsSavingAndFillingEnabledForCurrentPage() && | 304 if (client_->IsSavingAndFillingEnabledForCurrentPage() && |
| 303 !form_manager_->IsBlacklisted()) { | 305 !form_manager_->IsBlacklisted()) { |
| 304 client_->PromptUserToSaveOrUpdatePassword( | 306 client_->PromptUserToSaveOrUpdatePassword( |
| 305 form_manager_.Pass(), | 307 std::move(form_manager_), |
| 306 password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API, false); | 308 password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API, false); |
| 307 } | 309 } |
| 308 } | 310 } |
| 309 | 311 |
| 310 password_manager::PasswordStore* CredentialManager::GetPasswordStore() { | 312 password_manager::PasswordStore* CredentialManager::GetPasswordStore() { |
| 311 return client_ ? client_->GetPasswordStore() : nullptr; | 313 return client_ ? client_->GetPasswordStore() : nullptr; |
| 312 } | 314 } |
| 313 | 315 |
| 314 void CredentialManager::DoneRequiringUserMediation() { | 316 void CredentialManager::DoneRequiringUserMediation() { |
| 315 // Invoked when the PasswordStore has finished processing the list of origins | 317 // Invoked when the PasswordStore has finished processing the list of origins |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { | 353 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { |
| 352 web::URLVerificationTrustLevel trust_level = | 354 web::URLVerificationTrustLevel trust_level = |
| 353 web::URLVerificationTrustLevel::kNone; | 355 web::URLVerificationTrustLevel::kNone; |
| 354 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); | 356 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); |
| 355 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { | 357 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { |
| 356 *page_url = possibly_untrusted_url; | 358 *page_url = possibly_untrusted_url; |
| 357 return true; | 359 return true; |
| 358 } | 360 } |
| 359 return false; | 361 return false; |
| 360 } | 362 } |
| OLD | NEW |