| 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_MODELS_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ |
| 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/prefs/pref_change_registrar.h" | |
| 14 #include "base/string16.h" | 13 #include "base/string16.h" |
| 15 #include "ui/base/models/combobox_model.h" | 14 #include "ui/base/models/combobox_model.h" |
| 16 #include "ui/base/models/simple_menu_model.h" | 15 #include "ui/base/models/simple_menu_model.h" |
| 17 | 16 |
| 18 class PrefService; | 17 class PrefService; |
| 19 | 18 |
| 20 namespace autofill { | 19 namespace autofill { |
| 21 | 20 |
| 22 class SuggestionsMenuModel; | 21 class SuggestionsMenuModel; |
| 23 | 22 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 126 |
| 128 // Should be called when the Online Wallet sign-in attempt has failed. | 127 // Should be called when the Online Wallet sign-in attempt has failed. |
| 129 void SetHadWalletSigninError(); | 128 void SetHadWalletSigninError(); |
| 130 | 129 |
| 131 bool had_wallet_error() const { return had_wallet_error_; } | 130 bool had_wallet_error() const { return had_wallet_error_; } |
| 132 | 131 |
| 133 bool WalletIsSelected() const; | 132 bool WalletIsSelected() const; |
| 134 | 133 |
| 135 int checked_item() const { return checked_item_; } | 134 int checked_item() const { return checked_item_; } |
| 136 | 135 |
| 137 private: | |
| 138 void PrefChanged(const std::string& pref); | |
| 139 | |
| 140 // Sets |checked_item_| from the relevant pref. | |
| 141 void UpdateCheckmarkFromPref(); | |
| 142 | |
| 143 // Command IDs of the items in this menu. For now, we only support a single | 136 // Command IDs of the items in this menu. For now, we only support a single |
| 144 // account, so there's only one wallet item. | 137 // account, so there's only one wallet item. |
| 145 static const int kWalletItemId; | 138 static const int kWalletItemId; |
| 146 static const int kAutofillItemId; | 139 static const int kAutofillItemId; |
| 147 | 140 |
| 141 private: |
| 148 AccountChooserModelDelegate* account_delegate_; | 142 AccountChooserModelDelegate* account_delegate_; |
| 149 | 143 |
| 150 PrefService* prefs_; | |
| 151 | |
| 152 // The command id of the currently active item. | 144 // The command id of the currently active item. |
| 153 int checked_item_; | 145 int checked_item_; |
| 154 | 146 |
| 155 // Whether there has been a Wallet error while the owning dialog has been | 147 // Whether there has been a Wallet error while the owning dialog has been |
| 156 // open. | 148 // open. |
| 157 bool had_wallet_error_; | 149 bool had_wallet_error_; |
| 158 | 150 |
| 159 PrefChangeRegistrar pref_change_registrar_; | |
| 160 | |
| 161 DISALLOW_COPY_AND_ASSIGN(AccountChooserModel); | 151 DISALLOW_COPY_AND_ASSIGN(AccountChooserModel); |
| 162 }; | 152 }; |
| 163 | 153 |
| 164 // A model for possible months in the Gregorian calendar. | 154 // A model for possible months in the Gregorian calendar. |
| 165 class MonthComboboxModel : public ui::ComboboxModel { | 155 class MonthComboboxModel : public ui::ComboboxModel { |
| 166 public: | 156 public: |
| 167 MonthComboboxModel(); | 157 MonthComboboxModel(); |
| 168 virtual ~MonthComboboxModel(); | 158 virtual ~MonthComboboxModel(); |
| 169 | 159 |
| 170 static string16 FormatMonth(int index); | 160 static string16 FormatMonth(int index); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 190 private: | 180 private: |
| 191 // The current year (e.g., 2012). | 181 // The current year (e.g., 2012). |
| 192 int this_year_; | 182 int this_year_; |
| 193 | 183 |
| 194 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); | 184 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); |
| 195 }; | 185 }; |
| 196 | 186 |
| 197 } // autofill | 187 } // autofill |
| 198 | 188 |
| 199 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ | 189 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ |
| OLD | NEW |