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

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: fix bad merge 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 "components/autofill/browser/autofill_manager_delegate.h" 14 #include "components/autofill/browser/autofill_manager_delegate.h"
15 #include "ui/base/models/combobox_model.h" 15 #include "ui/base/models/combobox_model.h"
16 #include "ui/base/models/simple_menu_model.h" 16 #include "ui/base/models/simple_menu_model.h"
17 17
18 class AutofillMetrics; 18 class AutofillMetrics;
19 class PrefService; 19 class PrefService;
20 20
21 namespace autofill { 21 namespace autofill {
22 22
23 class SuggestionsMenuModel; 23 class SuggestionsMenuModel;
24 24
25 class SuggestionsMenuModelDelegate { 25 class SuggestionsMenuModelDelegate {
26 public: 26 public:
27 virtual ~SuggestionsMenuModelDelegate(); 27 virtual ~SuggestionsMenuModelDelegate();
28 28
29 // Called when a menu item has been activated. 29 // Called when a menu item has been activated.
30 virtual void SuggestionItemSelected(const SuggestionsMenuModel& model) = 0; 30 virtual void SuggestionItemSelected(SuggestionsMenuModel* model,
31 const std::string& item_key) = 0;
31 }; 32 };
32 33
33 // A model for the dropdowns that allow the user to select from different 34 // A model for the dropdowns that allow the user to select from different
34 // sets of known data. It wraps a SimpleMenuModel, providing a mapping between 35 // sets of known data. It wraps a SimpleMenuModel, providing a mapping between
35 // index and item GUID. 36 // index and item GUID.
36 class SuggestionsMenuModel : public ui::SimpleMenuModel, 37 class SuggestionsMenuModel : public ui::SimpleMenuModel,
37 public ui::SimpleMenuModel::Delegate { 38 public ui::SimpleMenuModel::Delegate {
38 public: 39 public:
39 explicit SuggestionsMenuModel(SuggestionsMenuModelDelegate* delegate); 40 explicit SuggestionsMenuModel(SuggestionsMenuModelDelegate* delegate);
40 virtual ~SuggestionsMenuModel(); 41 virtual ~SuggestionsMenuModel();
(...skipping 23 matching lines...) Expand all
64 // Resets the model to empty. 65 // Resets the model to empty.
65 void Reset(); 66 void Reset();
66 67
67 // Returns the ID key for the item at |index|. 68 // Returns the ID key for the item at |index|.
68 std::string GetItemKeyAt(int index) const; 69 std::string GetItemKeyAt(int index) const;
69 70
70 // Returns the ID key for the item at |checked_item_|, or an empty string if 71 // Returns the ID key for the item at |checked_item_|, or an empty string if
71 // there are no items. 72 // there are no items.
72 std::string GetItemKeyForCheckedItem() const; 73 std::string GetItemKeyForCheckedItem() const;
73 74
75 // Sets which item is checked.
76 void SetCheckedItem(const std::string& item_key);
Dan Beam 2013/04/16 03:01:14 maybe explain the difference between ExecuteComman
Evan Stade 2013/04/16 19:06:20 I don't really see how there could be confusion he
77
74 int checked_item() { return checked_item_; } 78 int checked_item() { return checked_item_; }
75 79
76 // ui::SimpleMenuModel::Delegate implementation. 80 // ui::SimpleMenuModel::Delegate implementation.
77 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 81 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
78 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 82 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
79 virtual bool GetAcceleratorForCommandId( 83 virtual bool GetAcceleratorForCommandId(
80 int command_id, 84 int command_id,
81 ui::Accelerator* accelerator) OVERRIDE; 85 ui::Accelerator* accelerator) OVERRIDE;
82 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; 86 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
83 87
84 private: 88 private:
85 // The items this model represents, in presentation order. The first 89 // The items this model represents, in presentation order. The first
86 // string is the "key" which identifies the item. The second is the 90 // string is the "key" which identifies the item. The second is the
87 // display string for the item. 91 // display string for the item.
88 std::vector<std::pair<std::string, string16> > items_; 92 std::vector<std::pair<std::string, string16> > items_;
89 93
90 SuggestionsMenuModelDelegate* delegate_; 94 SuggestionsMenuModelDelegate* delegate_;
91 95
92 // The command id (and index) of the item which is currently checked. 96 // The command id (and index) of the item which is currently checked. Only one
97 // item is checked at a time.
93 int checked_item_; 98 int checked_item_;
94 99
95 DISALLOW_COPY_AND_ASSIGN(SuggestionsMenuModel); 100 DISALLOW_COPY_AND_ASSIGN(SuggestionsMenuModel);
96 }; 101 };
97 102
98 // A delegate interface to allow the AccountChooserModel to inform its owner 103 // A delegate interface to allow the AccountChooserModel to inform its owner
99 // of changes. 104 // of changes.
100 class AccountChooserModelDelegate { 105 class AccountChooserModelDelegate {
101 public: 106 public:
102 virtual ~AccountChooserModelDelegate(); 107 virtual ~AccountChooserModelDelegate();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 private: 193 private:
189 // The current year (e.g., 2012). 194 // The current year (e.g., 2012).
190 int this_year_; 195 int this_year_;
191 196
192 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel); 197 DISALLOW_COPY_AND_ASSIGN(YearComboboxModel);
193 }; 198 };
194 199
195 } // autofill 200 } // autofill
196 201
197 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_ 202 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_MODELS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698