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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.h

Issue 11743036: requestAutocomplete: change comboboxes to dropdown menus (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: isherman review Created 7 years, 11 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_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_
7 7
8 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" 8 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
9 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" 9 #include "chrome/browser/ui/autofill/autofill_dialog_view.h"
10 #include "ui/views/controls/button/button.h" 10 #include "ui/views/controls/button/button.h"
11 #include "ui/views/controls/combobox/combobox_listener.h" 11 #include "ui/views/controls/button/menu_button_listener.h"
12 #include "ui/views/controls/textfield/textfield_controller.h" 12 #include "ui/views/controls/textfield/textfield_controller.h"
13 #include "ui/views/focus/focus_manager.h" 13 #include "ui/views/focus/focus_manager.h"
14 #include "ui/views/window/dialog_delegate.h" 14 #include "ui/views/window/dialog_delegate.h"
15 15
16 class ConstrainedWindowViews; 16 class ConstrainedWindowViews;
17 17
18 namespace views { 18 namespace views {
19 class Checkbox; 19 class Checkbox;
20 class Combobox;
21 class Label;
22 class MenuButton;
23 class MenuRunner;
20 class Textfield; 24 class Textfield;
21 } 25 }
22 26
23 namespace ui { 27 namespace ui {
24 class ComboboxModel; 28 class ComboboxModel;
25 class KeyEvent; 29 class KeyEvent;
26 } 30 }
27 31
28 namespace autofill { 32 namespace autofill {
29 33
30 struct DetailInput; 34 struct DetailInput;
31 35
32 // Views toolkit implementation of the Autofill dialog that handles the 36 // Views toolkit implementation of the Autofill dialog that handles the
33 // imperative autocomplete API call. 37 // imperative autocomplete API call.
34 class AutofillDialogViews : public AutofillDialogView, 38 class AutofillDialogViews : public AutofillDialogView,
35 public views::DialogDelegate, 39 public views::DialogDelegate,
36 public views::ButtonListener, 40 public views::ButtonListener,
37 public views::ComboboxListener, 41 public views::MenuButtonListener,
38 public views::TextfieldController, 42 public views::TextfieldController,
39 public views::FocusChangeListener { 43 public views::FocusChangeListener {
40 public: 44 public:
41 explicit AutofillDialogViews(AutofillDialogController* controller); 45 explicit AutofillDialogViews(AutofillDialogController* controller);
42 virtual ~AutofillDialogViews(); 46 virtual ~AutofillDialogViews();
43 47
44 // AutofillDialogView implementation: 48 // AutofillDialogView implementation:
45 virtual void Show() OVERRIDE; 49 virtual void Show() OVERRIDE;
46 virtual void UpdateSection(DialogSection section) OVERRIDE; 50 virtual void UpdateSection(DialogSection section) OVERRIDE;
47 virtual int GetSuggestionSelection(DialogSection section) OVERRIDE;
48 virtual void GetUserInput(DialogSection section, 51 virtual void GetUserInput(DialogSection section,
49 DetailOutputMap* output) OVERRIDE; 52 DetailOutputMap* output) OVERRIDE;
50 virtual bool UseBillingForShipping() OVERRIDE; 53 virtual bool UseBillingForShipping() OVERRIDE;
51 54
52 // views::DialogDelegate implementation: 55 // views::DialogDelegate implementation:
53 virtual string16 GetWindowTitle() const OVERRIDE; 56 virtual string16 GetWindowTitle() const OVERRIDE;
54 virtual void WindowClosing() OVERRIDE; 57 virtual void WindowClosing() OVERRIDE;
55 virtual void DeleteDelegate() OVERRIDE; 58 virtual void DeleteDelegate() OVERRIDE;
56 virtual views::Widget* GetWidget() OVERRIDE; 59 virtual views::Widget* GetWidget() OVERRIDE;
57 virtual const views::Widget* GetWidget() const OVERRIDE; 60 virtual const views::Widget* GetWidget() const OVERRIDE;
58 virtual views::View* GetContentsView() OVERRIDE; 61 virtual views::View* GetContentsView() OVERRIDE;
59 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; 62 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE;
60 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; 63 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE;
61 virtual bool Cancel() OVERRIDE; 64 virtual bool Cancel() OVERRIDE;
62 virtual bool Accept() OVERRIDE; 65 virtual bool Accept() OVERRIDE;
63 66
64 // views::ButtonListener implementation: 67 // views::ButtonListener implementation:
65 virtual void ButtonPressed(views::Button* sender, 68 virtual void ButtonPressed(views::Button* sender,
66 const ui::Event& event) OVERRIDE; 69 const ui::Event& event) OVERRIDE;
67 70
68 // views::ComboboxListener implementation: 71 // views::MenuButtonListener implementation:
69 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; 72 virtual void OnMenuButtonClicked(views::View* source,
73 const gfx::Point& point) OVERRIDE;
70 74
71 // views::TextfieldController implementation: 75 // views::TextfieldController implementation:
72 virtual void ContentsChanged(views::Textfield* sender, 76 virtual void ContentsChanged(views::Textfield* sender,
73 const string16& new_contents) OVERRIDE; 77 const string16& new_contents) OVERRIDE;
74 virtual bool HandleKeyEvent(views::Textfield* sender, 78 virtual bool HandleKeyEvent(views::Textfield* sender,
75 const ui::KeyEvent& key_event) OVERRIDE; 79 const ui::KeyEvent& key_event) OVERRIDE;
76 80
77 // views::FocusChangeListener implementation. 81 // views::FocusChangeListener implementation.
78 virtual void OnWillChangeFocus(views::View* focused_before, 82 virtual void OnWillChangeFocus(views::View* focused_before,
79 views::View* focused_now) OVERRIDE; 83 views::View* focused_now) OVERRIDE;
80 virtual void OnDidChangeFocus(views::View* focused_before, 84 virtual void OnDidChangeFocus(views::View* focused_before,
81 views::View* focused_now) OVERRIDE; 85 views::View* focused_now) OVERRIDE;
82 86
83 private: 87 private:
84 typedef std::map<const DetailInput*, views::Textfield*> TextfieldMap; 88 typedef std::map<const DetailInput*, views::Textfield*> TextfieldMap;
85 typedef std::map<const DetailInput*, views::Combobox*> ComboboxMap; 89 typedef std::map<const DetailInput*, views::Combobox*> ComboboxMap;
86 90
87 // A convenience struct for holding pointers to views within each detail 91 // A convenience struct for holding pointers to views within each detail
88 // section. None of the member pointers are owned. 92 // section. None of the member pointers are owned.
89 struct DetailsGroup { 93 struct DetailsGroup {
90 DetailsGroup(); 94 explicit DetailsGroup(DialogSection section);
91 ~DetailsGroup(); 95 ~DetailsGroup();
92 96
97 // The section this group is associated with.
98 const DialogSection section;
93 // The view that contains the entire section (label + input). 99 // The view that contains the entire section (label + input).
94 views::View* container; 100 views::View* container;
95 // The combobox that holds suggested values.
96 views::Combobox* suggested_input;
97 // The view that allows manual input. 101 // The view that allows manual input.
98 views::View* manual_input; 102 views::View* manual_input;
99 // The textfields in |manual_input|, tracked by their DetailInput. 103 // The textfields in |manual_input|, tracked by their DetailInput.
100 TextfieldMap textfields; 104 TextfieldMap textfields;
101 // The comboboxes in |manual_input|, tracked by their DetailInput. 105 // The comboboxes in |manual_input|, tracked by their DetailInput.
102 ComboboxMap comboboxes; 106 ComboboxMap comboboxes;
107 // The label that holds the text of the suggested data. This will be
108 // visible IFF |manual_input| is not visible.
109 views::Label* suggested_info;
110 // The view that allows selecting other data suggestions.
111 views::MenuButton* suggested_button;
103 }; 112 };
104 113
105 void InitChildViews(); 114 void InitChildViews();
106 115
107 // Creates and returns a view that holds all detail sections. 116 // Creates and returns a view that holds all detail sections.
108 views::View* CreateDetailsContainer(); 117 views::View* CreateDetailsContainer();
109 118
110 // Creates and returns a view that holds the requesting host and intro text. 119 // Creates and returns a view that holds the requesting host and intro text.
111 views::View* CreateIntroContainer(); 120 views::View* CreateIntroContainer();
112 121
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // The credit card and billing sections are combined, so cc_.container is 160 // The credit card and billing sections are combined, so cc_.container is
152 // not used. 161 // not used.
153 DetailsGroup cc_; 162 DetailsGroup cc_;
154 DetailsGroup billing_; 163 DetailsGroup billing_;
155 DetailsGroup shipping_; 164 DetailsGroup shipping_;
156 165
157 // The checkbox that controls whether to use the billing details for shipping 166 // The checkbox that controls whether to use the billing details for shipping
158 // as well. 167 // as well.
159 views::Checkbox* use_billing_for_shipping_; 168 views::Checkbox* use_billing_for_shipping_;
160 169
170 // Runs the suggestion menu (triggered by each section's |suggested_button|.
171 scoped_ptr<views::MenuRunner> menu_runner_;
172
161 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); 173 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews);
162 }; 174 };
163 175
164 } // namespace autofill 176 } // namespace autofill
165 177
166 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ 178 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_view.h ('k') | chrome/browser/ui/views/autofill/autofill_dialog_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698