Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "ios/web/public/navigation_item.h" | |
| 31 #include "ios/web/public/navigation_manager.h" | |
| 32 #include "ios/web/public/ssl_status.h" | |
| 33 #include "ios/web/public/web_state/web_state.h" | |
| 30 | 34 |
| 31 namespace autofill { | 35 namespace autofill { |
| 32 | 36 |
| 33 AutofillClientIOS::AutofillClientIOS( | 37 AutofillClientIOS::AutofillClientIOS( |
| 34 ios::ChromeBrowserState* browser_state, | 38 ios::ChromeBrowserState* browser_state, |
| 39 web::WebState* web_state, | |
| 35 infobars::InfoBarManager* infobar_manager, | 40 infobars::InfoBarManager* infobar_manager, |
| 36 id<AutofillClientIOSBridge> bridge, | 41 id<AutofillClientIOSBridge> bridge, |
| 37 password_manager::PasswordGenerationManager* password_generation_manager, | 42 password_manager::PasswordGenerationManager* password_generation_manager, |
| 38 std::unique_ptr<IdentityProvider> identity_provider) | 43 std::unique_ptr<IdentityProvider> identity_provider) |
| 39 : browser_state_(browser_state), | 44 : browser_state_(browser_state), |
| 45 web_state_(web_state), | |
| 40 infobar_manager_(infobar_manager), | 46 infobar_manager_(infobar_manager), |
| 41 bridge_(bridge), | 47 bridge_(bridge), |
| 42 password_generation_manager_(password_generation_manager), | 48 password_generation_manager_(password_generation_manager), |
| 43 identity_provider_(std::move(identity_provider)), | 49 identity_provider_(std::move(identity_provider)), |
| 44 unmask_controller_(browser_state->GetPrefs(), | 50 unmask_controller_(browser_state->GetPrefs(), |
| 45 browser_state->IsOffTheRecord()) {} | 51 browser_state->IsOffTheRecord()) {} |
| 46 | 52 |
| 47 AutofillClientIOS::~AutofillClientIOS() { | 53 AutofillClientIOS::~AutofillClientIOS() { |
| 48 HideAutofillPopup(); | 54 HideAutofillPopup(); |
| 49 } | 55 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 const base::string16& autofilled_value, | 179 const base::string16& autofilled_value, |
| 174 const base::string16& profile_full_name) { | 180 const base::string16& profile_full_name) { |
| 175 } | 181 } |
| 176 | 182 |
| 177 scoped_refptr<AutofillWebDataService> AutofillClientIOS::GetDatabase() { | 183 scoped_refptr<AutofillWebDataService> AutofillClientIOS::GetDatabase() { |
| 178 return ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState( | 184 return ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState( |
| 179 browser_state_, ServiceAccessType::EXPLICIT_ACCESS); | 185 browser_state_, ServiceAccessType::EXPLICIT_ACCESS); |
| 180 } | 186 } |
| 181 | 187 |
| 182 bool AutofillClientIOS::IsContextSecure(const GURL& form_origin) { | 188 bool AutofillClientIOS::IsContextSecure(const GURL& form_origin) { |
| 183 // TODO (sigbjorn): Return if the context is secure, not just | 189 // TODO (sigbjorn): Return if the context is secure, not just |
|
Mathieu
2017/02/04 02:34:57
I feel like this TODO could be addressed if we mov
estark
2017/02/06 22:51:02
If you don't have any qualms about making a functi
| |
| 184 // the form_origin. See crbug.com/505388. | 190 // the form_origin. See crbug.com/505388. |
| 185 return form_origin.SchemeIsCryptographic(); | 191 return form_origin.SchemeIsCryptographic(); |
| 186 } | 192 } |
| 187 | 193 |
| 194 bool AutofillClientIOS::IsMainUrlSecure() { | |
|
Mathieu
2017/02/04 02:34:57
By splitting IsContextSecure and IsMainUrlSecure o
estark
2017/02/06 22:51:02
Yes, but Form-Not-Secure warnings aren't enabled f
| |
| 195 web::NavigationManager* manager = web_state_->GetNavigationManager(); | |
| 196 web::NavigationItem* navItem = manager->GetVisibleItem(); | |
| 197 if (!navItem) | |
| 198 return false; | |
| 199 | |
| 200 const web::SSLStatus& ssl = navItem->GetSSL(); | |
| 201 return navItem->GetURL().SchemeIsCryptographic() && ssl.certificate && | |
| 202 (!net::IsCertStatusError(ssl.cert_status) || | |
| 203 net::IsCertStatusMinorError(ssl.cert_status)); | |
| 204 } | |
| 205 | |
| 188 void AutofillClientIOS::OnFirstUserGestureObserved() { | 206 void AutofillClientIOS::OnFirstUserGestureObserved() { |
| 189 // TODO(gcasto): [Merge 306796] http://crbug.com/439425 Verify if this method | 207 // TODO(gcasto): [Merge 306796] http://crbug.com/439425 Verify if this method |
| 190 // needs a real implementation or not. | 208 // needs a real implementation or not. |
| 191 NOTIMPLEMENTED(); | 209 NOTIMPLEMENTED(); |
| 192 } | 210 } |
| 193 | 211 |
| 194 bool AutofillClientIOS::ShouldShowSigninPromo() { | 212 bool AutofillClientIOS::ShouldShowSigninPromo() { |
| 195 return false; | 213 return false; |
| 196 } | 214 } |
| 197 | 215 |
| 198 void AutofillClientIOS::StartSigninFlow() { | 216 void AutofillClientIOS::StartSigninFlow() { |
| 199 NOTIMPLEMENTED(); | 217 NOTIMPLEMENTED(); |
| 200 } | 218 } |
| 201 | 219 |
| 202 void AutofillClientIOS::ShowHttpNotSecureExplanation() { | 220 void AutofillClientIOS::ShowHttpNotSecureExplanation() { |
| 203 NOTIMPLEMENTED(); | 221 NOTIMPLEMENTED(); |
| 204 } | 222 } |
| 205 | 223 |
| 206 } // namespace autofill | 224 } // namespace autofill |
| OLD | NEW |