| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 CredentialManager::~CredentialManager() = default; | 95 CredentialManager::~CredentialManager() = default; |
| 96 | 96 |
| 97 void CredentialManager::PageLoaded( | 97 void CredentialManager::PageLoaded( |
| 98 web::PageLoadCompletionStatus load_completion_status) { | 98 web::PageLoadCompletionStatus load_completion_status) { |
| 99 // Ensure the JavaScript is loaded when the page finishes loading. | 99 // Ensure the JavaScript is loaded when the page finishes loading. |
| 100 web::URLVerificationTrustLevel trust_level = | 100 web::URLVerificationTrustLevel trust_level = |
| 101 web::URLVerificationTrustLevel::kNone; | 101 web::URLVerificationTrustLevel::kNone; |
| 102 const GURL page_url(web_state()->GetCurrentURL(&trust_level)); | 102 const GURL page_url(web_state()->GetCurrentURL(&trust_level)); |
| 103 if (!base::ios::IsRunningOnIOS8OrLater() || | 103 if (trust_level != web::URLVerificationTrustLevel::kAbsolute || |
| 104 trust_level != web::URLVerificationTrustLevel::kAbsolute || | |
| 105 !web::UrlHasWebScheme(page_url) || !web_state()->ContentIsHTML()) { | 104 !web::UrlHasWebScheme(page_url) || !web_state()->ContentIsHTML()) { |
| 106 return; | 105 return; |
| 107 } | 106 } |
| 108 [js_manager_ inject]; | 107 [js_manager_ inject]; |
| 109 } | 108 } |
| 110 | 109 |
| 111 void CredentialManager::CredentialsRequested( | 110 void CredentialManager::CredentialsRequested( |
| 112 int request_id, | 111 int request_id, |
| 113 const GURL& source_url, | 112 const GURL& source_url, |
| 114 bool zero_click_only, | 113 bool zero_click_only, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { | 377 bool CredentialManager::GetUrlWithAbsoluteTrust(GURL* page_url) { |
| 379 web::URLVerificationTrustLevel trust_level = | 378 web::URLVerificationTrustLevel trust_level = |
| 380 web::URLVerificationTrustLevel::kNone; | 379 web::URLVerificationTrustLevel::kNone; |
| 381 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); | 380 const GURL possibly_untrusted_url(web_state()->GetCurrentURL(&trust_level)); |
| 382 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { | 381 if (trust_level == web::URLVerificationTrustLevel::kAbsolute) { |
| 383 *page_url = possibly_untrusted_url; | 382 *page_url = possibly_untrusted_url; |
| 384 return true; | 383 return true; |
| 385 } | 384 } |
| 386 return false; | 385 return false; |
| 387 } | 386 } |
| OLD | NEW |