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 "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" | 11 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" |
11 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" | 12 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" |
12 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" | 13 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" |
13 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 14 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
14 #include "components/autofill/core/common/autofill_pref_names.h" | 15 #include "components/autofill/core/common/autofill_pref_names.h" |
15 #include "components/infobars/core/infobar.h" | 16 #include "components/infobars/core/infobar.h" |
16 #include "components/infobars/core/infobar_manager.h" | 17 #include "components/infobars/core/infobar_manager.h" |
17 #include "components/keyed_service/core/service_access_type.h" | 18 #include "components/keyed_service/core/service_access_type.h" |
18 #include "components/password_manager/core/browser/password_generation_manager.h
" | 19 #include "components/password_manager/core/browser/password_generation_manager.h
" |
19 #include "components/prefs/pref_service.h" | 20 #include "components/prefs/pref_service.h" |
20 #include "google_apis/gaia/identity_provider.h" | 21 #include "google_apis/gaia/identity_provider.h" |
21 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" | 22 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" |
22 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 23 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
23 #include "ios/chrome/browser/web_data_service_factory.h" | 24 #include "ios/chrome/browser/web_data_service_factory.h" |
24 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 25 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
25 | 26 |
26 namespace autofill { | 27 namespace autofill { |
27 | 28 |
28 AutofillClientIOS::AutofillClientIOS( | 29 AutofillClientIOS::AutofillClientIOS( |
29 ios::ChromeBrowserState* browser_state, | 30 ios::ChromeBrowserState* browser_state, |
30 infobars::InfoBarManager* infobar_manager, | 31 infobars::InfoBarManager* infobar_manager, |
31 id<AutofillClientIOSBridge> bridge, | 32 id<AutofillClientIOSBridge> bridge, |
32 password_manager::PasswordGenerationManager* password_generation_manager, | 33 password_manager::PasswordGenerationManager* password_generation_manager, |
33 scoped_ptr<IdentityProvider> identity_provider) | 34 std::unique_ptr<IdentityProvider> identity_provider) |
34 : browser_state_(browser_state), | 35 : browser_state_(browser_state), |
35 infobar_manager_(infobar_manager), | 36 infobar_manager_(infobar_manager), |
36 bridge_(bridge), | 37 bridge_(bridge), |
37 password_generation_manager_(password_generation_manager), | 38 password_generation_manager_(password_generation_manager), |
38 identity_provider_(std::move(identity_provider)), | 39 identity_provider_(std::move(identity_provider)), |
39 unmask_controller_(browser_state->GetPrefs(), | 40 unmask_controller_(browser_state->GetPrefs(), |
40 browser_state->IsOffTheRecord()) {} | 41 browser_state->IsOffTheRecord()) {} |
41 | 42 |
42 AutofillClientIOS::~AutofillClientIOS() { | 43 AutofillClientIOS::~AutofillClientIOS() { |
43 HideAutofillPopup(); | 44 HideAutofillPopup(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 89 |
89 void AutofillClientIOS::ConfirmSaveCreditCardLocally( | 90 void AutofillClientIOS::ConfirmSaveCreditCardLocally( |
90 const CreditCard& card, | 91 const CreditCard& card, |
91 const base::Closure& callback) { | 92 const base::Closure& callback) { |
92 // This method is invoked synchronously from | 93 // This method is invoked synchronously from |
93 // AutofillManager::OnFormSubmitted(); at the time of detecting that a form | 94 // AutofillManager::OnFormSubmitted(); at the time of detecting that a form |
94 // was submitted, the WebContents is guaranteed to be live. Since the | 95 // was submitted, the WebContents is guaranteed to be live. Since the |
95 // InfoBarService is a WebContentsUserData, it must also be alive at this | 96 // InfoBarService is a WebContentsUserData, it must also be alive at this |
96 // time. | 97 // time. |
97 infobar_manager_->AddInfoBar(CreateSaveCardInfoBarMobile( | 98 infobar_manager_->AddInfoBar(CreateSaveCardInfoBarMobile( |
98 make_scoped_ptr(new AutofillSaveCardInfoBarDelegateMobile( | 99 base::WrapUnique(new AutofillSaveCardInfoBarDelegateMobile( |
99 false, card, scoped_ptr<base::DictionaryValue>(nullptr), callback)))); | 100 false, card, std::unique_ptr<base::DictionaryValue>(nullptr), |
| 101 callback)))); |
100 } | 102 } |
101 | 103 |
102 void AutofillClientIOS::ConfirmSaveCreditCardToCloud( | 104 void AutofillClientIOS::ConfirmSaveCreditCardToCloud( |
103 const CreditCard& card, | 105 const CreditCard& card, |
104 scoped_ptr<base::DictionaryValue> legal_message, | 106 std::unique_ptr<base::DictionaryValue> legal_message, |
105 const base::Closure& callback) { | 107 const base::Closure& callback) { |
106 infobar_manager_->AddInfoBar(CreateSaveCardInfoBarMobile( | 108 infobar_manager_->AddInfoBar(CreateSaveCardInfoBarMobile( |
107 make_scoped_ptr(new AutofillSaveCardInfoBarDelegateMobile( | 109 base::WrapUnique(new AutofillSaveCardInfoBarDelegateMobile( |
108 true, card, std::move(legal_message), callback)))); | 110 true, card, std::move(legal_message), callback)))); |
109 } | 111 } |
110 | 112 |
111 void AutofillClientIOS::LoadRiskData( | 113 void AutofillClientIOS::LoadRiskData( |
112 const base::Callback<void(const std::string&)>& callback) { | 114 const base::Callback<void(const std::string&)>& callback) { |
113 callback.Run(ios::GetChromeBrowserProvider()->GetRiskData()); | 115 callback.Run(ios::GetChromeBrowserProvider()->GetRiskData()); |
114 } | 116 } |
115 | 117 |
116 bool AutofillClientIOS::HasCreditCardScanFeature() { | 118 bool AutofillClientIOS::HasCreditCardScanFeature() { |
117 return false; | 119 return false; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return form_origin.SchemeIsCryptographic(); | 181 return form_origin.SchemeIsCryptographic(); |
180 } | 182 } |
181 | 183 |
182 void AutofillClientIOS::OnFirstUserGestureObserved() { | 184 void AutofillClientIOS::OnFirstUserGestureObserved() { |
183 // TODO(gcasto): [Merge 306796] http://crbug.com/439425 Verify if this method | 185 // TODO(gcasto): [Merge 306796] http://crbug.com/439425 Verify if this method |
184 // needs a real implementation or not. | 186 // needs a real implementation or not. |
185 NOTIMPLEMENTED(); | 187 NOTIMPLEMENTED(); |
186 } | 188 } |
187 | 189 |
188 } // namespace autofill | 190 } // namespace autofill |
OLD | NEW |