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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/autofill/autofill_client_ios.h" 5 #import "ios/chrome/browser/ui/autofill/autofill_client_ios.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "components/autofill/core/browser/autofill_credit_card_filling_infobar_ delegate_mobile.h" 11 #include "components/autofill/core/browser/autofill_credit_card_filling_infobar_ delegate_mobile.h"
12 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m obile.h" 12 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m obile.h"
13 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" 13 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h"
14 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" 14 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h"
15 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 15 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
16 #include "components/autofill/core/common/autofill_pref_names.h" 16 #include "components/autofill/core/common/autofill_pref_names.h"
17 #include "components/infobars/core/infobar.h" 17 #include "components/infobars/core/infobar.h"
18 #include "components/infobars/core/infobar_manager.h" 18 #include "components/infobars/core/infobar_manager.h"
19 #include "components/keyed_service/core/service_access_type.h" 19 #include "components/keyed_service/core/service_access_type.h"
20 #include "components/password_manager/core/browser/password_generation_manager.h " 20 #include "components/password_manager/core/browser/password_generation_manager.h "
21 #include "components/prefs/pref_service.h" 21 #include "components/prefs/pref_service.h"
22 #include "google_apis/gaia/identity_provider.h" 22 #include "google_apis/gaia/identity_provider.h"
23 #include "ios/chrome/browser/application_context.h" 23 #include "ios/chrome/browser/application_context.h"
24 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" 24 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h"
25 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 25 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
26 #include "ios/chrome/browser/infobars/infobar_utils.h" 26 #include "ios/chrome/browser/infobars/infobar_utils.h"
27 #include "ios/chrome/browser/ui/autofill/card_unmask_prompt_view_bridge.h" 27 #include "ios/chrome/browser/ui/autofill/card_unmask_prompt_view_bridge.h"
28 #include "ios/chrome/browser/web_data_service_factory.h" 28 #include "ios/chrome/browser/web_data_service_factory.h"
29 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 29 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
30 #import "ios/web/public/navigation_item.h"
31 #import "ios/web/public/navigation_manager.h"
32 #include "ios/web/public/ssl_status.h"
33 #import "ios/web/public/web_state/web_state.h"
30 34
31 #if !defined(__has_feature) || !__has_feature(objc_arc) 35 #if !defined(__has_feature) || !__has_feature(objc_arc)
32 #error "This file requires ARC support." 36 #error "This file requires ARC support."
33 #endif 37 #endif
34 38
35 namespace autofill { 39 namespace autofill {
36 40
37 AutofillClientIOS::AutofillClientIOS( 41 AutofillClientIOS::AutofillClientIOS(
38 ios::ChromeBrowserState* browser_state, 42 ios::ChromeBrowserState* browser_state,
43 web::WebState* web_state,
39 infobars::InfoBarManager* infobar_manager, 44 infobars::InfoBarManager* infobar_manager,
40 id<AutofillClientIOSBridge> bridge, 45 id<AutofillClientIOSBridge> bridge,
41 password_manager::PasswordGenerationManager* password_generation_manager, 46 password_manager::PasswordGenerationManager* password_generation_manager,
42 std::unique_ptr<IdentityProvider> identity_provider) 47 std::unique_ptr<IdentityProvider> identity_provider)
43 : browser_state_(browser_state), 48 : browser_state_(browser_state),
49 web_state_(web_state),
44 infobar_manager_(infobar_manager), 50 infobar_manager_(infobar_manager),
45 bridge_(bridge), 51 bridge_(bridge),
46 password_generation_manager_(password_generation_manager), 52 password_generation_manager_(password_generation_manager),
47 identity_provider_(std::move(identity_provider)), 53 identity_provider_(std::move(identity_provider)),
48 unmask_controller_(browser_state->GetPrefs(), 54 unmask_controller_(browser_state->GetPrefs(),
49 browser_state->IsOffTheRecord()) {} 55 browser_state->IsOffTheRecord()) {}
50 56
51 AutofillClientIOS::~AutofillClientIOS() { 57 AutofillClientIOS::~AutofillClientIOS() {
52 HideAutofillPopup(); 58 HideAutofillPopup();
53 } 59 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 void AutofillClientIOS::DidFillOrPreviewField( 182 void AutofillClientIOS::DidFillOrPreviewField(
177 const base::string16& autofilled_value, 183 const base::string16& autofilled_value,
178 const base::string16& profile_full_name) { 184 const base::string16& profile_full_name) {
179 } 185 }
180 186
181 scoped_refptr<AutofillWebDataService> AutofillClientIOS::GetDatabase() { 187 scoped_refptr<AutofillWebDataService> AutofillClientIOS::GetDatabase() {
182 return ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState( 188 return ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState(
183 browser_state_, ServiceAccessType::EXPLICIT_ACCESS); 189 browser_state_, ServiceAccessType::EXPLICIT_ACCESS);
184 } 190 }
185 191
186 bool AutofillClientIOS::IsContextSecure(const GURL& form_origin) { 192 bool AutofillClientIOS::IsContextSecure() {
187 // TODO (sigbjorn): Return if the context is secure, not just 193 // This implementation differs slightly from other platforms. Other platforms'
188 // the form_origin. See crbug.com/505388. 194 // implementations check for the presence of active mixed content, but because
189 return form_origin.SchemeIsCryptographic(); 195 // the iOS web view blocks active mixed content without an option to run it,
196 // there is no need to check for active mixed conent here.
197 web::NavigationManager* manager = web_state_->GetNavigationManager();
198 web::NavigationItem* nav_item = manager->GetLastCommittedItem();
199 if (!nav_item)
200 return false;
201
202 const web::SSLStatus& ssl = nav_item->GetSSL();
203 return nav_item->GetURL().SchemeIsCryptographic() && ssl.certificate &&
204 (!net::IsCertStatusError(ssl.cert_status) ||
205 net::IsCertStatusMinorError(ssl.cert_status));
190 } 206 }
191 207
192 void AutofillClientIOS::OnFirstUserGestureObserved() { 208 void AutofillClientIOS::OnFirstUserGestureObserved() {
193 // TODO(gcasto): [Merge 306796] http://crbug.com/439425 Verify if this method 209 // TODO(gcasto): [Merge 306796] http://crbug.com/439425 Verify if this method
194 // needs a real implementation or not. 210 // needs a real implementation or not.
195 NOTIMPLEMENTED(); 211 NOTIMPLEMENTED();
196 } 212 }
197 213
198 bool AutofillClientIOS::ShouldShowSigninPromo() { 214 bool AutofillClientIOS::ShouldShowSigninPromo() {
199 return false; 215 return false;
200 } 216 }
201 217
202 void AutofillClientIOS::StartSigninFlow() { 218 void AutofillClientIOS::StartSigninFlow() {
203 NOTIMPLEMENTED(); 219 NOTIMPLEMENTED();
204 } 220 }
205 221
206 void AutofillClientIOS::ShowHttpNotSecureExplanation() { 222 void AutofillClientIOS::ShowHttpNotSecureExplanation() {
207 NOTIMPLEMENTED(); 223 NOTIMPLEMENTED();
208 } 224 }
209 225
210 } // namespace autofill 226 } // namespace autofill
OLDNEW
« 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