| 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 299 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 w) 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, |
| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 | 642 |
| 630 // Delegate for the sign-in dialog's webview. | 643 // Delegate for the sign-in dialog's webview. |
| 631 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; | 644 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; |
| 632 | 645 |
| 633 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); | 646 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
| 634 }; | 647 }; |
| 635 | 648 |
| 636 } // namespace autofill | 649 } // namespace autofill |
| 637 | 650 |
| 638 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 651 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
| OLD | NEW |