Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: ios/chrome/browser/ui/autofill/autofill_client_ios.mm

Issue 2672623005: Record Autofill form events specially for nonsecure pages (Closed)
Patch Set: fix test added in rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/autofill/autofill_client_ios.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/autofill/autofill_client_ios.mm
diff --git a/ios/chrome/browser/ui/autofill/autofill_client_ios.mm b/ios/chrome/browser/ui/autofill/autofill_client_ios.mm
index 2e91efdb660cc539ad9b1d99e99c739d0ae1b55d..562998cfccd3c913de78d2bf917f95a41638dd11 100644
--- a/ios/chrome/browser/ui/autofill/autofill_client_ios.mm
+++ b/ios/chrome/browser/ui/autofill/autofill_client_ios.mm
@@ -27,6 +27,10 @@
#include "ios/chrome/browser/ui/autofill/card_unmask_prompt_view_bridge.h"
#include "ios/chrome/browser/web_data_service_factory.h"
#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/web/public/navigation_item.h"
+#import "ios/web/public/navigation_manager.h"
+#include "ios/web/public/ssl_status.h"
+#import "ios/web/public/web_state/web_state.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
@@ -36,11 +40,13 @@ namespace autofill {
AutofillClientIOS::AutofillClientIOS(
ios::ChromeBrowserState* browser_state,
+ web::WebState* web_state,
infobars::InfoBarManager* infobar_manager,
id<AutofillClientIOSBridge> bridge,
password_manager::PasswordGenerationManager* password_generation_manager,
std::unique_ptr<IdentityProvider> identity_provider)
: browser_state_(browser_state),
+ web_state_(web_state),
infobar_manager_(infobar_manager),
bridge_(bridge),
password_generation_manager_(password_generation_manager),
@@ -183,10 +189,20 @@ scoped_refptr<AutofillWebDataService> AutofillClientIOS::GetDatabase() {
browser_state_, ServiceAccessType::EXPLICIT_ACCESS);
}
-bool AutofillClientIOS::IsContextSecure(const GURL& form_origin) {
- // TODO (sigbjorn): Return if the context is secure, not just
- // the form_origin. See crbug.com/505388.
- return form_origin.SchemeIsCryptographic();
+bool AutofillClientIOS::IsContextSecure() {
+ // This implementation differs slightly from other platforms. Other platforms'
+ // implementations check for the presence of active mixed content, but because
+ // the iOS web view blocks active mixed content without an option to run it,
+ // there is no need to check for active mixed conent here.
+ web::NavigationManager* manager = web_state_->GetNavigationManager();
+ web::NavigationItem* nav_item = manager->GetLastCommittedItem();
+ if (!nav_item)
+ return false;
+
+ const web::SSLStatus& ssl = nav_item->GetSSL();
+ return nav_item->GetURL().SchemeIsCryptographic() && ssl.certificate &&
+ (!net::IsCertStatusError(ssl.cert_status) ||
+ net::IsCertStatusMinorError(ssl.cert_status));
}
void AutofillClientIOS::OnFirstUserGestureObserved() {
« no previous file with comments | « ios/chrome/browser/ui/autofill/autofill_client_ios.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698