Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
| 6 | #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
| 7 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 8 | #include <map> |
| 9 | |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 10 | #include "base/memory/scoped_vector.h" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 11 | #include "base/memory/weak_ptr.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 12 | #include "base/scoped_observer.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 13 | #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 14 | #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 15 | #include "chrome/browser/ui/autofill/testable_autofill_dialog_view.h" |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 16 | #include "ui/base/animation/animation_delegate.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 17 | #include "ui/views/controls/button/button.h" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 18 | #include "ui/views/controls/button/menu_button_listener.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 19 | #include "ui/views/controls/combobox/combobox_listener.h" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 20 | #include "ui/views/controls/link_listener.h" |
| 21 | #include "ui/views/controls/progress_bar.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 22 | #include "ui/views/controls/scroll_view.h" |
| 23 | #include "ui/views/controls/styled_label_listener.h" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 24 | #include "ui/views/controls/textfield/textfield_controller.h" |
| 25 | #include "ui/views/focus/focus_manager.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 26 | #include "ui/views/widget/widget_observer.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 27 | #include "ui/views/window/dialog_delegate.h" |
| 28 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 29 | namespace content { |
| 30 | class KeyboardListener; |
| 31 | } |
| 32 | |
| 33 | namespace gfx { |
| 34 | class Image; |
| 35 | } |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 36 | |
| 37 | namespace views { |
Ben Murdoch | 58e6fbe | 2013-07-26 10:20:38 +0100 | [diff] [blame] | 38 | class BubbleBorder; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 39 | class Checkbox; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 40 | class Combobox; |
| 41 | class FocusManager; |
| 42 | class ImageButton; |
| 43 | class ImageView; |
| 44 | class Label; |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 45 | class LabelButton; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 46 | class Link; |
| 47 | class MenuRunner; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 48 | class StyledLabel; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 49 | class WebView; |
| 50 | class Widget; |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 51 | } // namespace views |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 52 | |
| 53 | namespace ui { |
| 54 | class ComboboxModel; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 55 | class KeyEvent; |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 56 | class MultiAnimation; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | namespace autofill { |
| 60 | |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 61 | class AutofillDialogSignInDelegate; |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 62 | class DecoratedTextfield; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 63 | struct DetailInput; |
| 64 | |
| 65 | // Views toolkit implementation of the Autofill dialog that handles the |
| 66 | // imperative autocomplete API call. |
| 67 | class AutofillDialogViews : public AutofillDialogView, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 68 | public TestableAutofillDialogView, |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 69 | public views::DialogDelegateView, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 70 | public views::WidgetObserver, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 71 | public views::ButtonListener, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 72 | public views::TextfieldController, |
| 73 | public views::FocusChangeListener, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 74 | public views::ComboboxListener, |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 75 | public views::StyledLabelListener { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 76 | public: |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 77 | explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 78 | virtual ~AutofillDialogViews(); |
| 79 | |
| 80 | // AutofillDialogView implementation: |
| 81 | virtual void Show() OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 82 | virtual void Hide() OVERRIDE; |
| 83 | virtual void UpdateAccountChooser() OVERRIDE; |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 84 | virtual void UpdateAutocheckoutStepsArea() OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 85 | virtual void UpdateButtonStrip() OVERRIDE; |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 86 | virtual void UpdateDetailArea() OVERRIDE; |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 87 | virtual void UpdateForErrors() OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 88 | virtual void UpdateNotificationArea() OVERRIDE; |
| 89 | virtual void UpdateSection(DialogSection section) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 90 | virtual void FillSection(DialogSection section, |
| 91 | const DetailInput& originating_input) OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 92 | virtual void GetUserInput(DialogSection section, |
| 93 | DetailOutputMap* output) OVERRIDE; |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 94 | virtual base::string16 GetCvc() OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 95 | virtual bool SaveDetailsLocally() OVERRIDE; |
| 96 | virtual const content::NavigationController* ShowSignIn() OVERRIDE; |
| 97 | virtual void HideSignIn() OVERRIDE; |
| 98 | virtual void UpdateProgressBar(double value) OVERRIDE; |
| 99 | virtual void ModelChanged() OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 100 | virtual TestableAutofillDialogView* GetTestableView() OVERRIDE; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 101 | virtual void OnSignInResize(const gfx::Size& pref_size) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 102 | |
| 103 | // TestableAutofillDialogView implementation: |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 104 | virtual void SubmitForTesting() OVERRIDE; |
| 105 | virtual void CancelForTesting() OVERRIDE; |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 106 | virtual base::string16 GetTextContentsOfInput( |
| 107 | const DetailInput& input) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 108 | virtual void SetTextContentsOfInput(const DetailInput& input, |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 109 | const base::string16& contents) OVERRIDE; |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 110 | virtual void SetTextContentsOfSuggestionInput( |
| 111 | DialogSection section, |
| 112 | const base::string16& text) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 113 | virtual void ActivateInput(const DetailInput& input) OVERRIDE; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 114 | virtual gfx::Size GetSize() const OVERRIDE; |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 115 | |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 116 | // views::View implementation. |
| 117 | virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 118 | virtual void Layout() OVERRIDE; |
| 119 | virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
| 120 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 121 | // views::DialogDelegate implementation: |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 122 | virtual base::string16 GetWindowTitle() const OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 123 | virtual void WindowClosing() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 124 | virtual void DeleteDelegate() OVERRIDE; |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 125 | virtual views::View* CreateOverlayView() OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 126 | virtual int GetDialogButtons() const OVERRIDE; |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 127 | virtual base::string16 GetDialogButtonLabel(ui::DialogButton button) const |
| 128 | OVERRIDE; |
Ben Murdoch | ca12bfa | 2013-07-23 11:17:05 +0100 | [diff] [blame] | 129 | virtual bool ShouldDefaultButtonBeBlue() const OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 130 | virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 131 | virtual views::View* CreateExtraView() OVERRIDE; |
| 132 | virtual views::View* CreateTitlebarExtraView() OVERRIDE; |
| 133 | virtual views::View* CreateFootnoteView() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 134 | virtual bool Cancel() OVERRIDE; |
| 135 | virtual bool Accept() OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 136 | virtual views::NonClientFrameView* CreateNonClientFrameView( |
| 137 | views::Widget* widget) OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 138 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 139 | // views::WidgetObserver implementation: |
| 140 | virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| 141 | virtual void OnWidgetBoundsChanged(views::Widget* widget, |
| 142 | const gfx::Rect& new_bounds) OVERRIDE; |
| 143 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 144 | // views::ButtonListener implementation: |
| 145 | virtual void ButtonPressed(views::Button* sender, |
| 146 | const ui::Event& event) OVERRIDE; |
| 147 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 148 | // views::TextfieldController implementation: |
| 149 | virtual void ContentsChanged(views::Textfield* sender, |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 150 | const base::string16& new_contents) OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 151 | virtual bool HandleKeyEvent(views::Textfield* sender, |
| 152 | const ui::KeyEvent& key_event) OVERRIDE; |
| 153 | virtual bool HandleMouseEvent(views::Textfield* sender, |
| 154 | const ui::MouseEvent& key_event) OVERRIDE; |
| 155 | |
| 156 | // views::FocusChangeListener implementation. |
| 157 | virtual void OnWillChangeFocus(views::View* focused_before, |
| 158 | views::View* focused_now) OVERRIDE; |
| 159 | virtual void OnDidChangeFocus(views::View* focused_before, |
| 160 | views::View* focused_now) OVERRIDE; |
| 161 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 162 | // views::ComboboxListener implementation: |
| 163 | virtual void OnSelectedIndexChanged(views::Combobox* combobox) OVERRIDE; |
| 164 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 165 | // views::StyledLabelListener implementation: |
| 166 | virtual void StyledLabelLinkClicked(const ui::Range& range, int event_flags) |
| 167 | OVERRIDE; |
| 168 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 169 | private: |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 170 | // A class that creates and manages a widget for error messages. |
| 171 | class ErrorBubble : public views::WidgetObserver { |
| 172 | public: |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 173 | ErrorBubble(views::View* anchor, const base::string16& message); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 174 | virtual ~ErrorBubble(); |
| 175 | |
| 176 | bool IsShowing(); |
| 177 | |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 178 | // Re-positions the bubble over |anchor_|. If |anchor_| is not visible, |
| 179 | // the bubble will hide. |
| 180 | void UpdatePosition(); |
| 181 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 182 | virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| 183 | |
| 184 | views::View* anchor() { return anchor_; } |
| 185 | |
| 186 | private: |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 187 | // Calculates and returns the bounds of |widget_|, depending on |anchor_| |
| 188 | // and |contents_|. |
| 189 | gfx::Rect GetBoundsForWidget(); |
| 190 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 191 | views::Widget* widget_; // Weak, may be NULL. |
| 192 | views::View* anchor_; // Weak. |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 193 | // The contents view of |widget_|. |
| 194 | views::View* contents_; // Weak. |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 195 | ScopedObserver<views::Widget, ErrorBubble> observer_; |
| 196 | |
| 197 | DISALLOW_COPY_AND_ASSIGN(ErrorBubble); |
| 198 | }; |
| 199 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 200 | // A View which displays the currently selected account and lets the user |
| 201 | // switch accounts. |
| 202 | class AccountChooser : public views::View, |
| 203 | public views::LinkListener, |
| 204 | public base::SupportsWeakPtr<AccountChooser> { |
| 205 | public: |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 206 | explicit AccountChooser(AutofillDialogViewDelegate* delegate); |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 207 | virtual ~AccountChooser(); |
| 208 | |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 209 | // Updates the view based on the state that |delegate_| reports. |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 210 | void Update(); |
| 211 | |
| 212 | // views::View implementation. |
| 213 | virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 214 | virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 215 | |
| 216 | // views::LinkListener implementation. |
| 217 | virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
| 218 | |
| 219 | private: |
| 220 | // The icon for the currently in-use account. |
| 221 | views::ImageView* image_; |
| 222 | |
| 223 | // The label for the currently in-use account. |
| 224 | views::Label* label_; |
| 225 | |
| 226 | // The drop arrow. |
| 227 | views::ImageView* arrow_; |
| 228 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 229 | // The sign in link. |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 230 | views::Link* link_; |
| 231 | |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 232 | // The delegate |this| queries for logic and state. |
| 233 | AutofillDialogViewDelegate* delegate_; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 234 | |
| 235 | // Runs the suggestion menu (triggered by each section's |suggested_button|. |
| 236 | scoped_ptr<views::MenuRunner> menu_runner_; |
| 237 | |
| 238 | DISALLOW_COPY_AND_ASSIGN(AccountChooser); |
| 239 | }; |
| 240 | |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 241 | // A view which displays an image, optionally some messages and a button. Used |
| 242 | // for the splash page as well as the Wallet interstitial. |
| 243 | class OverlayView : public views::View, |
| 244 | public ui::AnimationDelegate { |
| 245 | public: |
| 246 | // The listener is informed when |button_| is pressed. |
| 247 | explicit OverlayView(views::ButtonListener* listener); |
| 248 | virtual ~OverlayView(); |
| 249 | |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 250 | // Returns a height which should be used when the contents view has width |
| 251 | // |w|. Note that the value returned should be used as the height of the |
| 252 | // dialog's contents. |
| 253 | int GetHeightForContentsForWidth(int w); |
| 254 | |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 255 | // Sets properties that should be displayed. |
| 256 | void SetState(const DialogOverlayState& state, |
| 257 | views::ButtonListener* listener); |
| 258 | |
| 259 | // Fades the view out after a delay. |
| 260 | void BeginFadeOut(); |
| 261 | |
| 262 | // ui::AnimationDelegate implementation: |
| 263 | virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 264 | virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 265 | |
| 266 | // views::View implementation: |
Ben Murdoch | 58e6fbe | 2013-07-26 10:20:38 +0100 | [diff] [blame] | 267 | virtual gfx::Insets GetInsets() const OVERRIDE; |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 268 | virtual void Layout() OVERRIDE; |
| 269 | virtual const char* GetClassName() const OVERRIDE; |
| 270 | virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 271 | virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; |
| 272 | |
| 273 | private: |
Ben Murdoch | 58e6fbe | 2013-07-26 10:20:38 +0100 | [diff] [blame] | 274 | // Gets the border of the non-client frame view as a BubbleBorder. |
| 275 | views::BubbleBorder* GetBubbleBorder(); |
| 276 | |
| 277 | // Gets the bounds of this view without the frame view's bubble border. |
| 278 | gfx::Rect ContentBoundsSansBubbleBorder(); |
| 279 | |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 280 | // Child View. Front and center. |
| 281 | views::ImageView* image_view_; |
| 282 | // Child View. When visible, below |image_view_|. |
| 283 | views::View* message_stack_; |
| 284 | // Child View. When visible, below |message_stack_|. |
| 285 | views::LabelButton* button_; |
| 286 | |
| 287 | // This MultiAnimation is used to first fade out the contents of the |
| 288 | // overlay, then fade out the background of the overlay (revealing the |
| 289 | // dialog behind the overlay). This avoids cross-fade. |
| 290 | scoped_ptr<ui::MultiAnimation> fade_out_; |
| 291 | |
| 292 | DISALLOW_COPY_AND_ASSIGN(OverlayView); |
| 293 | }; |
| 294 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 295 | // An area for notifications. Some notifications point at the account chooser. |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 296 | class NotificationArea : public views::View, |
| 297 | public views::ButtonListener { |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 298 | public: |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 299 | explicit NotificationArea(AutofillDialogViewDelegate* delegate); |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 300 | virtual ~NotificationArea(); |
| 301 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 302 | // Displays the given notifications. |
| 303 | void SetNotifications(const std::vector<DialogNotification>& notifications); |
| 304 | |
| 305 | // views::View implementation. |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 306 | virtual gfx::Size GetPreferredSize() OVERRIDE; |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 307 | virtual const char* GetClassName() const OVERRIDE; |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 308 | virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 309 | virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 310 | |
| 311 | // views::ButtonListener implementation: |
| 312 | virtual void ButtonPressed(views::Button* sender, |
| 313 | const ui::Event& event) OVERRIDE; |
| 314 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 315 | void set_arrow_centering_anchor( |
| 316 | const base::WeakPtr<views::View>& arrow_centering_anchor) { |
| 317 | arrow_centering_anchor_ = arrow_centering_anchor; |
| 318 | } |
| 319 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 320 | private: |
| 321 | // Utility function for determining whether an arrow should be drawn |
| 322 | // pointing at |arrow_centering_anchor_|. |
| 323 | bool HasArrow(); |
| 324 | |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 325 | // A reference to the delegate/controller than owns this view. |
| 326 | // Used to report when checkboxes change their values. |
| 327 | AutofillDialogViewDelegate* delegate_; // weak |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 328 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 329 | // The currently showing checkbox, or NULL if none exists. |
| 330 | views::Checkbox* checkbox_; // weak |
| 331 | |
| 332 | // If HasArrow() is true, the arrow should point at this. |
| 333 | base::WeakPtr<views::View> arrow_centering_anchor_; |
| 334 | |
| 335 | std::vector<DialogNotification> notifications_; |
| 336 | |
| 337 | DISALLOW_COPY_AND_ASSIGN(NotificationArea); |
| 338 | }; |
| 339 | |
| 340 | typedef std::map<const DetailInput*, DecoratedTextfield*> TextfieldMap; |
| 341 | typedef std::map<const DetailInput*, views::Combobox*> ComboboxMap; |
| 342 | |
| 343 | // A view that packs a label on the left and some related controls |
| 344 | // on the right. |
| 345 | class SectionContainer : public views::View { |
| 346 | public: |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 347 | SectionContainer(const base::string16& label, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 348 | views::View* controls, |
| 349 | views::Button* proxy_button); |
| 350 | virtual ~SectionContainer(); |
| 351 | |
| 352 | // Sets the visual appearance of the section to active (considered active |
| 353 | // when showing the menu or hovered by the mouse cursor). |
| 354 | void SetActive(bool active); |
| 355 | |
| 356 | // Sets whether mouse events should be forwarded to |proxy_button_|. |
| 357 | void SetForwardMouseEvents(bool forward); |
| 358 | |
| 359 | // views::View implementation. |
| 360 | virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; |
| 361 | virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
| 362 | virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 363 | virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 364 | virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 365 | |
| 366 | private: |
| 367 | // Converts |event| to one suitable for |proxy_button_|. |
| 368 | static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event); |
| 369 | |
| 370 | // Mouse events on |this| are sent to this button. |
| 371 | views::Button* proxy_button_; // Weak reference. |
| 372 | |
| 373 | // When true, mouse events will be forwarded to |proxy_button_|. |
| 374 | bool forward_mouse_events_; |
| 375 | |
| 376 | DISALLOW_COPY_AND_ASSIGN(SectionContainer); |
| 377 | }; |
| 378 | |
| 379 | // A view that contains a suggestion (such as a known address) and a link to |
| 380 | // edit the suggestion. |
| 381 | class SuggestionView : public views::View { |
| 382 | public: |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 383 | SuggestionView(const base::string16& edit_label, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 384 | AutofillDialogViews* autofill_dialog); |
| 385 | virtual ~SuggestionView(); |
| 386 | |
| 387 | // Sets the display text of the suggestion. |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 388 | void SetSuggestionText(const base::string16& text, |
| 389 | gfx::Font::FontStyle style); |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 390 | |
| 391 | // Sets the icon which should be displayed ahead of the text. |
| 392 | void SetSuggestionIcon(const gfx::Image& image); |
| 393 | |
| 394 | // Shows an auxiliary textfield to the right of the suggestion icon and |
| 395 | // text. This is currently only used to show a CVC field for the CC section. |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 396 | void ShowTextfield(const base::string16& placeholder_text, |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 397 | const gfx::Image& icon); |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 398 | |
| 399 | DecoratedTextfield* decorated_textfield() { return decorated_; } |
| 400 | |
| 401 | private: |
| 402 | // The label that holds the suggestion description text. |
| 403 | views::Label* label_; |
| 404 | // The second (and greater) line of text that describes the suggestion. |
| 405 | views::Label* label_line_2_; |
| 406 | // The icon that comes just before |label_|. |
| 407 | views::ImageView* icon_; |
| 408 | // A view to contain |label_| and |icon_|. |
| 409 | views::View* label_container_; |
| 410 | // The input set by ShowTextfield. |
| 411 | DecoratedTextfield* decorated_; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 412 | // An "Edit" link that flips to editable inputs rather than suggestion text. |
| 413 | views::Link* edit_link_; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 414 | |
| 415 | DISALLOW_COPY_AND_ASSIGN(SuggestionView); |
| 416 | }; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 417 | |
| 418 | // A convenience struct for holding pointers to views within each detail |
| 419 | // section. None of the member pointers are owned. |
| 420 | struct DetailsGroup { |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 421 | explicit DetailsGroup(DialogSection section); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 422 | ~DetailsGroup(); |
| 423 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 424 | // The section this group is associated with. |
| 425 | const DialogSection section; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 426 | // The view that contains the entire section (label + input). |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 427 | SectionContainer* container; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 428 | // The view that allows manual input. |
| 429 | views::View* manual_input; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 430 | // The textfields in |manual_input|, tracked by their DetailInput. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 431 | TextfieldMap textfields; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 432 | // The comboboxes in |manual_input|, tracked by their DetailInput. |
| 433 | ComboboxMap comboboxes; |
| 434 | // The view that holds the text of the suggested data. This will be |
| 435 | // visible IFF |manual_input| is not visible. |
| 436 | SuggestionView* suggested_info; |
| 437 | // The view that allows selecting other data suggestions. |
| 438 | views::ImageButton* suggested_button; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 439 | }; |
| 440 | |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 441 | // Area for displaying that status of various steps in an Autocheckout flow. |
| 442 | class AutocheckoutStepsArea : public views::View { |
| 443 | public: |
| 444 | AutocheckoutStepsArea(); |
| 445 | virtual ~AutocheckoutStepsArea() {} |
| 446 | |
| 447 | // Display the given steps. |
| 448 | void SetSteps(const std::vector<DialogAutocheckoutStep>& steps); |
| 449 | |
| 450 | private: |
| 451 | DISALLOW_COPY_AND_ASSIGN(AutocheckoutStepsArea); |
| 452 | }; |
| 453 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 454 | class AutocheckoutProgressBar : public views::ProgressBar { |
| 455 | public: |
| 456 | AutocheckoutProgressBar(); |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 457 | virtual ~AutocheckoutProgressBar(); |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 458 | |
| 459 | private: |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 460 | // Overriden from View |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 461 | virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 462 | |
| 463 | DISALLOW_COPY_AND_ASSIGN(AutocheckoutProgressBar); |
| 464 | }; |
| 465 | |
| 466 | typedef std::map<DialogSection, DetailsGroup> DetailGroupMap; |
| 467 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 468 | void InitChildViews(); |
| 469 | |
| 470 | // Creates and returns a view that holds all detail sections. |
| 471 | views::View* CreateDetailsContainer(); |
| 472 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 473 | // Creates and returns a view that holds the requesting host and intro text. |
| 474 | views::View* CreateNotificationArea(); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 475 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 476 | // Creates and returns a view that holds the main controls of this dialog. |
| 477 | views::View* CreateMainContainer(); |
| 478 | |
| 479 | // Creates a detail section (Shipping, Email, etc.) with the given label, |
| 480 | // inputs View, and suggestion model. Relevant pointers are stored in |group|. |
| 481 | void CreateDetailsSection(DialogSection section); |
| 482 | |
| 483 | // Like CreateDetailsSection, but creates the combined billing/cc section, |
| 484 | // which is somewhat more complicated than the others. |
| 485 | void CreateBillingSection(); |
| 486 | |
| 487 | // Creates the view that holds controls for inputing or selecting data for |
| 488 | // a given section. |
| 489 | views::View* CreateInputsContainer(DialogSection section); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 490 | |
| 491 | // Creates a grid of textfield views for the given section, and stores them |
| 492 | // in the appropriate DetailsGroup. The top level View in the hierarchy is |
| 493 | // returned. |
| 494 | views::View* InitInputsView(DialogSection section); |
| 495 | |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 496 | // Updates the given section to match the state provided by |delegate_|. If |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 497 | // |clobber_inputs| is true, the current state of the textfields will be |
| 498 | // ignored, otherwise their contents will be preserved. |
| 499 | void UpdateSectionImpl(DialogSection section, bool clobber_inputs); |
| 500 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 501 | // Updates the visual state of the given group as per the model. |
| 502 | void UpdateDetailsGroupState(const DetailsGroup& group); |
| 503 | |
| 504 | // Gets a pointer to the DetailsGroup that's associated with the given section |
| 505 | // of the dialog. |
| 506 | DetailsGroup* GroupForSection(DialogSection section); |
| 507 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 508 | // Gets a pointer to the DetailsGroup that's associated with a given |view|. |
| 509 | // Returns NULL if no DetailsGroup was found. |
| 510 | DetailsGroup* GroupForView(views::View* view); |
| 511 | |
| 512 | // Sets the visual state for an input to be either valid or invalid. This |
| 513 | // should work on Comboboxes or DecoratedTextfields. If |message| is empty, |
| 514 | // the input is valid. |
| 515 | template<class T> |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 516 | void SetValidityForInput(T* input, const base::string16& message); |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 517 | |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 518 | // Shows an error bubble pointing at |view| if |view| has a message in |
| 519 | // |validity_map_|. |
| 520 | void ShowErrorBubbleForViewIfNecessary(views::View* view); |
| 521 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 522 | // Updates validity of the inputs in |section| with the new validity data. |
| 523 | void MarkInputsInvalid(DialogSection section, |
| 524 | const ValidityData& validity_data); |
| 525 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 526 | // Checks all manual inputs in |group| for validity. Decorates the invalid |
| 527 | // ones and returns true if all were valid. |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 528 | bool ValidateGroup(const DetailsGroup& group, ValidationType type); |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 529 | |
| 530 | // Checks all manual inputs in the form for validity. Decorates the invalid |
| 531 | // ones and returns true if all were valid. |
| 532 | bool ValidateForm(); |
| 533 | |
| 534 | // When an input textfield is edited (its contents change) or activated |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 535 | // (clicked while focused), this function will inform the delegate that it's |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 536 | // time to show a suggestion popup and possibly reset the validity state of |
| 537 | // the input. |
| 538 | void TextfieldEditedOrActivated(views::Textfield* textfield, bool was_edit); |
| 539 | |
Ben Murdoch | 2385ea3 | 2013-08-06 11:01:04 +0100 | [diff] [blame] | 540 | // Updates the views in the button strip. |
| 541 | void UpdateButtonStripExtraView(); |
Torne (Richard Coles) | b2df76e | 2013-05-13 16:52:09 +0100 | [diff] [blame] | 542 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 543 | // Call this when the size of anything in |contents_| might've changed. |
| 544 | void ContentsPreferredSizeChanged(); |
| 545 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 546 | // Gets the textfield view that is shown for the given DetailInput model, or |
| 547 | // NULL. |
| 548 | views::Textfield* TextfieldForInput(const DetailInput& input); |
| 549 | |
| 550 | // Gets the combobox view that is shown for the given DetailInput model, or |
| 551 | // NULL. |
| 552 | views::Combobox* ComboboxForInput(const DetailInput& input); |
| 553 | |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 554 | // Called when the details container changes in size or position. |
| 555 | void DetailsContainerBoundsChanged(); |
| 556 | |
Ben Murdoch | 3240926 | 2013-08-07 11:04:47 +0100 | [diff] [blame] | 557 | // The delegate that drives this view. Weak pointer, always non-NULL. |
| 558 | AutofillDialogViewDelegate* const delegate_; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 559 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 560 | // The window that displays |contents_|. Weak pointer; may be NULL when the |
| 561 | // dialog is closing. |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 562 | views::Widget* window_; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 563 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 564 | // A DialogSection-keyed map of the DetailGroup structs. |
| 565 | DetailGroupMap detail_groups_; |
| 566 | |
| 567 | // Somewhere to show notification messages about errors, warnings, or promos. |
| 568 | NotificationArea* notification_area_; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 569 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 570 | // Runs the suggestion menu (triggered by each section's |suggested_button|. |
| 571 | scoped_ptr<views::MenuRunner> menu_runner_; |
| 572 | |
| 573 | // The view that allows the user to toggle the data source. |
| 574 | AccountChooser* account_chooser_; |
| 575 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 576 | // A WebView to that navigates to a Google sign-in page to allow the user to |
| 577 | // sign-in. |
| 578 | views::WebView* sign_in_webview_; |
| 579 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 580 | // View that wraps |details_container_| and makes it scroll vertically. |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 581 | views::ScrollView* scrollable_area_; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 582 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 583 | // View to host details sections. |
| 584 | views::View* details_container_; |
| 585 | |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 586 | // A view that overlays |this| (for "loading..." messages). |
| 587 | views::Label* loading_shield_; |
| 588 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 589 | // The view that completely overlays the dialog (used for the splash page). |
Ben Murdoch | 7dbb3d5 | 2013-07-17 14:55:54 +0100 | [diff] [blame] | 590 | OverlayView* overlay_view_; |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 591 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 592 | // The "Extra view" is on the same row as the dialog buttons. |
| 593 | views::View* button_strip_extra_view_; |
| 594 | |
| 595 | // This checkbox controls whether new details are saved to the Autofill |
| 596 | // database. It lives in |extra_view_|. |
| 597 | views::Checkbox* save_in_chrome_checkbox_; |
| 598 | |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 599 | // Holds the above checkbox and an associated tooltip icon. |
| 600 | views::View* save_in_chrome_checkbox_container_; |
| 601 | |
Ben Murdoch | 2385ea3 | 2013-08-06 11:01:04 +0100 | [diff] [blame] | 602 | // Used to display an image in the button strip extra view. |
| 603 | views::ImageView* button_strip_image_; |
| 604 | |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 605 | // View that aren't in the hierarchy but are owned by |this|. Currently |
| 606 | // just holds the (hidden) country comboboxes. |
| 607 | ScopedVector<views::View> other_owned_views_; |
| 608 | |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 609 | // View to host Autocheckout steps. |
| 610 | AutocheckoutStepsArea* autocheckout_steps_area_; |
| 611 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 612 | // View to host |autocheckout_progress_bar_| and its label. |
| 613 | views::View* autocheckout_progress_bar_view_; |
| 614 | |
| 615 | // Progress bar for displaying Autocheckout progress. |
| 616 | AutocheckoutProgressBar* autocheckout_progress_bar_; |
| 617 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 618 | // The view that is appended to the bottom of the dialog, below the button |
| 619 | // strip. Used to display legal document links. |
| 620 | views::View* footnote_view_; |
| 621 | |
| 622 | // The legal document text and links. |
| 623 | views::StyledLabel* legal_document_view_; |
| 624 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 625 | // The focus manager for |window_|. |
| 626 | views::FocusManager* focus_manager_; |
| 627 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 628 | // The object that manages the error bubble widget. |
| 629 | scoped_ptr<ErrorBubble> error_bubble_; |
| 630 | |
| 631 | // Map from input view (textfield or combobox) to error string. |
Ben Murdoch | 558790d | 2013-07-30 15:19:42 +0100 | [diff] [blame] | 632 | std::map<views::View*, base::string16> validity_map_; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 633 | |
| 634 | ScopedObserver<views::Widget, AutofillDialogViews> observer_; |
| 635 | |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 636 | // Delegate for the sign-in dialog's webview. |
| 637 | scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; |
| 638 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 639 | DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
| 640 | }; |
| 641 | |
| 642 | } // namespace autofill |
| 643 | |
| 644 | #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |