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_POPUP_VIEW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_VIEWS_H_ |
7 | 7 |
8 #include "chrome/browser/autofill/autofill_popup_view.h" | 8 #include "chrome/browser/autofill/autofill_popup_view.h" |
9 #include "content/public/browser/keyboard_listener.h" | 9 #include "content/public/browser/keyboard_listener.h" |
10 #include "ui/views/widget/widget_delegate.h" | 10 #include "ui/views/widget/widget_delegate.h" |
| 11 #include "ui/views/widget/widget_observer.h" |
11 | 12 |
12 class AutofillExternalDelegateViews; | 13 class AutofillExternalDelegateViews; |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class WebContents; | 16 class WebContents; |
16 } | 17 } |
17 | 18 |
18 // The View Autofill popup implementation. | 19 // The View Autofill popup implementation. |
19 class AutofillPopupViewViews : public views::WidgetDelegateView, | 20 class AutofillPopupViewViews : public views::WidgetDelegateView, |
| 21 public views::WidgetObserver, |
20 public AutofillPopupView, | 22 public AutofillPopupView, |
21 public KeyboardListener { | 23 public KeyboardListener { |
22 public: | 24 public: |
23 AutofillPopupViewViews(content::WebContents* web_contents, | 25 AutofillPopupViewViews(content::WebContents* web_contents, |
24 AutofillExternalDelegateViews* external_delegate); | 26 AutofillExternalDelegateViews* external_delegate); |
25 | 27 |
26 // AutofillPopupView implementation. | 28 // AutofillPopupView implementation. |
27 virtual void Hide() OVERRIDE; | 29 virtual void Hide() OVERRIDE; |
28 | 30 |
29 private: | 31 private: |
30 class AutofillPopupWidget; | 32 class AutofillPopupWidget; |
31 | 33 |
32 virtual ~AutofillPopupViewViews(); | 34 virtual ~AutofillPopupViewViews(); |
33 | 35 |
34 // views:Views implementation. | 36 // views:Views implementation. |
35 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 37 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
36 | 38 |
| 39 // views::WidgetObserver implementation. |
| 40 virtual void OnWidgetBoundsChanged(views::Widget* widget, |
| 41 const gfx::Rect& new_bounds) OVERRIDE; |
| 42 |
37 // KeyboardListener implementation. | 43 // KeyboardListener implementation. |
38 virtual bool HandleKeyPressEvent(ui::KeyEvent* event) OVERRIDE; | 44 virtual bool HandleKeyPressEvent(ui::KeyEvent* event) OVERRIDE; |
39 | 45 |
40 // AutofillPopupView implementation. | 46 // AutofillPopupView implementation. |
41 virtual void ShowInternal() OVERRIDE; | 47 virtual void ShowInternal() OVERRIDE; |
42 virtual void InvalidateRow(size_t row) OVERRIDE; | 48 virtual void InvalidateRow(size_t row) OVERRIDE; |
43 virtual void UpdateBoundsAndRedrawPopupInternal() OVERRIDE; | 49 virtual void UpdateBoundsAndRedrawPopupInternal() OVERRIDE; |
44 | 50 |
45 // Draw the given autofill entry in |entry_rect|. | 51 // Draw the given autofill entry in |entry_rect|. |
46 void DrawAutofillEntry(gfx::Canvas* canvas, | 52 void DrawAutofillEntry(gfx::Canvas* canvas, |
47 int index, | 53 int index, |
48 const gfx::Rect& entry_rect); | 54 const gfx::Rect& entry_rect); |
49 | 55 |
50 AutofillExternalDelegateViews* external_delegate_; // Weak reference. | 56 AutofillExternalDelegateViews* external_delegate_; // Weak reference. |
51 content::WebContents* web_contents_; // Weak reference. | 57 content::WebContents* web_contents_; // Weak reference. |
52 | 58 |
53 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewViews); | 59 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewViews); |
54 }; | 60 }; |
55 | 61 |
56 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_VIEWS_H_ | 62 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_VIEWS_H_ |
OLD | NEW |