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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 class AutofillDialogViews : public AutofillDialogView, | 64 class AutofillDialogViews : public AutofillDialogView, |
65 public views::DialogDelegateView, | 65 public views::DialogDelegateView, |
66 public views::WidgetObserver, | 66 public views::WidgetObserver, |
67 public views::TextfieldController, | 67 public views::TextfieldController, |
68 public views::FocusChangeListener, | 68 public views::FocusChangeListener, |
69 public views::ComboboxListener, | 69 public views::ComboboxListener, |
70 public views::StyledLabelListener, | 70 public views::StyledLabelListener, |
71 public views::MenuButtonListener { | 71 public views::MenuButtonListener { |
72 public: | 72 public: |
73 explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate); | 73 explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate); |
74 virtual ~AutofillDialogViews(); | 74 ~AutofillDialogViews() override; |
75 | 75 |
76 // AutofillDialogView implementation: | 76 // AutofillDialogView implementation: |
77 virtual void Show() override; | 77 void Show() override; |
78 virtual void Hide() override; | 78 void Hide() override; |
79 virtual void UpdatesStarted() override; | 79 void UpdatesStarted() override; |
80 virtual void UpdatesFinished() override; | 80 void UpdatesFinished() override; |
81 virtual void UpdateAccountChooser() override; | 81 void UpdateAccountChooser() override; |
82 virtual void UpdateButtonStrip() override; | 82 void UpdateButtonStrip() override; |
83 virtual void UpdateOverlay() override; | 83 void UpdateOverlay() override; |
84 virtual void UpdateDetailArea() override; | 84 void UpdateDetailArea() override; |
85 virtual void UpdateForErrors() override; | 85 void UpdateForErrors() override; |
86 virtual void UpdateNotificationArea() override; | 86 void UpdateNotificationArea() override; |
87 virtual void UpdateSection(DialogSection section) override; | 87 void UpdateSection(DialogSection section) override; |
88 virtual void UpdateErrorBubble() override; | 88 void UpdateErrorBubble() override; |
89 virtual void FillSection(DialogSection section, | 89 void FillSection(DialogSection section, |
90 ServerFieldType originating_type) override; | 90 ServerFieldType originating_type) override; |
91 virtual void GetUserInput(DialogSection section, | 91 void GetUserInput(DialogSection section, FieldValueMap* output) override; |
92 FieldValueMap* output) override; | 92 base::string16 GetCvc() override; |
93 virtual base::string16 GetCvc() override; | 93 bool SaveDetailsLocally() override; |
94 virtual bool SaveDetailsLocally() override; | 94 const content::NavigationController* ShowSignIn(const GURL& url) override; |
95 virtual const content::NavigationController* ShowSignIn( | 95 void HideSignIn() override; |
96 const GURL& url) override; | 96 void ModelChanged() override; |
97 virtual void HideSignIn() override; | 97 void OnSignInResize(const gfx::Size& pref_size) override; |
98 virtual void ModelChanged() override; | 98 void ValidateSection(DialogSection section) override; |
99 virtual void OnSignInResize(const gfx::Size& pref_size) override; | |
100 virtual void ValidateSection(DialogSection section) override; | |
101 | 99 |
102 // views::View implementation. | 100 // views::View implementation. |
103 virtual gfx::Size GetPreferredSize() const override; | 101 gfx::Size GetPreferredSize() const override; |
104 virtual gfx::Size GetMinimumSize() const override; | 102 gfx::Size GetMinimumSize() const override; |
105 virtual void Layout() override; | 103 void Layout() override; |
106 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 104 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
107 | 105 |
108 // views::DialogDelegate implementation: | 106 // views::DialogDelegate implementation: |
109 virtual ui::ModalType GetModalType() const override; | 107 ui::ModalType GetModalType() const override; |
110 virtual base::string16 GetWindowTitle() const override; | 108 base::string16 GetWindowTitle() const override; |
111 virtual void WindowClosing() override; | 109 void WindowClosing() override; |
112 virtual void DeleteDelegate() override; | 110 void DeleteDelegate() override; |
113 virtual views::View* CreateOverlayView() override; | 111 views::View* CreateOverlayView() override; |
114 virtual int GetDialogButtons() const override; | 112 int GetDialogButtons() const override; |
115 virtual int GetDefaultDialogButton() const override; | 113 int GetDefaultDialogButton() const override; |
116 virtual base::string16 GetDialogButtonLabel(ui::DialogButton button) const | 114 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
117 override; | 115 bool ShouldDefaultButtonBeBlue() const override; |
118 virtual bool ShouldDefaultButtonBeBlue() const override; | 116 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
119 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 117 views::View* GetInitiallyFocusedView() override; |
120 virtual views::View* GetInitiallyFocusedView() override; | 118 views::View* CreateExtraView() override; |
121 virtual views::View* CreateExtraView() override; | 119 views::View* CreateTitlebarExtraView() override; |
122 virtual views::View* CreateTitlebarExtraView() override; | 120 views::View* CreateFootnoteView() override; |
123 virtual views::View* CreateFootnoteView() override; | 121 bool Cancel() override; |
124 virtual bool Cancel() override; | 122 bool Accept() override; |
125 virtual bool Accept() override; | |
126 | 123 |
127 // views::WidgetObserver implementation: | 124 // views::WidgetObserver implementation: |
128 virtual void OnWidgetClosing(views::Widget* widget) override; | 125 void OnWidgetClosing(views::Widget* widget) override; |
129 virtual void OnWidgetDestroying(views::Widget* widget) override; | 126 void OnWidgetDestroying(views::Widget* widget) override; |
130 virtual void OnWidgetBoundsChanged(views::Widget* widget, | 127 void OnWidgetBoundsChanged(views::Widget* widget, |
131 const gfx::Rect& new_bounds) override; | 128 const gfx::Rect& new_bounds) override; |
132 | 129 |
133 // views::TextfieldController implementation: | 130 // views::TextfieldController implementation: |
134 virtual void ContentsChanged(views::Textfield* sender, | 131 void ContentsChanged(views::Textfield* sender, |
135 const base::string16& new_contents) override; | 132 const base::string16& new_contents) override; |
136 virtual bool HandleKeyEvent(views::Textfield* sender, | 133 bool HandleKeyEvent(views::Textfield* sender, |
137 const ui::KeyEvent& key_event) override; | 134 const ui::KeyEvent& key_event) override; |
138 virtual bool HandleMouseEvent(views::Textfield* sender, | 135 bool HandleMouseEvent(views::Textfield* sender, |
139 const ui::MouseEvent& key_event) override; | 136 const ui::MouseEvent& key_event) override; |
140 | 137 |
141 // views::FocusChangeListener implementation. | 138 // views::FocusChangeListener implementation. |
142 virtual void OnWillChangeFocus(views::View* focused_before, | 139 void OnWillChangeFocus(views::View* focused_before, |
143 views::View* focused_now) override; | 140 views::View* focused_now) override; |
144 virtual void OnDidChangeFocus(views::View* focused_before, | 141 void OnDidChangeFocus(views::View* focused_before, |
145 views::View* focused_now) override; | 142 views::View* focused_now) override; |
146 | 143 |
147 // views::ComboboxListener implementation: | 144 // views::ComboboxListener implementation: |
148 virtual void OnPerformAction(views::Combobox* combobox) override; | 145 void OnPerformAction(views::Combobox* combobox) override; |
149 | 146 |
150 // views::StyledLabelListener implementation: | 147 // views::StyledLabelListener implementation: |
151 virtual void StyledLabelLinkClicked(const gfx::Range& range, int event_flags) | 148 void StyledLabelLinkClicked(const gfx::Range& range, |
152 override; | 149 int event_flags) override; |
153 | 150 |
154 // views::MenuButtonListener implementation. | 151 // views::MenuButtonListener implementation. |
155 virtual void OnMenuButtonClicked(views::View* source, | 152 void OnMenuButtonClicked(views::View* source, |
156 const gfx::Point& point) override; | 153 const gfx::Point& point) override; |
157 | 154 |
158 protected: | 155 protected: |
159 // Exposed for testing. | 156 // Exposed for testing. |
160 views::View* GetLoadingShieldForTesting(); | 157 views::View* GetLoadingShieldForTesting(); |
161 views::WebView* GetSignInWebViewForTesting(); | 158 views::WebView* GetSignInWebViewForTesting(); |
162 views::View* GetNotificationAreaForTesting(); | 159 views::View* GetNotificationAreaForTesting(); |
163 views::View* GetScrollableAreaForTesting(); | 160 views::View* GetScrollableAreaForTesting(); |
164 | 161 |
165 private: | 162 private: |
166 friend class AutofillDialogViewTesterViews; | 163 friend class AutofillDialogViewTesterViews; |
167 | 164 |
168 // What the entire dialog should be doing (e.g. gathering info from the user, | 165 // What the entire dialog should be doing (e.g. gathering info from the user, |
169 // asking the user to sign in, etc.). | 166 // asking the user to sign in, etc.). |
170 enum DialogMode { | 167 enum DialogMode { |
171 DETAIL_INPUT, | 168 DETAIL_INPUT, |
172 LOADING, | 169 LOADING, |
173 SIGN_IN, | 170 SIGN_IN, |
174 }; | 171 }; |
175 | 172 |
176 // A View which displays the currently selected account and lets the user | 173 // A View which displays the currently selected account and lets the user |
177 // switch accounts. | 174 // switch accounts. |
178 class AccountChooser : public views::View, | 175 class AccountChooser : public views::View, |
179 public views::LinkListener, | 176 public views::LinkListener, |
180 public views::MenuButtonListener, | 177 public views::MenuButtonListener, |
181 public base::SupportsWeakPtr<AccountChooser> { | 178 public base::SupportsWeakPtr<AccountChooser> { |
182 public: | 179 public: |
183 explicit AccountChooser(AutofillDialogViewDelegate* delegate); | 180 explicit AccountChooser(AutofillDialogViewDelegate* delegate); |
184 virtual ~AccountChooser(); | 181 ~AccountChooser() override; |
185 | 182 |
186 // Updates the view based on the state that |delegate_| reports. | 183 // Updates the view based on the state that |delegate_| reports. |
187 void Update(); | 184 void Update(); |
188 | 185 |
189 // views::LinkListener implementation. | 186 // views::LinkListener implementation. |
190 virtual void LinkClicked(views::Link* source, int event_flags) override; | 187 void LinkClicked(views::Link* source, int event_flags) override; |
191 | 188 |
192 // views::MenuButtonListener implementation. | 189 // views::MenuButtonListener implementation. |
193 virtual void OnMenuButtonClicked(views::View* source, | 190 void OnMenuButtonClicked(views::View* source, |
194 const gfx::Point& point) override; | 191 const gfx::Point& point) override; |
195 | 192 |
196 private: | 193 private: |
197 // The icon for the currently in-use account. | 194 // The icon for the currently in-use account. |
198 views::ImageView* image_; | 195 views::ImageView* image_; |
199 | 196 |
200 // The button for showing a menu to change the currently in-use account. | 197 // The button for showing a menu to change the currently in-use account. |
201 views::MenuButton* menu_button_; | 198 views::MenuButton* menu_button_; |
202 | 199 |
203 // The sign in link. | 200 // The sign in link. |
204 views::Link* link_; | 201 views::Link* link_; |
205 | 202 |
206 // The delegate |this| queries for logic and state. | 203 // The delegate |this| queries for logic and state. |
207 AutofillDialogViewDelegate* delegate_; | 204 AutofillDialogViewDelegate* delegate_; |
208 | 205 |
209 // Runs the suggestion menu (triggered by each section's |suggested_button|. | 206 // Runs the suggestion menu (triggered by each section's |suggested_button|. |
210 scoped_ptr<views::MenuRunner> menu_runner_; | 207 scoped_ptr<views::MenuRunner> menu_runner_; |
211 | 208 |
212 DISALLOW_COPY_AND_ASSIGN(AccountChooser); | 209 DISALLOW_COPY_AND_ASSIGN(AccountChooser); |
213 }; | 210 }; |
214 | 211 |
215 // A view which displays an image, optionally some messages and a button. Used | 212 // A view which displays an image, optionally some messages and a button. Used |
216 // for the Wallet interstitial. | 213 // for the Wallet interstitial. |
217 class OverlayView : public views::View { | 214 class OverlayView : public views::View { |
218 public: | 215 public: |
219 explicit OverlayView(AutofillDialogViewDelegate* delegate); | 216 explicit OverlayView(AutofillDialogViewDelegate* delegate); |
220 virtual ~OverlayView(); | 217 ~OverlayView() override; |
221 | 218 |
222 // Returns a height which should be used when the contents view has width | 219 // Returns a height which should be used when the contents view has width |
223 // |w|. Note that the value returned should be used as the height of the | 220 // |w|. Note that the value returned should be used as the height of the |
224 // dialog's contents. | 221 // dialog's contents. |
225 int GetHeightForContentsForWidth(int width); | 222 int GetHeightForContentsForWidth(int width); |
226 | 223 |
227 // Sets the state to whatever |delegate_| says it should be. | 224 // Sets the state to whatever |delegate_| says it should be. |
228 void UpdateState(); | 225 void UpdateState(); |
229 | 226 |
230 // views::View implementation: | 227 // views::View implementation: |
231 virtual gfx::Insets GetInsets() const override; | 228 gfx::Insets GetInsets() const override; |
232 virtual void Layout() override; | 229 void Layout() override; |
233 virtual const char* GetClassName() const override; | 230 const char* GetClassName() const override; |
234 virtual void OnPaint(gfx::Canvas* canvas) override; | 231 void OnPaint(gfx::Canvas* canvas) override; |
235 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 232 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
236 | 233 |
237 private: | 234 private: |
238 // Gets the border of the non-client frame view as a BubbleBorder. | 235 // Gets the border of the non-client frame view as a BubbleBorder. |
239 views::BubbleBorder* GetBubbleBorder(); | 236 views::BubbleBorder* GetBubbleBorder(); |
240 | 237 |
241 // Gets the bounds of this view without the frame view's bubble border. | 238 // Gets the bounds of this view without the frame view's bubble border. |
242 gfx::Rect ContentBoundsSansBubbleBorder(); | 239 gfx::Rect ContentBoundsSansBubbleBorder(); |
243 | 240 |
244 // The delegate that provides |state| when UpdateState is called. | 241 // The delegate that provides |state| when UpdateState is called. |
245 AutofillDialogViewDelegate* delegate_; | 242 AutofillDialogViewDelegate* delegate_; |
246 | 243 |
247 // Child View. Front and center. | 244 // Child View. Front and center. |
248 views::ImageView* image_view_; | 245 views::ImageView* image_view_; |
249 // Child View. When visible, below |image_view_|. | 246 // Child View. When visible, below |image_view_|. |
250 views::Label* message_view_; | 247 views::Label* message_view_; |
251 | 248 |
252 DISALLOW_COPY_AND_ASSIGN(OverlayView); | 249 DISALLOW_COPY_AND_ASSIGN(OverlayView); |
253 }; | 250 }; |
254 | 251 |
255 // An area for notifications. Some notifications point at the account chooser. | 252 // An area for notifications. Some notifications point at the account chooser. |
256 class NotificationArea : public views::View { | 253 class NotificationArea : public views::View { |
257 public: | 254 public: |
258 explicit NotificationArea(AutofillDialogViewDelegate* delegate); | 255 explicit NotificationArea(AutofillDialogViewDelegate* delegate); |
259 virtual ~NotificationArea(); | 256 ~NotificationArea() override; |
260 | 257 |
261 // Displays the given notifications. | 258 // Displays the given notifications. |
262 void SetNotifications(const std::vector<DialogNotification>& notifications); | 259 void SetNotifications(const std::vector<DialogNotification>& notifications); |
263 | 260 |
264 // views::View implementation. | 261 // views::View implementation. |
265 virtual gfx::Size GetPreferredSize() const override; | 262 gfx::Size GetPreferredSize() const override; |
266 virtual const char* GetClassName() const override; | 263 const char* GetClassName() const override; |
267 virtual void PaintChildren(gfx::Canvas* canvas, | 264 void PaintChildren(gfx::Canvas* canvas, |
268 const views::CullSet& cull_set) override; | 265 const views::CullSet& cull_set) override; |
269 virtual void OnPaint(gfx::Canvas* canvas) override; | 266 void OnPaint(gfx::Canvas* canvas) override; |
270 | 267 |
271 void set_arrow_centering_anchor( | 268 void set_arrow_centering_anchor( |
272 const base::WeakPtr<views::View>& arrow_centering_anchor) { | 269 const base::WeakPtr<views::View>& arrow_centering_anchor) { |
273 arrow_centering_anchor_ = arrow_centering_anchor; | 270 arrow_centering_anchor_ = arrow_centering_anchor; |
274 } | 271 } |
275 | 272 |
276 private: | 273 private: |
277 // Utility function for determining whether an arrow should be drawn | 274 // Utility function for determining whether an arrow should be drawn |
278 // pointing at |arrow_centering_anchor_|. | 275 // pointing at |arrow_centering_anchor_|. |
279 bool HasArrow(); | 276 bool HasArrow(); |
(...skipping 14 matching lines...) Expand all Loading... |
294 typedef std::map<ServerFieldType, views::Combobox*> ComboboxMap; | 291 typedef std::map<ServerFieldType, views::Combobox*> ComboboxMap; |
295 | 292 |
296 // A view that packs a label on the left and some related controls | 293 // A view that packs a label on the left and some related controls |
297 // on the right. | 294 // on the right. |
298 class SectionContainer : public views::View, | 295 class SectionContainer : public views::View, |
299 public views::ViewTargeterDelegate { | 296 public views::ViewTargeterDelegate { |
300 public: | 297 public: |
301 SectionContainer(const base::string16& label, | 298 SectionContainer(const base::string16& label, |
302 views::View* controls, | 299 views::View* controls, |
303 views::Button* proxy_button); | 300 views::Button* proxy_button); |
304 virtual ~SectionContainer(); | 301 ~SectionContainer() override; |
305 | 302 |
306 // Sets the visual appearance of the section to active (considered active | 303 // Sets the visual appearance of the section to active (considered active |
307 // when showing the menu or hovered by the mouse cursor). | 304 // when showing the menu or hovered by the mouse cursor). |
308 void SetActive(bool active); | 305 void SetActive(bool active); |
309 | 306 |
310 // Sets whether mouse events should be forwarded to |proxy_button_|. | 307 // Sets whether mouse events should be forwarded to |proxy_button_|. |
311 void SetForwardMouseEvents(bool forward); | 308 void SetForwardMouseEvents(bool forward); |
312 | 309 |
313 // views::View implementation. | 310 // views::View implementation. |
314 virtual const char* GetClassName() const override; | 311 const char* GetClassName() const override; |
315 virtual void OnMouseMoved(const ui::MouseEvent& event) override; | 312 void OnMouseMoved(const ui::MouseEvent& event) override; |
316 virtual void OnMouseEntered(const ui::MouseEvent& event) override; | 313 void OnMouseEntered(const ui::MouseEvent& event) override; |
317 virtual void OnMouseExited(const ui::MouseEvent& event) override; | 314 void OnMouseExited(const ui::MouseEvent& event) override; |
318 virtual bool OnMousePressed(const ui::MouseEvent& event) override; | 315 bool OnMousePressed(const ui::MouseEvent& event) override; |
319 virtual void OnMouseReleased(const ui::MouseEvent& event) override; | 316 void OnMouseReleased(const ui::MouseEvent& event) override; |
320 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 317 void OnGestureEvent(ui::GestureEvent* event) override; |
321 | 318 |
322 private: | 319 private: |
323 // views::ViewTargeterDelegate: | 320 // views::ViewTargeterDelegate: |
324 virtual views::View* TargetForRect(views::View* root, | 321 views::View* TargetForRect(views::View* root, |
325 const gfx::Rect& rect) override; | 322 const gfx::Rect& rect) override; |
326 | 323 |
327 // Converts |event| to one suitable for |proxy_button_|. | 324 // Converts |event| to one suitable for |proxy_button_|. |
328 static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event); | 325 static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event); |
329 | 326 |
330 // Returns true if the given event should be forwarded to |proxy_button_|. | 327 // Returns true if the given event should be forwarded to |proxy_button_|. |
331 bool ShouldForwardEvent(const ui::LocatedEvent& event); | 328 bool ShouldForwardEvent(const ui::LocatedEvent& event); |
332 | 329 |
333 // Mouse events on |this| are sent to this button. | 330 // Mouse events on |this| are sent to this button. |
334 views::Button* proxy_button_; // Weak reference. | 331 views::Button* proxy_button_; // Weak reference. |
335 | 332 |
336 // When true, all mouse events will be forwarded to |proxy_button_|. | 333 // When true, all mouse events will be forwarded to |proxy_button_|. |
337 bool forward_mouse_events_; | 334 bool forward_mouse_events_; |
338 | 335 |
339 DISALLOW_COPY_AND_ASSIGN(SectionContainer); | 336 DISALLOW_COPY_AND_ASSIGN(SectionContainer); |
340 }; | 337 }; |
341 | 338 |
342 // A button to show address or billing suggestions. | 339 // A button to show address or billing suggestions. |
343 class SuggestedButton : public views::MenuButton { | 340 class SuggestedButton : public views::MenuButton { |
344 public: | 341 public: |
345 explicit SuggestedButton(views::MenuButtonListener* listener); | 342 explicit SuggestedButton(views::MenuButtonListener* listener); |
346 virtual ~SuggestedButton(); | 343 ~SuggestedButton() override; |
347 | 344 |
348 // views::MenuButton implementation. | 345 // views::MenuButton implementation. |
349 virtual gfx::Size GetPreferredSize() const override; | 346 gfx::Size GetPreferredSize() const override; |
350 virtual const char* GetClassName() const override; | 347 const char* GetClassName() const override; |
351 virtual void PaintChildren(gfx::Canvas* canvas, | 348 void PaintChildren(gfx::Canvas* canvas, |
352 const views::CullSet& cull_set) override; | 349 const views::CullSet& cull_set) override; |
353 virtual void OnPaint(gfx::Canvas* canvas) override; | 350 void OnPaint(gfx::Canvas* canvas) override; |
354 | 351 |
355 private: | 352 private: |
356 // Returns the corred resource ID (i.e. IDR_*) for the current |state()|. | 353 // Returns the corred resource ID (i.e. IDR_*) for the current |state()|. |
357 int ResourceIDForState() const; | 354 int ResourceIDForState() const; |
358 | 355 |
359 DISALLOW_COPY_AND_ASSIGN(SuggestedButton); | 356 DISALLOW_COPY_AND_ASSIGN(SuggestedButton); |
360 }; | 357 }; |
361 | 358 |
362 // A view that runs a callback whenever its bounds change, and which can | 359 // A view that runs a callback whenever its bounds change, and which can |
363 // optionally suppress layout. | 360 // optionally suppress layout. |
364 class DetailsContainerView : public views::View { | 361 class DetailsContainerView : public views::View { |
365 public: | 362 public: |
366 explicit DetailsContainerView(const base::Closure& callback); | 363 explicit DetailsContainerView(const base::Closure& callback); |
367 virtual ~DetailsContainerView(); | 364 ~DetailsContainerView() override; |
368 | 365 |
369 void set_ignore_layouts(bool ignore_layouts) { | 366 void set_ignore_layouts(bool ignore_layouts) { |
370 ignore_layouts_ = ignore_layouts; | 367 ignore_layouts_ = ignore_layouts; |
371 } | 368 } |
372 | 369 |
373 // views::View implementation. | 370 // views::View implementation. |
374 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 371 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
375 virtual void Layout() override; | 372 void Layout() override; |
376 | 373 |
377 private: | 374 private: |
378 base::Closure bounds_changed_callback_; | 375 base::Closure bounds_changed_callback_; |
379 | 376 |
380 // The view ignores Layout() calls when this is true. | 377 // The view ignores Layout() calls when this is true. |
381 bool ignore_layouts_; | 378 bool ignore_layouts_; |
382 | 379 |
383 DISALLOW_COPY_AND_ASSIGN(DetailsContainerView); | 380 DISALLOW_COPY_AND_ASSIGN(DetailsContainerView); |
384 }; | 381 }; |
385 | 382 |
386 // A view that contains a suggestion (such as a known address). | 383 // A view that contains a suggestion (such as a known address). |
387 class SuggestionView : public views::View { | 384 class SuggestionView : public views::View { |
388 public: | 385 public: |
389 explicit SuggestionView(AutofillDialogViews* autofill_dialog); | 386 explicit SuggestionView(AutofillDialogViews* autofill_dialog); |
390 virtual ~SuggestionView(); | 387 ~SuggestionView() override; |
391 | 388 |
392 void SetState(const SuggestionState& state); | 389 void SetState(const SuggestionState& state); |
393 | 390 |
394 // views::View implementation. | 391 // views::View implementation. |
395 virtual gfx::Size GetPreferredSize() const override; | 392 gfx::Size GetPreferredSize() const override; |
396 virtual int GetHeightForWidth(int width) const override; | 393 int GetHeightForWidth(int width) const override; |
397 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 394 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
398 | 395 |
399 ExpandingTextfield* textfield() { return textfield_; } | 396 ExpandingTextfield* textfield() { return textfield_; } |
400 | 397 |
401 private: | 398 private: |
402 // Returns whether there's room to display |state_.vertically_compact_text| | 399 // Returns whether there's room to display |state_.vertically_compact_text| |
403 // without resorting to an ellipsis for a pixel width of |available_width|. | 400 // without resorting to an ellipsis for a pixel width of |available_width|. |
404 // Fills in |resulting_height| with the amount of space required to display | 401 // Fills in |resulting_height| with the amount of space required to display |
405 // |vertically_compact_text| or |horizontally_compact_text| as the case may | 402 // |vertically_compact_text| or |horizontally_compact_text| as the case may |
406 // be. | 403 // be. |
407 bool CanUseVerticallyCompactText(int available_width, | 404 bool CanUseVerticallyCompactText(int available_width, |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 | 680 |
684 // Used to tell the delegate when focus moves to hide the Autofill popup. | 681 // Used to tell the delegate when focus moves to hide the Autofill popup. |
685 scoped_ptr<ui::EventHandler> event_handler_; | 682 scoped_ptr<ui::EventHandler> event_handler_; |
686 | 683 |
687 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); | 684 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
688 }; | 685 }; |
689 | 686 |
690 } // namespace autofill | 687 } // namespace autofill |
691 | 688 |
692 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 689 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
OLD | NEW |