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_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/combobox/combobox_listener.h" |
| 12 #include "ui/views/controls/textfield/textfield_controller.h" |
| 13 #include "ui/views/focus/focus_manager.h" |
12 #include "ui/views/window/dialog_delegate.h" | 14 #include "ui/views/window/dialog_delegate.h" |
13 | 15 |
14 class ConstrainedWindowViews; | 16 class ConstrainedWindowViews; |
15 | 17 |
16 namespace views { | 18 namespace views { |
17 class Checkbox; | 19 class Checkbox; |
18 class Textfield; | 20 class Textfield; |
19 } | 21 } |
20 | 22 |
21 namespace ui { | 23 namespace ui { |
22 class ComboboxModel; | 24 class ComboboxModel; |
| 25 class KeyEvent; |
23 } | 26 } |
24 | 27 |
25 namespace autofill { | 28 namespace autofill { |
26 | 29 |
27 struct DetailInput; | 30 struct DetailInput; |
28 | 31 |
29 // Views toolkit implementation of the Autofill dialog that handles the | 32 // Views toolkit implementation of the Autofill dialog that handles the |
30 // imperative autocomplete API call. | 33 // imperative autocomplete API call. |
31 class AutofillDialogViews : public AutofillDialogView, | 34 class AutofillDialogViews : public AutofillDialogView, |
32 public views::DialogDelegate, | 35 public views::DialogDelegate, |
33 public views::ButtonListener, | 36 public views::ButtonListener, |
34 public views::ComboboxListener { | 37 public views::ComboboxListener, |
| 38 public views::TextfieldController, |
| 39 public views::FocusChangeListener { |
35 public: | 40 public: |
36 explicit AutofillDialogViews(AutofillDialogController* controller); | 41 explicit AutofillDialogViews(AutofillDialogController* controller); |
37 virtual ~AutofillDialogViews(); | 42 virtual ~AutofillDialogViews(); |
38 | 43 |
39 // AutofillDialogView implementation: | 44 // AutofillDialogView implementation: |
40 virtual void Show() OVERRIDE; | 45 virtual void Show() OVERRIDE; |
| 46 virtual void UpdateSection(DialogSection section) OVERRIDE; |
41 virtual int GetSuggestionSelection(DialogSection section) OVERRIDE; | 47 virtual int GetSuggestionSelection(DialogSection section) OVERRIDE; |
42 virtual void GetUserInput(DialogSection section, | 48 virtual void GetUserInput(DialogSection section, |
43 DetailOutputMap* output) OVERRIDE; | 49 DetailOutputMap* output) OVERRIDE; |
44 virtual bool UseBillingForShipping() OVERRIDE; | 50 virtual bool UseBillingForShipping() OVERRIDE; |
45 | 51 |
46 // views::DialogDelegate implementation: | 52 // views::DialogDelegate implementation: |
47 virtual string16 GetWindowTitle() const OVERRIDE; | 53 virtual string16 GetWindowTitle() const OVERRIDE; |
| 54 virtual void WindowClosing() OVERRIDE; |
48 virtual void DeleteDelegate() OVERRIDE; | 55 virtual void DeleteDelegate() OVERRIDE; |
49 virtual views::Widget* GetWidget() OVERRIDE; | 56 virtual views::Widget* GetWidget() OVERRIDE; |
50 virtual const views::Widget* GetWidget() const OVERRIDE; | 57 virtual const views::Widget* GetWidget() const OVERRIDE; |
51 virtual views::View* GetContentsView() OVERRIDE; | 58 virtual views::View* GetContentsView() OVERRIDE; |
52 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; | 59 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; |
53 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 60 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; |
54 virtual bool Cancel() OVERRIDE; | 61 virtual bool Cancel() OVERRIDE; |
55 virtual bool Accept() OVERRIDE; | 62 virtual bool Accept() OVERRIDE; |
56 | 63 |
57 // views::ButtonListener implementation: | 64 // views::ButtonListener implementation: |
58 virtual void ButtonPressed(views::Button* sender, | 65 virtual void ButtonPressed(views::Button* sender, |
59 const ui::Event& event) OVERRIDE; | 66 const ui::Event& event) OVERRIDE; |
60 | 67 |
61 // views::ComboboxListener implementation: | 68 // views::ComboboxListener implementation: |
62 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; | 69 virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; |
63 | 70 |
| 71 // views::TextfieldController implementation: |
| 72 virtual void ContentsChanged(views::Textfield* sender, |
| 73 const string16& new_contents) OVERRIDE; |
| 74 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 75 const ui::KeyEvent& key_event) OVERRIDE; |
| 76 |
| 77 // views::FocusChangeListener implementation. |
| 78 virtual void OnWillChangeFocus(views::View* focused_before, |
| 79 views::View* focused_now) OVERRIDE; |
| 80 virtual void OnDidChangeFocus(views::View* focused_before, |
| 81 views::View* focused_now) OVERRIDE; |
| 82 |
64 private: | 83 private: |
65 typedef std::map<const DetailInput*, views::Textfield*> TextfieldMap; | 84 typedef std::map<const DetailInput*, views::Textfield*> TextfieldMap; |
66 typedef std::map<const DetailInput*, views::Combobox*> ComboboxMap; | 85 typedef std::map<const DetailInput*, views::Combobox*> ComboboxMap; |
67 | 86 |
68 // A convenience struct for holding pointers to views within each detail | 87 // A convenience struct for holding pointers to views within each detail |
69 // section. None of the member pointers are owned. | 88 // section. None of the member pointers are owned. |
70 struct DetailsGroup { | 89 struct DetailsGroup { |
71 DetailsGroup(); | 90 DetailsGroup(); |
72 ~DetailsGroup(); | 91 ~DetailsGroup(); |
73 | 92 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // The checkbox that controls whether to use the billing details for shipping | 157 // The checkbox that controls whether to use the billing details for shipping |
139 // as well. | 158 // as well. |
140 views::Checkbox* use_billing_for_shipping_; | 159 views::Checkbox* use_billing_for_shipping_; |
141 | 160 |
142 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); | 161 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
143 }; | 162 }; |
144 | 163 |
145 } // namespace autofill | 164 } // namespace autofill |
146 | 165 |
147 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 166 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
OLD | NEW |