Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.h

Issue 21724002: rAc: try really hard not to ellipsize addresses (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync'd Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_types.h"
13 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" 14 #include "chrome/browser/ui/autofill/autofill_dialog_view.h"
14 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" 15 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.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"
(...skipping 30 matching lines...) Expand all
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
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
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 // Returns whether there's room to display |state_.vertically_compact_text|
397 // without resorting to an ellipsis for a pixel width of |available_width|.
398 // Fills in |resulting_height| with the amount of space required to display
399 // |vertically_compact_text| or |horizontally_compact_text| as the case may
400 // be.
401 bool CanUseVerticallyCompactText(int available_width,
402 int* resulting_height);
403
404 // Sets the display text of the suggestion.
405 void SetLabelText(const base::string16& text);
406
407 // Sets the icon which should be displayed ahead of the text.
408 void SetIcon(const gfx::Image& image);
409
410 // Shows an auxiliary textfield to the right of the suggestion icon and
411 // text. This is currently only used to show a CVC field for the CC section.
412 void SetTextfield(const base::string16& placeholder_text,
413 const gfx::Image& icon);
414
415 // The state of |this|.
416 SuggestionState state_;
417
418 // This caches preferred heights for given widths. The key is a preferred
419 // width, the value is a cached result of CanUseVerticallyCompactText.
420 std::map<int, std::pair<bool, int> > calculated_heights_;
421
402 // The label that holds the suggestion description text. 422 // The label that holds the suggestion description text.
403 views::Label* label_; 423 views::Label* label_;
404 // The second (and greater) line of text that describes the suggestion. 424 // The second (and greater) line of text that describes the suggestion.
405 views::Label* label_line_2_; 425 views::Label* label_line_2_;
406 // The icon that comes just before |label_|. 426 // The icon that comes just before |label_|.
407 views::ImageView* icon_; 427 views::ImageView* icon_;
408 // A view to contain |label_| and |icon_|.
409 views::View* label_container_;
410 // The input set by ShowTextfield. 428 // The input set by ShowTextfield.
411 DecoratedTextfield* decorated_; 429 DecoratedTextfield* decorated_;
412 // An "Edit" link that flips to editable inputs rather than suggestion text. 430 // An "Edit" link that flips to editable inputs rather than suggestion text.
413 views::Link* edit_link_; 431 views::Link* edit_link_;
414 432
415 DISALLOW_COPY_AND_ASSIGN(SuggestionView); 433 DISALLOW_COPY_AND_ASSIGN(SuggestionView);
416 }; 434 };
417 435
418 // A convenience struct for holding pointers to views within each detail 436 // A convenience struct for holding pointers to views within each detail
419 // section. None of the member pointers are owned. 437 // section. None of the member pointers are owned.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 653
636 // Delegate for the sign-in dialog's webview. 654 // Delegate for the sign-in dialog's webview.
637 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; 655 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_;
638 656
639 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); 657 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews);
640 }; 658 };
641 659
642 } // namespace autofill 660 } // namespace autofill
643 661
644 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ 662 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698