Chromium Code Reviews| 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 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 std::string GetItemKeyAt(int index) const; | 65 std::string GetItemKeyAt(int index) const; |
| 66 | 66 |
| 67 // Returns the ID key for the item at |checked_item_|, or an empty string if | 67 // Returns the ID key for the item at |checked_item_|, or an empty string if |
| 68 // there are no items. | 68 // there are no items. |
| 69 std::string GetItemKeyForCheckedItem() const; | 69 std::string GetItemKeyForCheckedItem() const; |
| 70 | 70 |
| 71 // Sets which item is checked. | 71 // Sets which item is checked. |
| 72 void SetCheckedItem(const std::string& item_key); | 72 void SetCheckedItem(const std::string& item_key); |
| 73 void SetCheckedIndex(size_t index); | 73 void SetCheckedIndex(size_t index); |
| 74 | 74 |
| 75 int checked_item() { return checked_item_; } | 75 // Sets the item to be checked to the |n|th item that has key |item_key|. |
| 76 // If there are fewer than |n| items that share |item_key|, the last one | |
| 77 // becomes checked. | |
|
Ilya Sherman
2013/05/21 03:54:35
nit: Please mention that this is 1-indexed rather
Evan Stade
2013/05/21 17:34:41
done. I made it 1-indexed because Nth implies 1-in
| |
| 78 void SetCheckedItemNthWithKey(const std::string& item_key, size_t n); | |
|
Ilya Sherman
2013/05/21 03:54:35
What happens if there are no items that share |ite
Evan Stade
2013/05/21 17:34:41
Done.
| |
| 79 | |
| 80 int checked_item() const { return checked_item_; } | |
| 76 | 81 |
| 77 // ui::SimpleMenuModel::Delegate implementation. | 82 // ui::SimpleMenuModel::Delegate implementation. |
| 78 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 83 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| 79 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 84 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| 80 virtual bool GetAcceleratorForCommandId( | 85 virtual bool GetAcceleratorForCommandId( |
| 81 int command_id, | 86 int command_id, |
| 82 ui::Accelerator* accelerator) OVERRIDE; | 87 ui::Accelerator* accelerator) OVERRIDE; |
| 83 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 88 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
| 84 | 89 |
| 85 private: | 90 private: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 private: | 131 private: |
| 127 // The current year (e.g., 2012). | 132 // The current year (e.g., 2012). |
| 128 int this_year_; | 133 int this_year_; |
| 129 | 134 |
| 130 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); | 135 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); |
| 131 }; | 136 }; |
| 132 | 137 |
| 133 } // autofill | 138 } // autofill |
| 134 | 139 |
| 135 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ | 140 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ |
| OLD | NEW |