| 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 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
| 10 #include "base/mac/bind_objc_block.h" | 10 #include "base/mac/bind_objc_block.h" |
| 11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "components/password_manager/core/browser/form_saver.h" |
| 14 #include "components/password_manager/core/browser/password_store_consumer.h" | 15 #include "components/password_manager/core/browser/password_store_consumer.h" |
| 15 #include "components/password_manager/core/common/credential_manager_types.h" | 16 #include "components/password_manager/core/common/credential_manager_types.h" |
| 16 #include "components/password_manager/core/common/password_manager_pref_names.h" | 17 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 17 #import "ios/chrome/browser/passwords/js_credential_manager.h" | 18 #import "ios/chrome/browser/passwords/js_credential_manager.h" |
| 18 #import "ios/web/public/url_scheme_util.h" | 19 #import "ios/web/public/url_scheme_util.h" |
| 19 #include "ios/web/public/web_state/credential.h" | 20 #include "ios/web/public/web_state/credential.h" |
| 20 #include "ios/web/public/web_state/url_verification_constants.h" | 21 #include "ios/web/public/web_state/url_verification_constants.h" |
| 21 #include "ios/web/public/web_state/web_state.h" | 22 #include "ios/web/public/web_state/web_state.h" |
| 22 #include "url/origin.h" | 23 #include "url/origin.h" |
| 23 | 24 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 CredentialInfoFromWebCredential(credential), page_url)); | 200 CredentialInfoFromWebCredential(credential), page_url)); |
| 200 form->skip_zero_click = !IsZeroClickAllowed(); | 201 form->skip_zero_click = !IsZeroClickAllowed(); |
| 201 | 202 |
| 202 // TODO(mkwst): This is a stub; we should be checking the PasswordStore to | 203 // TODO(mkwst): This is a stub; we should be checking the PasswordStore to |
| 203 // determine whether or not the credential exists, and calling UpdateLogin | 204 // determine whether or not the credential exists, and calling UpdateLogin |
| 204 // accordingly. | 205 // accordingly. |
| 205 form_manager_.reset( | 206 form_manager_.reset( |
| 206 new password_manager::CredentialManagerPasswordFormManager( | 207 new password_manager::CredentialManagerPasswordFormManager( |
| 207 client_, driver_->AsWeakPtr(), | 208 client_, driver_->AsWeakPtr(), |
| 208 *password_manager::CreateObservedPasswordFormFromOrigin(page_url), | 209 *password_manager::CreateObservedPasswordFormFromOrigin(page_url), |
| 209 std::move(form), this)); | 210 std::move(form), this, nullptr, nullptr)); |
| 210 } | 211 } |
| 211 | 212 |
| 212 void CredentialManager::SignedOut(int request_id, const GURL& source_url) { | 213 void CredentialManager::SignedOut(int request_id, const GURL& source_url) { |
| 213 // Invoked when the page invokes navigator.credentials.notifySignedOut, this | 214 // Invoked when the page invokes navigator.credentials.notifySignedOut, this |
| 214 // function notifies the PasswordStore that zero-click sign-in should be | 215 // function notifies the PasswordStore that zero-click sign-in should be |
| 215 // disabled for the current page origin. | 216 // disabled for the current page origin. |
| 216 DCHECK_GE(request_id, 0); | 217 DCHECK_GE(request_id, 0); |
| 217 | 218 |
| 218 // Requests from untrusted origins should be rejected. | 219 // Requests from untrusted origins should be rejected. |
| 219 GURL page_url; | 220 GURL page_url; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { | 363 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { |
| 363 web::URLVerificationTrustLevel trust_level = | 364 web::URLVerificationTrustLevel trust_level = |
| 364 web::URLVerificationTrustLevel::kNone; | 365 web::URLVerificationTrustLevel::kNone; |
| 365 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); | 366 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); |
| 366 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { | 367 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { |
| 367 *page_url = possibly_untrusted_url; | 368 *page_url = possibly_untrusted_url; |
| 368 return true; | 369 return true; |
| 369 } | 370 } |
| 370 return false; | 371 return false; |
| 371 } | 372 } |
| OLD | NEW |