| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "chrome/browser/autofill/field_types.h" | 14 #include "chrome/browser/autofill/field_types.h" |
| 15 #include "chrome/browser/autofill/form_structure.h" | 15 #include "chrome/browser/autofill/form_structure.h" |
| 16 #include "chrome/browser/autofill/personal_data_manager.h" | 16 #include "chrome/browser/autofill/personal_data_manager.h" |
| 17 #include "chrome/browser/autofill/personal_data_manager_observer.h" |
| 17 #include "chrome/browser/autofill/wallet/required_action.h" | 18 #include "chrome/browser/autofill/wallet/required_action.h" |
| 18 #include "chrome/browser/autofill/wallet/wallet_client.h" | 19 #include "chrome/browser/autofill/wallet/wallet_client.h" |
| 19 #include "chrome/browser/autofill/wallet/wallet_client_observer.h" | 20 #include "chrome/browser/autofill/wallet/wallet_client_observer.h" |
| 20 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 21 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| 21 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 22 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
| 22 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 23 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 23 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 24 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| 24 #include "chrome/browser/ui/autofill/autofill_popup_delegate.h" | 25 #include "chrome/browser/ui/autofill/autofill_popup_delegate.h" |
| 25 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
| 26 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 39 namespace autofill { | 40 namespace autofill { |
| 40 | 41 |
| 41 class AutofillDialogView; | 42 class AutofillDialogView; |
| 42 | 43 |
| 43 // This class drives the dialog that appears when a site uses the imperative | 44 // This class drives the dialog that appears when a site uses the imperative |
| 44 // autocomplete API to fill out a form. | 45 // autocomplete API to fill out a form. |
| 45 class AutofillDialogControllerImpl : public AutofillDialogController, | 46 class AutofillDialogControllerImpl : public AutofillDialogController, |
| 46 public AutofillPopupDelegate, | 47 public AutofillPopupDelegate, |
| 47 public content::NotificationObserver, | 48 public content::NotificationObserver, |
| 48 public SuggestionsMenuModelDelegate, | 49 public SuggestionsMenuModelDelegate, |
| 49 public wallet::WalletClientObserver { | 50 public wallet::WalletClientObserver, |
| 51 public PersonalDataManagerObserver { |
| 50 public: | 52 public: |
| 51 AutofillDialogControllerImpl( | 53 AutofillDialogControllerImpl( |
| 52 content::WebContents* contents, | 54 content::WebContents* contents, |
| 53 const FormData& form_structure, | 55 const FormData& form_structure, |
| 54 const GURL& source_url, | 56 const GURL& source_url, |
| 55 const content::SSLStatus& ssl_status, | 57 const content::SSLStatus& ssl_status, |
| 56 const base::Callback<void(const FormStructure*)>& callback); | 58 const base::Callback<void(const FormStructure*)>& callback); |
| 57 virtual ~AutofillDialogControllerImpl(); | 59 virtual ~AutofillDialogControllerImpl(); |
| 58 | 60 |
| 59 void Show(); | 61 void Show(); |
| 60 void Hide(); | 62 void Hide(); |
| 61 | 63 |
| 64 // Updates the progress bar based on the Autocheckout progress. |value| should |
| 65 // be in [0.0, 1.0]. |
| 66 void UpdateProgressBar(double value); |
| 67 |
| 62 // AutofillDialogController implementation. | 68 // AutofillDialogController implementation. |
| 63 virtual string16 DialogTitle() const OVERRIDE; | 69 virtual string16 DialogTitle() const OVERRIDE; |
| 64 virtual string16 AccountChooserText() const OVERRIDE; | 70 virtual string16 AccountChooserText() const OVERRIDE; |
| 65 virtual string16 EditSuggestionText() const OVERRIDE; | 71 virtual string16 EditSuggestionText() const OVERRIDE; |
| 66 virtual string16 UseBillingForShippingText() const OVERRIDE; | 72 virtual string16 UseBillingForShippingText() const OVERRIDE; |
| 67 virtual string16 WalletOptionText() const OVERRIDE; | 73 virtual string16 WalletOptionText() const OVERRIDE; |
| 68 virtual string16 CancelButtonText() const OVERRIDE; | 74 virtual string16 CancelButtonText() const OVERRIDE; |
| 69 virtual string16 ConfirmButtonText() const OVERRIDE; | 75 virtual string16 ConfirmButtonText() const OVERRIDE; |
| 70 virtual string16 SaveLocallyText() const OVERRIDE; | 76 virtual string16 SaveLocallyText() const OVERRIDE; |
| 71 virtual string16 CancelSignInText() const OVERRIDE; | 77 virtual string16 CancelSignInText() const OVERRIDE; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // AutofillPopupDelegate implementation. | 109 // AutofillPopupDelegate implementation. |
| 104 virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE; | 110 virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE; |
| 105 virtual void OnPopupHidden(content::KeyboardListener* listener) OVERRIDE; | 111 virtual void OnPopupHidden(content::KeyboardListener* listener) OVERRIDE; |
| 106 virtual void DidSelectSuggestion(int identifier) OVERRIDE; | 112 virtual void DidSelectSuggestion(int identifier) OVERRIDE; |
| 107 virtual void DidAcceptSuggestion(const string16& value, | 113 virtual void DidAcceptSuggestion(const string16& value, |
| 108 int identifier) OVERRIDE; | 114 int identifier) OVERRIDE; |
| 109 virtual void RemoveSuggestion(const string16& value, | 115 virtual void RemoveSuggestion(const string16& value, |
| 110 int identifier) OVERRIDE; | 116 int identifier) OVERRIDE; |
| 111 virtual void ClearPreviewedForm() OVERRIDE; | 117 virtual void ClearPreviewedForm() OVERRIDE; |
| 112 | 118 |
| 113 // content::NotificationObserver implementation: | 119 // content::NotificationObserver implementation. |
| 114 virtual void Observe(int type, | 120 virtual void Observe(int type, |
| 115 const content::NotificationSource& source, | 121 const content::NotificationSource& source, |
| 116 const content::NotificationDetails& details) OVERRIDE; | 122 const content::NotificationDetails& details) OVERRIDE; |
| 117 | 123 |
| 118 // SuggestionsMenuModelDelegate implementation. | 124 // SuggestionsMenuModelDelegate implementation. |
| 119 virtual void SuggestionItemSelected(const SuggestionsMenuModel& model) | 125 virtual void SuggestionItemSelected(const SuggestionsMenuModel& model) |
| 120 OVERRIDE; | 126 OVERRIDE; |
| 121 | 127 |
| 122 // wallet::WalletClientObserver implementation. | 128 // wallet::WalletClientObserver implementation. |
| 123 virtual void OnDidAcceptLegalDocuments() OVERRIDE; | 129 virtual void OnDidAcceptLegalDocuments() OVERRIDE; |
| 124 virtual void OnDidEncryptOtp(const std::string& encrypted_otp, | 130 virtual void OnDidEncryptOtp(const std::string& encrypted_otp, |
| 125 const std::string& session_material) OVERRIDE; | 131 const std::string& session_material) OVERRIDE; |
| 126 virtual void OnDidEscrowSensitiveInformation( | 132 virtual void OnDidEscrowSensitiveInformation( |
| 127 const std::string& escrow_handle) OVERRIDE; | 133 const std::string& escrow_handle) OVERRIDE; |
| 128 virtual void OnDidGetFullWallet( | 134 virtual void OnDidGetFullWallet( |
| 129 scoped_ptr<wallet::FullWallet> full_wallet) OVERRIDE; | 135 scoped_ptr<wallet::FullWallet> full_wallet) OVERRIDE; |
| 130 virtual void OnDidGetWalletItems( | 136 virtual void OnDidGetWalletItems( |
| 131 scoped_ptr<wallet::WalletItems> wallet_items) OVERRIDE; | 137 scoped_ptr<wallet::WalletItems> wallet_items) OVERRIDE; |
| 132 virtual void OnDidSaveAddress(const std::string& address_id) OVERRIDE; | 138 virtual void OnDidSaveAddress(const std::string& address_id) OVERRIDE; |
| 133 virtual void OnDidSaveInstrument(const std::string& instrument_id) OVERRIDE; | 139 virtual void OnDidSaveInstrument(const std::string& instrument_id) OVERRIDE; |
| 134 virtual void OnDidSaveInstrumentAndAddress( | 140 virtual void OnDidSaveInstrumentAndAddress( |
| 135 const std::string& instrument_id, | 141 const std::string& instrument_id, |
| 136 const std::string& address_id) OVERRIDE; | 142 const std::string& address_id) OVERRIDE; |
| 137 virtual void OnDidSendAutocheckoutStatus() OVERRIDE; | 143 virtual void OnDidSendAutocheckoutStatus() OVERRIDE; |
| 138 virtual void OnDidUpdateInstrument(const std::string& instrument_id) OVERRIDE; | 144 virtual void OnDidUpdateInstrument(const std::string& instrument_id) OVERRIDE; |
| 139 virtual void OnWalletError() OVERRIDE; | 145 virtual void OnWalletError() OVERRIDE; |
| 140 virtual void OnMalformedResponse() OVERRIDE; | 146 virtual void OnMalformedResponse() OVERRIDE; |
| 141 virtual void OnNetworkError(int response_code) OVERRIDE; | 147 virtual void OnNetworkError(int response_code) OVERRIDE; |
| 142 | 148 |
| 143 // Updates the progress bar based on the Autocheckout progress. |value| should | 149 // PersonalDataManagerObserver implementation. |
| 144 // be in [0.0, 1.0]. | 150 virtual void OnPersonalDataChanged() OVERRIDE; |
| 145 void UpdateProgressBar(double value); | |
| 146 | 151 |
| 147 private: | 152 private: |
| 148 // Determines whether |input| and |field| match. | 153 // Determines whether |input| and |field| match. |
| 149 typedef base::Callback<bool(const DetailInput& input, | 154 typedef base::Callback<bool(const DetailInput& input, |
| 150 const AutofillField& field)> InputFieldComparator; | 155 const AutofillField& field)> InputFieldComparator; |
| 151 | 156 |
| 152 // Refresh wallet items immediately if there's no refresh currently in | 157 // Refresh wallet items immediately if there's no refresh currently in |
| 153 // progress, otherwise wait until the current refresh completes. | 158 // progress, otherwise wait until the current refresh completes. |
| 154 void ScheduleRefreshWalletItems(); | 159 void ScheduleRefreshWalletItems(); |
| 155 | 160 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 295 |
| 291 // A NotificationRegistrar for tracking the completion of sign-in. | 296 // A NotificationRegistrar for tracking the completion of sign-in. |
| 292 content::NotificationRegistrar registrar_; | 297 content::NotificationRegistrar registrar_; |
| 293 | 298 |
| 294 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); | 299 DISALLOW_COPY_AND_ASSIGN(AutofillDialogControllerImpl); |
| 295 }; | 300 }; |
| 296 | 301 |
| 297 } // namespace autofill | 302 } // namespace autofill |
| 298 | 303 |
| 299 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ | 304 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_IMPL_H_ |
| OLD | NEW |