Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_UI_AUTOFILL_ACCOUNT_CHOOSER_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_ACCOUNT_CHOOSER_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_AUTOFILL_ACCOUNT_CHOOSER_MODEL_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_ACCOUNT_CHOOSER_MODEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 // Clears the name of the account used to communicate with the Online Wallet. | 71 // Clears the name of the account used to communicate with the Online Wallet. |
| 72 // Any Wallet error automatically clears the currently active account name. | 72 // Any Wallet error automatically clears the currently active account name. |
| 73 void ClearActiveWalletAccountName(); | 73 void ClearActiveWalletAccountName(); |
| 74 | 74 |
| 75 // Returns the name of the currently active account, or an empty string. | 75 // Returns the name of the currently active account, or an empty string. |
| 76 const string16& active_wallet_account_name() const { | 76 const string16& active_wallet_account_name() const { |
| 77 return active_wallet_account_name_; | 77 return active_wallet_account_name_; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Disables all Wallet accounts and switches to the local Autofill data. | 80 // Disables all Wallet accounts and switches to the local Autofill data. |
| 81 // Should be called when the Wallet server returns an error with the message | 81 // Should be called when the Wallet server returns an error. |
| 82 // to be displayed. If |message| is empty the error state will be cleared. | 82 void SetHadWalletError(); |
| 83 void SetHadWalletError(const base::string16& message); | |
| 84 | 83 |
| 85 bool HadWalletError() const; | 84 bool HadWalletError() const; |
|
Ilya Sherman
2013/08/29 00:26:11
nit: inline/hacker_case?
Evan Stade
2013/08/30 02:52:21
Done.
| |
| 86 | 85 |
| 87 // Switches the dialog to the local Autofill data. | 86 // Switches the dialog to the local Autofill data. |
| 88 // Should be called when the Online Wallet sign-in attempt has failed. | 87 // Should be called when the Online Wallet sign-in attempt has failed. |
| 89 void SetHadWalletSigninError(); | 88 void SetHadWalletSigninError(); |
| 90 | 89 |
| 91 // Returns true if the selected account is an Online Wallet account. | 90 // Returns true if the selected account is an Online Wallet account. |
| 92 bool WalletIsSelected() const; | 91 bool WalletIsSelected() const; |
| 93 | 92 |
| 94 // Returns true if the current selection matches the currently active | 93 // Returns true if the current selection matches the currently active |
| 95 // Wallet account. | 94 // Wallet account. |
| 96 bool IsActiveWalletAccountSelected() const; | 95 bool IsActiveWalletAccountSelected() const; |
| 97 | 96 |
| 98 // Returns the command id of the current selection. | 97 // Returns the command id of the current selection. |
| 99 int checked_item() const { return checked_item_; } | 98 int checked_item() const { return checked_item_; } |
| 100 | 99 |
| 101 base::string16 wallet_error_message() const { return wallet_error_message_; } | |
| 102 | |
| 103 protected: | 100 protected: |
| 104 // Command IDs of the items in this menu; protected for the tests. | 101 // Command IDs of the items in this menu; protected for the tests. |
| 105 // kActiveWalletItemId is the currently active account. | 102 // kActiveWalletItemId is the currently active account. |
| 106 // kAutofillItemId is "Pay without the Wallet" (local autofill data). | 103 // kAutofillItemId is "Pay without the Wallet" (local autofill data). |
| 107 // In the future, kFirstAdditionalItemId will be added as the first id | 104 // In the future, kFirstAdditionalItemId will be added as the first id |
| 108 // for additional accounts. | 105 // for additional accounts. |
| 109 static const int kActiveWalletItemId; | 106 static const int kActiveWalletItemId; |
| 110 static const int kAutofillItemId; | 107 static const int kAutofillItemId; |
| 111 | 108 |
| 112 private: | 109 private: |
| 113 // Reconstructs the set of menu items. | 110 // Reconstructs the set of menu items. |
| 114 void ReconstructMenuItems(); | 111 void ReconstructMenuItems(); |
| 115 | 112 |
| 116 AccountChooserModelDelegate* delegate_; | 113 AccountChooserModelDelegate* delegate_; |
| 117 | 114 |
| 118 // The command id of the currently selected item. | 115 // The command id of the currently selected item. |
| 119 int checked_item_; | 116 int checked_item_; |
| 120 | 117 |
| 121 // The message to be displayed if there is a Wallet error. This message is | 118 // Whether there has been a Wallet error. |
| 122 // only non-empty if a Wallet error has occurred. | 119 bool wallet_error_; |
|
Ilya Sherman
2013/08/29 00:26:11
nit: Perhaps |has_wallet_error_|?
Evan Stade
2013/08/30 02:52:21
Done.
| |
| 123 base::string16 wallet_error_message_; | |
| 124 | 120 |
| 125 // For logging UMA metrics. | 121 // For logging UMA metrics. |
| 126 const AutofillMetrics& metric_logger_; | 122 const AutofillMetrics& metric_logger_; |
| 127 const DialogType dialog_type_; | 123 const DialogType dialog_type_; |
| 128 | 124 |
| 129 // The name (email) of the account currently used in communications with the | 125 // The name (email) of the account currently used in communications with the |
| 130 // Online Wallet service. | 126 // Online Wallet service. |
| 131 string16 active_wallet_account_name_; | 127 string16 active_wallet_account_name_; |
| 132 | 128 |
| 133 DISALLOW_COPY_AND_ASSIGN(AccountChooserModel); | 129 DISALLOW_COPY_AND_ASSIGN(AccountChooserModel); |
| 134 }; | 130 }; |
| 135 | 131 |
| 136 } // namespace autofill | 132 } // namespace autofill |
| 137 | 133 |
| 138 #endif // CHROME_BROWSER_UI_AUTOFILL_ACCOUNT_CHOOSER_MODEL_H_ | 134 #endif // CHROME_BROWSER_UI_AUTOFILL_ACCOUNT_CHOOSER_MODEL_H_ |
| OLD | NEW |