| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_POPUP_BASE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_BASE_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_BASE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_BASE_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" |
| 10 #include "ui/views/focus/widget_focus_manager.h" | 10 #include "ui/views/focus/widget_focus_manager.h" |
| 11 #include "ui/views/widget/widget_delegate.h" | 11 #include "ui/views/widget/widget_delegate.h" |
| 12 #include "ui/views/widget/widget_observer.h" | 12 #include "ui/views/widget/widget_observer.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class WebContents; | 15 class WebContents; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 class Point; | 19 class Point; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace autofill { | 22 namespace autofill { |
| 23 | 23 |
| 24 // Class that deals with the event handling for Autofill-style popups. This | 24 // Class that deals with the event handling for Autofill-style popups. This |
| 25 // class should only be instantiated by sub-classes. | 25 // class should only be instantiated by sub-classes. |
| 26 class AutofillPopupBaseView : public views::WidgetDelegateView, | 26 class AutofillPopupBaseView : public views::WidgetDelegateView, |
| 27 public views::WidgetFocusChangeListener, | 27 public views::WidgetFocusChangeListener, |
| 28 public views::WidgetObserver { | 28 public views::WidgetObserver { |
| 29 public: |
| 30 static const SkColor kBorderColor; |
| 31 static const SkColor kHoveredBackgroundColor; |
| 32 static const SkColor kItemTextColor; |
| 33 static const SkColor kPopupBackground; |
| 34 static const SkColor kValueTextColor; |
| 35 static const SkColor kWarningTextColor; |
| 36 |
| 29 protected: | 37 protected: |
| 30 explicit AutofillPopupBaseView(AutofillPopupViewDelegate* delegate, | 38 explicit AutofillPopupBaseView(AutofillPopupViewDelegate* delegate, |
| 31 views::Widget* observing_widget); | 39 views::Widget* observing_widget); |
| 32 virtual ~AutofillPopupBaseView(); | 40 virtual ~AutofillPopupBaseView(); |
| 33 | 41 |
| 34 // Show this popup. Idempotent. | 42 // Show this popup. Idempotent. |
| 35 void DoShow(); | 43 void DoShow(); |
| 36 | 44 |
| 37 // Hide the widget and delete |this|. | 45 // Hide the widget and delete |this|. |
| 38 void DoHide(); | 46 void DoHide(); |
| 39 | 47 |
| 40 // Update size of popup and paint. | 48 // Update size of popup and paint. |
| 41 void DoUpdateBoundsAndRedrawPopup(); | 49 void DoUpdateBoundsAndRedrawPopup(); |
| 42 | 50 |
| 43 static const SkColor kBorderColor; | |
| 44 static const SkColor kHoveredBackgroundColor; | |
| 45 static const SkColor kItemTextColor; | |
| 46 static const SkColor kPopupBackground; | |
| 47 static const SkColor kValueTextColor; | |
| 48 static const SkColor kWarningTextColor; | |
| 49 | |
| 50 private: | 51 private: |
| 51 friend class AutofillPopupBaseViewTest; | 52 friend class AutofillPopupBaseViewTest; |
| 52 | 53 |
| 53 // views::Views implementation. | 54 // views::Views implementation. |
| 54 virtual void OnMouseCaptureLost() OVERRIDE; | 55 virtual void OnMouseCaptureLost() OVERRIDE; |
| 55 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 56 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
| 56 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 57 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 57 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; | 58 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; |
| 58 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 59 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 59 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 60 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 views::Widget* observing_widget_; | 90 views::Widget* observing_widget_; |
| 90 | 91 |
| 91 base::WeakPtrFactory<AutofillPopupBaseView> weak_ptr_factory_; | 92 base::WeakPtrFactory<AutofillPopupBaseView> weak_ptr_factory_; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(AutofillPopupBaseView); | 94 DISALLOW_COPY_AND_ASSIGN(AutofillPopupBaseView); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace autofill | 97 } // namespace autofill |
| 97 | 98 |
| 98 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_BASE_VIEW_H_ | 99 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_BASE_VIEW_H_ |
| OLD | NEW |