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