| 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" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 class AutofillDialogSignInDelegate; | 59 class AutofillDialogSignInDelegate; |
| 60 class DecoratedTextfield; | 60 class DecoratedTextfield; |
| 61 | 61 |
| 62 // Views toolkit implementation of the Autofill dialog that handles the | 62 // Views toolkit implementation of the Autofill dialog that handles the |
| 63 // imperative autocomplete API call. | 63 // imperative autocomplete API call. |
| 64 class AutofillDialogViews : public AutofillDialogView, | 64 class AutofillDialogViews : public AutofillDialogView, |
| 65 public TestableAutofillDialogView, | 65 public TestableAutofillDialogView, |
| 66 public views::DialogDelegateView, | 66 public views::DialogDelegateView, |
| 67 public views::WidgetObserver, | 67 public views::WidgetObserver, |
| 68 public views::ButtonListener, | |
| 69 public views::TextfieldController, | 68 public views::TextfieldController, |
| 70 public views::FocusChangeListener, | 69 public views::FocusChangeListener, |
| 71 public views::ComboboxListener, | 70 public views::ComboboxListener, |
| 72 public views::StyledLabelListener, | 71 public views::StyledLabelListener, |
| 73 public views::MenuButtonListener { | 72 public views::MenuButtonListener { |
| 74 public: | 73 public: |
| 75 explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate); | 74 explicit AutofillDialogViews(AutofillDialogViewDelegate* delegate); |
| 76 virtual ~AutofillDialogViews(); | 75 virtual ~AutofillDialogViews(); |
| 77 | 76 |
| 78 // AutofillDialogView implementation: | 77 // AutofillDialogView implementation: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 virtual bool Cancel() OVERRIDE; | 135 virtual bool Cancel() OVERRIDE; |
| 137 virtual bool Accept() OVERRIDE; | 136 virtual bool Accept() OVERRIDE; |
| 138 virtual views::NonClientFrameView* CreateNonClientFrameView( | 137 virtual views::NonClientFrameView* CreateNonClientFrameView( |
| 139 views::Widget* widget) OVERRIDE; | 138 views::Widget* widget) OVERRIDE; |
| 140 | 139 |
| 141 // views::WidgetObserver implementation: | 140 // views::WidgetObserver implementation: |
| 142 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 141 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| 143 virtual void OnWidgetBoundsChanged(views::Widget* widget, | 142 virtual void OnWidgetBoundsChanged(views::Widget* widget, |
| 144 const gfx::Rect& new_bounds) OVERRIDE; | 143 const gfx::Rect& new_bounds) OVERRIDE; |
| 145 | 144 |
| 146 // views::ButtonListener implementation: | |
| 147 virtual void ButtonPressed(views::Button* sender, | |
| 148 const ui::Event& event) OVERRIDE; | |
| 149 | |
| 150 // views::TextfieldController implementation: | 145 // views::TextfieldController implementation: |
| 151 virtual void ContentsChanged(views::Textfield* sender, | 146 virtual void ContentsChanged(views::Textfield* sender, |
| 152 const base::string16& new_contents) OVERRIDE; | 147 const base::string16& new_contents) OVERRIDE; |
| 153 virtual bool HandleKeyEvent(views::Textfield* sender, | 148 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 154 const ui::KeyEvent& key_event) OVERRIDE; | 149 const ui::KeyEvent& key_event) OVERRIDE; |
| 155 virtual bool HandleMouseEvent(views::Textfield* sender, | 150 virtual bool HandleMouseEvent(views::Textfield* sender, |
| 156 const ui::MouseEvent& key_event) OVERRIDE; | 151 const ui::MouseEvent& key_event) OVERRIDE; |
| 157 | 152 |
| 158 // views::FocusChangeListener implementation. | 153 // views::FocusChangeListener implementation. |
| 159 virtual void OnWillChangeFocus(views::View* focused_before, | 154 virtual void OnWillChangeFocus(views::View* focused_before, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 scoped_ptr<views::MenuRunner> menu_runner_; | 235 scoped_ptr<views::MenuRunner> menu_runner_; |
| 241 | 236 |
| 242 DISALLOW_COPY_AND_ASSIGN(AccountChooser); | 237 DISALLOW_COPY_AND_ASSIGN(AccountChooser); |
| 243 }; | 238 }; |
| 244 | 239 |
| 245 // A view which displays an image, optionally some messages and a button. Used | 240 // A view which displays an image, optionally some messages and a button. Used |
| 246 // for the splash page as well as the Wallet interstitial. | 241 // for the splash page as well as the Wallet interstitial. |
| 247 class OverlayView : public views::View, | 242 class OverlayView : public views::View, |
| 248 public ui::AnimationDelegate { | 243 public ui::AnimationDelegate { |
| 249 public: | 244 public: |
| 250 // The listener is informed when |button_| is pressed. | 245 explicit OverlayView(AutofillDialogViewDelegate* delegate); |
| 251 explicit OverlayView(views::ButtonListener* listener); | |
| 252 virtual ~OverlayView(); | 246 virtual ~OverlayView(); |
| 253 | 247 |
| 254 // Returns a height which should be used when the contents view has width | 248 // Returns a height which should be used when the contents view has width |
| 255 // |w|. Note that the value returned should be used as the height of the | 249 // |w|. Note that the value returned should be used as the height of the |
| 256 // dialog's contents. | 250 // dialog's contents. |
| 257 int GetHeightForContentsForWidth(int width); | 251 int GetHeightForContentsForWidth(int width); |
| 258 | 252 |
| 259 // Sets properties that should be displayed. | 253 // Sets the state to whatever |delegate_| says it should be. |
| 260 void SetState(const DialogOverlayState& state, | 254 void UpdateState(); |
| 261 views::ButtonListener* listener); | 255 |
| 256 // Sets properties that should be displayed. Note that |state| may not come |
| 257 // from |delegate_|. |
| 258 void SetState(const DialogOverlayState& state); |
| 262 | 259 |
| 263 // Fades the view out after a delay. | 260 // Fades the view out after a delay. |
| 264 void BeginFadeOut(); | 261 void BeginFadeOut(); |
| 265 | 262 |
| 266 // ui::AnimationDelegate implementation: | 263 // ui::AnimationDelegate implementation: |
| 267 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 264 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 268 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 265 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 269 | 266 |
| 270 // views::View implementation: | 267 // views::View implementation: |
| 271 virtual gfx::Insets GetInsets() const OVERRIDE; | 268 virtual gfx::Insets GetInsets() const OVERRIDE; |
| 272 virtual void Layout() OVERRIDE; | 269 virtual void Layout() OVERRIDE; |
| 273 virtual const char* GetClassName() const OVERRIDE; | 270 virtual const char* GetClassName() const OVERRIDE; |
| 274 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 271 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 275 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; | 272 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; |
| 276 | 273 |
| 277 private: | 274 private: |
| 278 // Gets the border of the non-client frame view as a BubbleBorder. | 275 // Gets the border of the non-client frame view as a BubbleBorder. |
| 279 views::BubbleBorder* GetBubbleBorder(); | 276 views::BubbleBorder* GetBubbleBorder(); |
| 280 | 277 |
| 281 // Gets the bounds of this view without the frame view's bubble border. | 278 // Gets the bounds of this view without the frame view's bubble border. |
| 282 gfx::Rect ContentBoundsSansBubbleBorder(); | 279 gfx::Rect ContentBoundsSansBubbleBorder(); |
| 283 | 280 |
| 281 // The delegate that provides |state| when UpdateState is called. |
| 282 AutofillDialogViewDelegate* delegate_; |
| 283 |
| 284 // Child View. Front and center. | 284 // Child View. Front and center. |
| 285 views::ImageView* image_view_; | 285 views::ImageView* image_view_; |
| 286 // Child View. When visible, below |image_view_|. | 286 // Child View. When visible, below |image_view_|. |
| 287 views::View* message_stack_; | 287 views::View* message_stack_; |
| 288 // Child View. When visible, below |message_stack_|. | |
| 289 views::LabelButton* button_; | |
| 290 | 288 |
| 291 // This MultiAnimation is used to first fade out the contents of the | 289 // This MultiAnimation is used to first fade out the contents of the |
| 292 // overlay, then fade out the background of the overlay (revealing the | 290 // overlay, then fade out the background of the overlay (revealing the |
| 293 // dialog behind the overlay). This avoids cross-fade. | 291 // dialog behind the overlay). This avoids cross-fade. |
| 294 scoped_ptr<ui::MultiAnimation> fade_out_; | 292 scoped_ptr<ui::MultiAnimation> fade_out_; |
| 295 | 293 |
| 294 // A timer that tells |this| when it's time to refresh the overlay. |
| 295 base::Timer refresh_timer_; |
| 296 |
| 296 DISALLOW_COPY_AND_ASSIGN(OverlayView); | 297 DISALLOW_COPY_AND_ASSIGN(OverlayView); |
| 297 }; | 298 }; |
| 298 | 299 |
| 299 // An area for notifications. Some notifications point at the account chooser. | 300 // An area for notifications. Some notifications point at the account chooser. |
| 300 class NotificationArea : public views::View, | 301 class NotificationArea : public views::View, |
| 301 public views::ButtonListener { | 302 public views::ButtonListener { |
| 302 public: | 303 public: |
| 303 explicit NotificationArea(AutofillDialogViewDelegate* delegate); | 304 explicit NotificationArea(AutofillDialogViewDelegate* delegate); |
| 304 virtual ~NotificationArea(); | 305 virtual ~NotificationArea(); |
| 305 | 306 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 693 |
| 693 // Delegate for the sign-in dialog's webview. | 694 // Delegate for the sign-in dialog's webview. |
| 694 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; | 695 scoped_ptr<AutofillDialogSignInDelegate> sign_in_delegate_; |
| 695 | 696 |
| 696 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); | 697 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
| 697 }; | 698 }; |
| 698 | 699 |
| 699 } // namespace autofill | 700 } // namespace autofill |
| 700 | 701 |
| 701 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 702 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
| OLD | NEW |