Index: chrome/browser/ui/views/autofill/autofill_dialog_views.h |
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.h b/chrome/browser/ui/views/autofill/autofill_dialog_views.h |
index be13ff2e885e02bb36e808a8f54479a91082363a..25dd2fda6ab4238ca49160ea3afc11cd50d2d4f8 100644 |
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.h |
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.h |
@@ -11,6 +11,7 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/scoped_observer.h" |
#include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
+#include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
#include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
#include "chrome/browser/ui/autofill/testable_autofill_dialog_view.h" |
#include "ui/base/animation/animation_delegate.h" |
@@ -60,7 +61,6 @@ namespace autofill { |
class AutofillDialogSignInDelegate; |
class DecoratedTextfield; |
-struct DetailInput; |
// Views toolkit implementation of the Autofill dialog that handles the |
// imperative autocomplete API call. |
@@ -250,7 +250,7 @@ class AutofillDialogViews : public AutofillDialogView, |
// Returns a height which should be used when the contents view has width |
// |w|. Note that the value returned should be used as the height of the |
// dialog's contents. |
- int GetHeightForContentsForWidth(int w); |
+ int GetHeightForContentsForWidth(int width); |
// Sets properties that should be displayed. |
void SetState(const DialogOverlayState& state, |
@@ -380,33 +380,46 @@ class AutofillDialogViews : public AutofillDialogView, |
// edit the suggestion. |
class SuggestionView : public views::View { |
public: |
- SuggestionView(const base::string16& edit_label, |
- AutofillDialogViews* autofill_dialog); |
+ explicit SuggestionView(AutofillDialogViews* autofill_dialog); |
virtual ~SuggestionView(); |
+ void SetState(const SuggestionState& state); |
+ |
+ // views::View implementation. |
+ virtual gfx::Size GetPreferredSize() OVERRIDE; |
+ virtual int GetHeightForWidth(int width) OVERRIDE; |
+ virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
+ |
+ DecoratedTextfield* decorated_textfield() { return decorated_; } |
+ |
+ private: |
+ 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.
|
+ int* resulting_height); |
+ |
// Sets the display text of the suggestion. |
- void SetSuggestionText(const base::string16& text, |
- gfx::Font::FontStyle style); |
+ void SetLabelText(const base::string16& text); |
// Sets the icon which should be displayed ahead of the text. |
- void SetSuggestionIcon(const gfx::Image& image); |
+ void SetIcon(const gfx::Image& image); |
// Shows an auxiliary textfield to the right of the suggestion icon and |
// text. This is currently only used to show a CVC field for the CC section. |
- void ShowTextfield(const base::string16& placeholder_text, |
- const gfx::Image& icon); |
+ void SetTextfield(const base::string16& placeholder_text, |
+ const gfx::Image& icon); |
- DecoratedTextfield* decorated_textfield() { return decorated_; } |
+ // The state of |this|. |
+ SuggestionState state_; |
+ |
+ // This caches preferred heights for given widths. The key is a preferred |
+ // width, the value is a cached result of CanUseVerticallyCompactText. |
+ std::map<int, std::pair<bool, int> > calculated_heights_; |
- private: |
// The label that holds the suggestion description text. |
views::Label* label_; |
// The second (and greater) line of text that describes the suggestion. |
views::Label* label_line_2_; |
// The icon that comes just before |label_|. |
views::ImageView* icon_; |
- // A view to contain |label_| and |icon_|. |
- views::View* label_container_; |
// The input set by ShowTextfield. |
DecoratedTextfield* decorated_; |
// An "Edit" link that flips to editable inputs rather than suggestion text. |