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 <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/ui/autofill/country_combobox_model.h" | 21 #include "chrome/browser/ui/autofill/country_combobox_model.h" |
22 #include "components/autofill/browser/autofill_manager_delegate.h" | 22 #include "components/autofill/browser/autofill_manager_delegate.h" |
23 #include "components/autofill/browser/autofill_metrics.h" | 23 #include "components/autofill/browser/autofill_metrics.h" |
24 #include "components/autofill/browser/autofill_popup_delegate.h" | 24 #include "components/autofill/browser/autofill_popup_delegate.h" |
25 #include "components/autofill/browser/field_types.h" | 25 #include "components/autofill/browser/field_types.h" |
26 #include "components/autofill/browser/form_structure.h" | 26 #include "components/autofill/browser/form_structure.h" |
27 #include "components/autofill/browser/personal_data_manager.h" | 27 #include "components/autofill/browser/personal_data_manager.h" |
28 #include "components/autofill/browser/personal_data_manager_observer.h" | 28 #include "components/autofill/browser/personal_data_manager_observer.h" |
29 #include "components/autofill/browser/wallet/wallet_client.h" | 29 #include "components/autofill/browser/wallet/wallet_client.h" |
30 #include "components/autofill/browser/wallet/wallet_client_delegate.h" | 30 #include "components/autofill/browser/wallet/wallet_client_delegate.h" |
| 31 #include "components/autofill/browser/wallet/wallet_items.h" |
31 #include "components/autofill/browser/wallet/wallet_signin_helper_delegate.h" | 32 #include "components/autofill/browser/wallet/wallet_signin_helper_delegate.h" |
32 #include "content/public/browser/notification_observer.h" | 33 #include "content/public/browser/notification_observer.h" |
33 #include "content/public/browser/notification_registrar.h" | 34 #include "content/public/browser/notification_registrar.h" |
34 #include "content/public/common/ssl_status.h" | 35 #include "content/public/common/ssl_status.h" |
35 #include "googleurl/src/gurl.h" | 36 #include "googleurl/src/gurl.h" |
36 #include "ui/base/models/simple_menu_model.h" | 37 #include "ui/base/models/simple_menu_model.h" |
37 #include "ui/base/ui_base_types.h" | 38 #include "ui/base/ui_base_types.h" |
38 | 39 |
39 class Profile; | 40 class Profile; |
40 | 41 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 315 |
315 // Clears previously entered manual input, shows editing UI if the current | 316 // Clears previously entered manual input, shows editing UI if the current |
316 // suggestion is invalid, and updates the |view_| (if it exists). | 317 // suggestion is invalid, and updates the |view_| (if it exists). |
317 void PrepareDetailInputsForSection(DialogSection section); | 318 void PrepareDetailInputsForSection(DialogSection section); |
318 | 319 |
319 // Creates a DataModelWrapper item for the item that's checked in the | 320 // Creates a DataModelWrapper item for the item that's checked in the |
320 // suggestion model for |section|. This may represent Autofill | 321 // suggestion model for |section|. This may represent Autofill |
321 // data or Wallet data, depending on whether Wallet is currently enabled. | 322 // data or Wallet data, depending on whether Wallet is currently enabled. |
322 scoped_ptr<DataModelWrapper> CreateWrapper(DialogSection section); | 323 scoped_ptr<DataModelWrapper> CreateWrapper(DialogSection section); |
323 | 324 |
| 325 // Helper to return the current Wallet instrument or address. If the dialog |
| 326 // isn't using Wallet or the user is adding a new instrument or address, NULL |
| 327 // will be returned. |
| 328 const wallet::WalletItems::MaskedInstrument* ActiveInstrument() const; |
| 329 const wallet::Address* ActiveShippingAddress() const; |
| 330 |
324 // Fills in |section|-related fields in |output_| according to the state of | 331 // Fills in |section|-related fields in |output_| according to the state of |
325 // |view_|. | 332 // |view_|. |
326 void FillOutputForSection(DialogSection section); | 333 void FillOutputForSection(DialogSection section); |
327 // As above, but uses |compare| to determine whether a DetailInput matches | 334 // As above, but uses |compare| to determine whether a DetailInput matches |
328 // a field. Saves any new Autofill data to the PersonalDataManager. | 335 // a field. Saves any new Autofill data to the PersonalDataManager. |
329 void FillOutputForSectionWithComparator(DialogSection section, | 336 void FillOutputForSectionWithComparator(DialogSection section, |
330 const InputFieldComparator& compare); | 337 const InputFieldComparator& compare); |
331 | 338 |
332 // Fills in |form_structure_| using |data_model|. Returns whether any matches | 339 // Fills in |form_structure_| using |data_model|. Returns whether any matches |
333 // were found in the form structure for the data in |section|. |data_model| | 340 // were found in the form structure for the data in |section|. |data_model| |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 bool InputIsEditable(const DetailInput& input, DialogSection section) const; | 418 bool InputIsEditable(const DetailInput& input, DialogSection section) const; |
412 | 419 |
413 // Whether all of the input fields currently showing in the dialog have valid | 420 // Whether all of the input fields currently showing in the dialog have valid |
414 // contents. | 421 // contents. |
415 bool AllSectionsAreValid() const; | 422 bool AllSectionsAreValid() const; |
416 | 423 |
417 // Whether all of the input fields currently showing in the given |section| of | 424 // Whether all of the input fields currently showing in the given |section| of |
418 // the dialog have valid contents. | 425 // the dialog have valid contents. |
419 bool SectionIsValid(DialogSection section) const; | 426 bool SectionIsValid(DialogSection section) const; |
420 | 427 |
| 428 // Whether the currently active credit card expiration date is valid. |
| 429 bool IsCreditCardExpirationValid(const base::string16& year, |
| 430 const base::string16& month) const; |
| 431 |
421 // Returns true if |key| refers to a suggestion, as opposed to some control | 432 // Returns true if |key| refers to a suggestion, as opposed to some control |
422 // menu item. | 433 // menu item. |
423 bool IsASuggestionItemKey(const std::string& key); | 434 bool IsASuggestionItemKey(const std::string& key) const; |
424 | 435 |
425 // Whether the billing section should be used to fill in the shipping details. | 436 // Whether the billing section should be used to fill in the shipping details. |
426 bool ShouldUseBillingForShipping(); | 437 bool ShouldUseBillingForShipping(); |
427 | 438 |
428 // Whether the user wishes to save information locally to Autofill. | 439 // Whether the user wishes to save information locally to Autofill. |
429 bool ShouldSaveDetailsLocally(); | 440 bool ShouldSaveDetailsLocally(); |
430 | 441 |
431 // Change whether the controller is currently submitting details to Autofill | 442 // Change whether the controller is currently submitting details to Autofill |
432 // or Online Wallet (|is_submitting_|) and update the view. | 443 // or Online Wallet (|is_submitting_|) and update the view. |
433 void SetIsSubmitting(bool submitting); | 444 void SetIsSubmitting(bool submitting); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 | 650 |
640 // Whether the latency to display to the UI was logged to UMA yet. | 651 // Whether the latency to display to the UI was logged to UMA yet. |
641 bool was_ui_latency_logged_; | 652 bool was_ui_latency_logged_; |
642 | 653 |
643 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 654 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
644 }; | 655 }; |
645 | 656 |
646 } // namespace autofill | 657 } // namespace autofill |
647 | 658 |
648 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 659 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
OLD | NEW |