OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 const GURL& source_url, | 54 const GURL& source_url, |
55 const content::SSLStatus& ssl_status, | 55 const content::SSLStatus& ssl_status, |
56 const base::Callback<void(const FormStructure*)>& callback); | 56 const base::Callback<void(const FormStructure*)>& callback); |
57 virtual ~AutofillDialogControllerImpl(); | 57 virtual ~AutofillDialogControllerImpl(); |
58 | 58 |
59 void Show(); | 59 void Show(); |
60 void Hide(); | 60 void Hide(); |
61 | 61 |
62 // AutofillDialogController implementation. | 62 // AutofillDialogController implementation. |
63 virtual string16 DialogTitle() const OVERRIDE; | 63 virtual string16 DialogTitle() const OVERRIDE; |
| 64 virtual string16 AccountChooserText() const OVERRIDE; |
64 virtual string16 EditSuggestionText() const OVERRIDE; | 65 virtual string16 EditSuggestionText() const OVERRIDE; |
65 virtual string16 UseBillingForShippingText() const OVERRIDE; | 66 virtual string16 UseBillingForShippingText() const OVERRIDE; |
66 virtual string16 WalletOptionText() const OVERRIDE; | 67 virtual string16 WalletOptionText() const OVERRIDE; |
67 virtual string16 CancelButtonText() const OVERRIDE; | 68 virtual string16 CancelButtonText() const OVERRIDE; |
68 virtual string16 ConfirmButtonText() const OVERRIDE; | 69 virtual string16 ConfirmButtonText() const OVERRIDE; |
69 virtual string16 SignInText() const OVERRIDE; | |
70 virtual string16 SaveLocallyText() const OVERRIDE; | 70 virtual string16 SaveLocallyText() const OVERRIDE; |
71 virtual string16 CancelSignInText() const OVERRIDE; | 71 virtual string16 CancelSignInText() const OVERRIDE; |
72 virtual string16 ProgressBarText() const OVERRIDE; | 72 virtual string16 ProgressBarText() const OVERRIDE; |
73 virtual DialogSignedInState SignedInState() const OVERRIDE; | 73 virtual DialogSignedInState SignedInState() const OVERRIDE; |
| 74 virtual bool CanPayWithWallet() const OVERRIDE; |
| 75 virtual bool AccountChooserEnabled() const OVERRIDE; |
74 virtual const DetailInputs& RequestedFieldsForSection(DialogSection section) | 76 virtual const DetailInputs& RequestedFieldsForSection(DialogSection section) |
75 const OVERRIDE; | 77 const OVERRIDE; |
76 virtual ui::ComboboxModel* ComboboxModelForAutofillType( | 78 virtual ui::ComboboxModel* ComboboxModelForAutofillType( |
77 AutofillFieldType type) OVERRIDE; | 79 AutofillFieldType type) OVERRIDE; |
78 virtual ui::MenuModel* MenuModelForSection(DialogSection section) OVERRIDE; | 80 virtual ui::MenuModel* MenuModelForSection(DialogSection section) OVERRIDE; |
79 virtual string16 LabelForSection(DialogSection section) const OVERRIDE; | 81 virtual string16 LabelForSection(DialogSection section) const OVERRIDE; |
80 virtual string16 SuggestionTextForSection(DialogSection section) OVERRIDE; | 82 virtual string16 SuggestionTextForSection(DialogSection section) OVERRIDE; |
81 virtual gfx::Image SuggestionIconForSection(DialogSection section) OVERRIDE; | 83 virtual gfx::Image SuggestionIconForSection(DialogSection section) OVERRIDE; |
82 virtual void EditClickedForSection(DialogSection section) OVERRIDE; | 84 virtual void EditClickedForSection(DialogSection section) OVERRIDE; |
83 virtual bool InputIsValid(AutofillFieldType type, const string16& value) | 85 virtual bool InputIsValid(AutofillFieldType type, const string16& value) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 142 |
141 // Updates the progress bar based on the Autocheckout progress. |value| should | 143 // Updates the progress bar based on the Autocheckout progress. |value| should |
142 // be in [0.0, 1.0]. | 144 // be in [0.0, 1.0]. |
143 void UpdateProgressBar(double value); | 145 void UpdateProgressBar(double value); |
144 | 146 |
145 private: | 147 private: |
146 // Determines whether |input| and |field| match. | 148 // Determines whether |input| and |field| match. |
147 typedef base::Callback<bool(const DetailInput& input, | 149 typedef base::Callback<bool(const DetailInput& input, |
148 const AutofillField& field)> InputFieldComparator; | 150 const AutofillField& field)> InputFieldComparator; |
149 | 151 |
| 152 // Refresh wallet items immediately if there's no refresh currently in |
| 153 // progress, otherwise wait until the current refresh completes. |
| 154 void ScheduleRefreshWalletItems(); |
| 155 |
| 156 // Called when any type of request to Online Wallet completes. |success| is |
| 157 // true when there was no network error, the response wasn't malformed, and no |
| 158 // Wallet error occurred. |
| 159 void WalletRequestCompleted(bool success); |
| 160 |
150 // Whether or not the current request wants credit info back. | 161 // Whether or not the current request wants credit info back. |
151 bool RequestingCreditCardInfo() const; | 162 bool RequestingCreditCardInfo() const; |
152 | 163 |
153 // Whether the information input in this dialog will be securely transmitted | 164 // Whether the information input in this dialog will be securely transmitted |
154 // to the requesting site. | 165 // to the requesting site. |
155 bool TransmissionWillBeSecure() const; | 166 bool TransmissionWillBeSecure() const; |
156 | 167 |
157 // Convenience method to tell whether we need to address |action|. | 168 // Convenience method to tell whether we need to address |action|. |
158 bool HasRequiredAction(wallet::RequiredAction action) const; | 169 bool HasRequiredAction(wallet::RequiredAction action) const; |
159 | 170 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 238 |
228 // The SSL info from the invoking site. | 239 // The SSL info from the invoking site. |
229 content::SSLStatus ssl_status_; | 240 content::SSLStatus ssl_status_; |
230 | 241 |
231 // The callback via which we return the collected data. | 242 // The callback via which we return the collected data. |
232 base::Callback<void(const FormStructure*)> callback_; | 243 base::Callback<void(const FormStructure*)> callback_; |
233 | 244 |
234 // A client to talk to the Online Wallet API. | 245 // A client to talk to the Online Wallet API. |
235 wallet::WalletClient wallet_client_; | 246 wallet::WalletClient wallet_client_; |
236 | 247 |
| 248 // Whether another refresh for WalletItems should be started when the current |
| 249 // one is done. |
| 250 bool refresh_wallet_items_queued_; |
| 251 |
| 252 // Whether there has been a Wallet error while this dialog has been open. |
| 253 bool had_wallet_error_; |
| 254 |
237 // The most recently received WalletItems retrieved via |wallet_client_|. | 255 // The most recently received WalletItems retrieved via |wallet_client_|. |
238 scoped_ptr<wallet::WalletItems> wallet_items_; | 256 scoped_ptr<wallet::WalletItems> wallet_items_; |
239 | 257 |
240 // The fields for billing and shipping which the page has actually requested. | 258 // The fields for billing and shipping which the page has actually requested. |
241 DetailInputs requested_email_fields_; | 259 DetailInputs requested_email_fields_; |
242 DetailInputs requested_cc_fields_; | 260 DetailInputs requested_cc_fields_; |
243 DetailInputs requested_billing_fields_; | 261 DetailInputs requested_billing_fields_; |
244 DetailInputs requested_shipping_fields_; | 262 DetailInputs requested_shipping_fields_; |
245 | 263 |
246 // Models for the credit card expiration inputs. | 264 // Models for the credit card expiration inputs. |
(...skipping 25 matching lines...) Expand all Loading... |
272 | 290 |
273 // A NotificationRegistrar for tracking the completion of sign-in. | 291 // A NotificationRegistrar for tracking the completion of sign-in. |
274 content::NotificationRegistrar registrar_; | 292 content::NotificationRegistrar registrar_; |
275 | 293 |
276 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 294 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
277 }; | 295 }; |
278 | 296 |
279 } // namespace autofill | 297 } // namespace autofill |
280 | 298 |
281 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 299 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
OLD | NEW |