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> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
9 #include "components/autofill/core/browser/autofill_cc_infobar_delegate.h" | 11 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" |
10 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" | 12 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" |
11 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 13 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
12 #include "components/autofill/core/common/autofill_pref_names.h" | 14 #include "components/autofill/core/common/autofill_pref_names.h" |
13 #include "components/infobars/core/infobar_manager.h" | 15 #include "components/infobars/core/infobar_manager.h" |
14 #include "components/keyed_service/core/service_access_type.h" | 16 #include "components/keyed_service/core/service_access_type.h" |
15 #include "components/password_manager/core/browser/password_generation_manager.h
" | 17 #include "components/password_manager/core/browser/password_generation_manager.h
" |
16 #include "google_apis/gaia/identity_provider.h" | 18 #include "google_apis/gaia/identity_provider.h" |
17 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" | 19 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" |
18 #include "ios/chrome/browser/web_data_service_factory.h" | 20 #include "ios/chrome/browser/web_data_service_factory.h" |
19 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.
h" | 21 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.
h" |
20 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 22 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
21 | 23 |
22 namespace autofill { | 24 namespace autofill { |
23 | 25 |
24 AutofillClientIOS::AutofillClientIOS( | 26 AutofillClientIOS::AutofillClientIOS( |
25 ios::ChromeBrowserState* browser_state, | 27 ios::ChromeBrowserState* browser_state, |
26 infobars::InfoBarManager* infobar_manager, | 28 infobars::InfoBarManager* infobar_manager, |
27 id<AutofillClientIOSBridge> bridge, | 29 id<AutofillClientIOSBridge> bridge, |
28 password_manager::PasswordGenerationManager* password_generation_manager, | 30 password_manager::PasswordGenerationManager* password_generation_manager, |
29 scoped_ptr<IdentityProvider> identity_provider) | 31 scoped_ptr<IdentityProvider> identity_provider) |
30 : browser_state_(browser_state), | 32 : browser_state_(browser_state), |
31 infobar_manager_(infobar_manager), | 33 infobar_manager_(infobar_manager), |
32 bridge_(bridge), | 34 bridge_(bridge), |
33 password_generation_manager_(password_generation_manager), | 35 password_generation_manager_(password_generation_manager), |
34 identity_provider_(identity_provider.Pass()), | 36 identity_provider_(std::move(identity_provider)), |
35 unmask_controller_(browser_state->GetPrefs(), | 37 unmask_controller_(browser_state->GetPrefs(), |
36 browser_state->IsOffTheRecord()) {} | 38 browser_state->IsOffTheRecord()) {} |
37 | 39 |
38 AutofillClientIOS::~AutofillClientIOS() { | 40 AutofillClientIOS::~AutofillClientIOS() { |
39 HideAutofillPopup(); | 41 HideAutofillPopup(); |
40 } | 42 } |
41 | 43 |
42 PersonalDataManager* AutofillClientIOS::GetPersonalDataManager() { | 44 PersonalDataManager* AutofillClientIOS::GetPersonalDataManager() { |
43 return PersonalDataManagerFactory::GetForBrowserState( | 45 return PersonalDataManagerFactory::GetForBrowserState( |
44 browser_state_->GetOriginalChromeBrowserState()); | 46 browser_state_->GetOriginalChromeBrowserState()); |
(...skipping 25 matching lines...) Expand all Loading... |
70 unmask_controller_.ShowPrompt( | 72 unmask_controller_.ShowPrompt( |
71 provider->CreateCardUnmaskPromptView(&unmask_controller_), card, | 73 provider->CreateCardUnmaskPromptView(&unmask_controller_), card, |
72 delegate); | 74 delegate); |
73 } | 75 } |
74 | 76 |
75 void AutofillClientIOS::OnUnmaskVerificationResult(PaymentsRpcResult result) { | 77 void AutofillClientIOS::OnUnmaskVerificationResult(PaymentsRpcResult result) { |
76 unmask_controller_.OnVerificationResult(result); | 78 unmask_controller_.OnVerificationResult(result); |
77 } | 79 } |
78 | 80 |
79 void AutofillClientIOS::ConfirmSaveCreditCardLocally( | 81 void AutofillClientIOS::ConfirmSaveCreditCardLocally( |
| 82 const CreditCard& card, |
80 const base::Closure& callback) { | 83 const base::Closure& callback) { |
81 // This method is invoked synchronously from | 84 // This method is invoked synchronously from |
82 // AutofillManager::OnFormSubmitted(); at the time of detecting that a form | 85 // AutofillManager::OnFormSubmitted(); at the time of detecting that a form |
83 // was submitted, the WebContents is guaranteed to be live. Since the | 86 // was submitted, the WebContents is guaranteed to be live. Since the |
84 // InfoBarService is a WebContentsUserData, it must also be alive at this | 87 // InfoBarService is a WebContentsUserData, it must also be alive at this |
85 // time. | 88 // time. |
86 AutofillCCInfoBarDelegate::CreateForLocalSave(infobar_manager_, callback); | 89 AutofillSaveCardInfoBarDelegateMobile::CreateForLocalSave(infobar_manager_, |
| 90 card, callback); |
87 } | 91 } |
88 | 92 |
89 void AutofillClientIOS::ConfirmSaveCreditCardToCloud( | 93 void AutofillClientIOS::ConfirmSaveCreditCardToCloud( |
90 const base::Closure& callback, | 94 const CreditCard& card, |
91 scoped_ptr<base::DictionaryValue> legal_message) { | 95 scoped_ptr<base::DictionaryValue> legal_message, |
92 AutofillCCInfoBarDelegate::CreateForUpload(infobar_manager_, callback); | 96 const base::Closure& callback) { |
| 97 AutofillSaveCardInfoBarDelegateMobile::CreateForUpload( |
| 98 infobar_manager_, card, std::move(legal_message), callback); |
93 } | 99 } |
94 | 100 |
95 void AutofillClientIOS::LoadRiskData( | 101 void AutofillClientIOS::LoadRiskData( |
96 const base::Callback<void(const std::string&)>& callback) { | 102 const base::Callback<void(const std::string&)>& callback) { |
97 callback.Run(ios::GetChromeBrowserProvider()->GetRiskData()); | 103 callback.Run(ios::GetChromeBrowserProvider()->GetRiskData()); |
98 } | 104 } |
99 | 105 |
100 bool AutofillClientIOS::HasCreditCardScanFeature() { | 106 bool AutofillClientIOS::HasCreditCardScanFeature() { |
101 return false; | 107 return false; |
102 } | 108 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return form_origin.SchemeIsCryptographic(); | 169 return form_origin.SchemeIsCryptographic(); |
164 } | 170 } |
165 | 171 |
166 void AutofillClientIOS::OnFirstUserGestureObserved() { | 172 void AutofillClientIOS::OnFirstUserGestureObserved() { |
167 // TODO(gcasto): [Merge 306796] http://crbug.com/439425 Verify if this method | 173 // TODO(gcasto): [Merge 306796] http://crbug.com/439425 Verify if this method |
168 // needs a real implementation or not. | 174 // needs a real implementation or not. |
169 NOTIMPLEMENTED(); | 175 NOTIMPLEMENTED(); |
170 } | 176 } |
171 | 177 |
172 } // namespace autofill | 178 } // namespace autofill |
OLD | NEW |