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 | 9 |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
13 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 13 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
14 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | |
14 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 15 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
15 #include "chrome/browser/ui/autofill/testable_autofill_dialog_view.h" | 16 #include "chrome/browser/ui/autofill/testable_autofill_dialog_view.h" |
16 #include "ui/base/animation/animation_delegate.h" | 17 #include "ui/base/animation/animation_delegate.h" |
17 #include "ui/views/controls/button/button.h" | 18 #include "ui/views/controls/button/button.h" |
18 #include "ui/views/controls/button/menu_button_listener.h" | 19 #include "ui/views/controls/button/menu_button_listener.h" |
19 #include "ui/views/controls/combobox/combobox_listener.h" | 20 #include "ui/views/controls/combobox/combobox_listener.h" |
20 #include "ui/views/controls/link_listener.h" | 21 #include "ui/views/controls/link_listener.h" |
21 #include "ui/views/controls/progress_bar.h" | 22 #include "ui/views/controls/progress_bar.h" |
22 #include "ui/views/controls/scroll_view.h" | 23 #include "ui/views/controls/scroll_view.h" |
23 #include "ui/views/controls/styled_label_listener.h" | 24 #include "ui/views/controls/styled_label_listener.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
53 namespace ui { | 54 namespace ui { |
54 class ComboboxModel; | 55 class ComboboxModel; |
55 class KeyEvent; | 56 class KeyEvent; |
56 class MultiAnimation; | 57 class MultiAnimation; |
57 } | 58 } |
58 | 59 |
59 namespace autofill { | 60 namespace autofill { |
60 | 61 |
61 class AutofillDialogSignInDelegate; | 62 class AutofillDialogSignInDelegate; |
62 class DecoratedTextfield; | 63 class DecoratedTextfield; |
63 struct DetailInput; | |
64 | 64 |
65 // Views toolkit implementation of the Autofill dialog that handles the | 65 // Views toolkit implementation of the Autofill dialog that handles the |
66 // imperative autocomplete API call. | 66 // imperative autocomplete API call. |
67 class AutofillDialogViews : public AutofillDialogView, | 67 class AutofillDialogViews : public AutofillDialogView, |
68 public TestableAutofillDialogView, | 68 public TestableAutofillDialogView, |
69 public views::DialogDelegateView, | 69 public views::DialogDelegateView, |
70 public views::WidgetObserver, | 70 public views::WidgetObserver, |
71 public views::ButtonListener, | 71 public views::ButtonListener, |
72 public views::TextfieldController, | 72 public views::TextfieldController, |
73 public views::FocusChangeListener, | 73 public views::FocusChangeListener, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 class OverlayView : public views::View, | 243 class OverlayView : public views::View, |
244 public ui::AnimationDelegate { | 244 public ui::AnimationDelegate { |
245 public: | 245 public: |
246 // The listener is informed when |button_| is pressed. | 246 // The listener is informed when |button_| is pressed. |
247 explicit OverlayView(views::ButtonListener* listener); | 247 explicit OverlayView(views::ButtonListener* listener); |
248 virtual ~OverlayView(); | 248 virtual ~OverlayView(); |
249 | 249 |
250 // Returns a height which should be used when the contents view has width | 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 | 251 // |w|. Note that the value returned should be used as the height of the |
252 // dialog's contents. | 252 // dialog's contents. |
253 int GetHeightForContentsForWidth(int w); | 253 int GetHeightForContentsForWidth(int width); |
254 | 254 |
255 // Sets properties that should be displayed. | 255 // Sets properties that should be displayed. |
256 void SetState(const DialogOverlayState& state, | 256 void SetState(const DialogOverlayState& state, |
257 views::ButtonListener* listener); | 257 views::ButtonListener* listener); |
258 | 258 |
259 // Fades the view out after a delay. | 259 // Fades the view out after a delay. |
260 void BeginFadeOut(); | 260 void BeginFadeOut(); |
261 | 261 |
262 // ui::AnimationDelegate implementation: | 262 // ui::AnimationDelegate implementation: |
263 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 263 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 // When true, mouse events will be forwarded to |proxy_button_|. | 373 // When true, mouse events will be forwarded to |proxy_button_|. |
374 bool forward_mouse_events_; | 374 bool forward_mouse_events_; |
375 | 375 |
376 DISALLOW_COPY_AND_ASSIGN(SectionContainer); | 376 DISALLOW_COPY_AND_ASSIGN(SectionContainer); |
377 }; | 377 }; |
378 | 378 |
379 // A view that contains a suggestion (such as a known address) and a link to | 379 // A view that contains a suggestion (such as a known address) and a link to |
380 // edit the suggestion. | 380 // edit the suggestion. |
381 class SuggestionView : public views::View { | 381 class SuggestionView : public views::View { |
382 public: | 382 public: |
383 SuggestionView(const base::string16& edit_label, | 383 explicit SuggestionView(AutofillDialogViews* autofill_dialog); |
384 AutofillDialogViews* autofill_dialog); | |
385 virtual ~SuggestionView(); | 384 virtual ~SuggestionView(); |
386 | 385 |
387 // Sets the display text of the suggestion. | 386 void SetState(const SuggestionState& state); |
388 void SetSuggestionText(const base::string16& text, | |
389 gfx::Font::FontStyle style); | |
390 | 387 |
391 // Sets the icon which should be displayed ahead of the text. | 388 // views::View implementation. |
392 void SetSuggestionIcon(const gfx::Image& image); | 389 virtual gfx::Size GetPreferredSize() OVERRIDE; |
393 | 390 virtual int GetHeightForWidth(int width) OVERRIDE; |
394 // Shows an auxiliary textfield to the right of the suggestion icon and | 391 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
395 // text. This is currently only used to show a CVC field for the CC section. | |
396 void ShowTextfield(const base::string16& placeholder_text, | |
397 const gfx::Image& icon); | |
398 | 392 |
399 DecoratedTextfield* decorated_textfield() { return decorated_; } | 393 DecoratedTextfield* decorated_textfield() { return decorated_; } |
400 | 394 |
401 private: | 395 private: |
396 bool CanUseVerticallyCompactText(int available_width, | |
sky
2013/08/06 21:28:10
Please add a description.
Evan Stade
2013/08/06 23:15:34
Done.
| |
397 int* resulting_height); | |
398 | |
399 // Sets the display text of the suggestion. | |
400 void SetLabelText(const base::string16& text); | |
401 | |
402 // Sets the icon which should be displayed ahead of the text. | |
403 void SetIcon(const gfx::Image& image); | |
404 | |
405 // Shows an auxiliary textfield to the right of the suggestion icon and | |
406 // text. This is currently only used to show a CVC field for the CC section. | |
407 void SetTextfield(const base::string16& placeholder_text, | |
408 const gfx::Image& icon); | |
409 | |
410 // The state of |this|. | |
411 SuggestionState state_; | |
412 | |
413 // This caches preferred heights for given widths. The key is a preferred | |
414 // width, the value is a cached result of CanUseVerticallyCompactText. | |
415 std::map<int, std::pair<bool, int> > calculated_heights_; | |
416 | |
402 // The label that holds the suggestion description text. | 417 // The label that holds the suggestion description text. |
403 views::Label* label_; | 418 views::Label* label_; |
404 // The second (and greater) line of text that describes the suggestion. | 419 // The second (and greater) line of text that describes the suggestion. |
405 views::Label* label_line_2_; | 420 views::Label* label_line_2_; |
406 // The icon that comes just before |label_|. | 421 // The icon that comes just before |label_|. |
407 views::ImageView* icon_; | 422 views::ImageView* icon_; |
408 // A view to contain |label_| and |icon_|. | |
409 views::View* label_container_; | |
410 // The input set by ShowTextfield. | 423 // The input set by ShowTextfield. |
411 DecoratedTextfield* decorated_; | 424 DecoratedTextfield* decorated_; |
412 // An "Edit" link that flips to editable inputs rather than suggestion text. | 425 // An "Edit" link that flips to editable inputs rather than suggestion text. |
413 views::Link* edit_link_; | 426 views::Link* edit_link_; |
414 | 427 |
415 DISALLOW_COPY_AND_ASSIGN(SuggestionView); | 428 DISALLOW_COPY_AND_ASSIGN(SuggestionView); |
416 }; | 429 }; |
417 | 430 |
418 // A convenience struct for holding pointers to views within each detail | 431 // A convenience struct for holding pointers to views within each detail |
419 // section. None of the member pointers are owned. | 432 // section. None of the member pointers are owned. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
632 | 645 |
633 // Delegate for the sign-in dialog's webview. | 646 // Delegate for the sign-in dialog's webview. |
634 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; | 647 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; |
635 | 648 |
636 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); | 649 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
637 }; | 650 }; |
638 | 651 |
639 } // namespace autofill | 652 } // namespace autofill |
640 | 653 |
641 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 654 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
OLD | NEW |