Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_models.h

Issue 14129005: Remove "Use billing for shipping" checkbox in favor of item in suggestions menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/string16.h" 13 #include "base/string16.h"
14 #include "ui/base/models/combobox_model.h" 14 #include "ui/base/models/combobox_model.h"
15 #include "ui/base/models/simple_menu_model.h" 15 #include "ui/base/models/simple_menu_model.h"
16 16
17 namespace autofill { 17 namespace autofill {
18 18
19 class SuggestionsMenuModel; 19 class SuggestionsMenuModel;
20 20
21 class SuggestionsMenuModelDelegate { 21 class SuggestionsMenuModelDelegate {
22 public: 22 public:
23 virtual ~SuggestionsMenuModelDelegate(); 23 virtual ~SuggestionsMenuModelDelegate();
24 24
25 // Called when a menu item has been activated. 25 // Called when a menu item has been activated.
26 virtual void SuggestionItemSelected(const SuggestionsMenuModel& model) = 0; 26 virtual void SuggestionItemSelected(SuggestionsMenuModel* model,
27 size_t index) = 0;
27 }; 28 };
28 29
29 // A model for the dropdowns that allow the user to select from different 30 // A model for the dropdowns that allow the user to select from different
30 // sets of known data. It wraps a SimpleMenuModel, providing a mapping between 31 // sets of known data. It wraps a SimpleMenuModel, providing a mapping between
31 // index and item GUID. 32 // index and item GUID.
32 class SuggestionsMenuModel : public ui::SimpleMenuModel, 33 class SuggestionsMenuModel : public ui::SimpleMenuModel,
33 public ui::SimpleMenuModel::Delegate { 34 public ui::SimpleMenuModel::Delegate {
34 public: 35 public:
35 explicit SuggestionsMenuModel(SuggestionsMenuModelDelegate* delegate); 36 explicit SuggestionsMenuModel(SuggestionsMenuModelDelegate* delegate);
36 virtual ~SuggestionsMenuModel(); 37 virtual ~SuggestionsMenuModel();
(...skipping 23 matching lines...) Expand all
60 // Resets the model to empty. 61 // Resets the model to empty.
61 void Reset(); 62 void Reset();
62 63
63 // Returns the ID key for the item at |index|. 64 // Returns the ID key for the item at |index|.
64 std::string GetItemKeyAt(int index) const; 65 std::string GetItemKeyAt(int index) const;
65 66
66 // 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
67 // there are no items. 68 // there are no items.
68 std::string GetItemKeyForCheckedItem() const; 69 std::string GetItemKeyForCheckedItem() const;
69 70
71 // Sets which item is checked.
72 void SetCheckedItem(const std::string& item_key);
73 void SetCheckedIndex(size_t index);
74
70 int checked_item() { return checked_item_; } 75 int checked_item() { return checked_item_; }
71 76
72 // ui::SimpleMenuModel::Delegate implementation. 77 // ui::SimpleMenuModel::Delegate implementation.
73 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 78 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
74 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 79 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
75 virtual bool GetAcceleratorForCommandId( 80 virtual bool GetAcceleratorForCommandId(
76 int command_id, 81 int command_id,
77 ui::Accelerator* accelerator) OVERRIDE; 82 ui::Accelerator* accelerator) OVERRIDE;
78 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; 83 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
79 84
80 private: 85 private:
81 // The items this model represents, in presentation order. The first 86 // The items this model represents, in presentation order. The first
82 // string is the "key" which identifies the item. The second is the 87 // string is the "key" which identifies the item. The second is the
83 // display string for the item. 88 // display string for the item.
84 std::vector<std::pair<std::string, string16> > items_; 89 std::vector<std::pair<std::string, string16> > items_;
85 90
86 SuggestionsMenuModelDelegate* delegate_; 91 SuggestionsMenuModelDelegate* delegate_;
87 92
88 // The command id (and index) of the item which is currently checked. 93 // The command id (and index) of the item which is currently checked. Only one
94 // item is checked at a time.
89 int checked_item_; 95 int checked_item_;
90 96
91 DISALLOW_COPY_AND_ASSIGN(SuggestionsMenuModel); 97 DISALLOW_COPY_AND_ASSIGN(SuggestionsMenuModel);
92 }; 98 };
93 99
94 // A model for possible months in the Gregorian calendar. 100 // A model for possible months in the Gregorian calendar.
95 class MonthComboboxModel : public ui::ComboboxModel { 101 class MonthComboboxModel : public ui::ComboboxModel {
96 public: 102 public:
97 MonthComboboxModel(); 103 MonthComboboxModel();
98 virtual ~MonthComboboxModel(); 104 virtual ~MonthComboboxModel();
(...skipping 21 matching lines...) Expand all
120 private: 126 private:
121 // The current year (e.g., 2012). 127 // The current year (e.g., 2012).
122 int this_year_; 128 int this_year_;
123 129
124 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); 130 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel);
125 }; 131 };
126 132
127 } // autofill 133 } // autofill
128 134
129 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ 135 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698