OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_GTK_H_ | |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_GTK_H_ | |
7 | |
8 #include <gtk/gtk.h> | |
9 | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "chrome/browser/autofill/autofill_external_delegate.h" | |
12 #include "ui/base/gtk/gtk_signal.h" | |
13 #include "ui/gfx/native_widget_types.h" | |
14 | |
15 class AutofillPopupViewGtk; | |
16 | |
17 namespace content { | |
18 class WebContents; | |
19 } | |
20 | |
21 class AutofillExternalDelegateGtk : public AutofillExternalDelegate { | |
22 public: | |
23 AutofillExternalDelegateGtk(TabContents* tab_contents, | |
24 AutofillManager* autofill_manager); | |
25 | |
26 virtual ~AutofillExternalDelegateGtk(); | |
27 | |
28 protected: | |
29 // AutofillExternalDelegate implementations. | |
30 virtual void HideAutofillPopupInternal() OVERRIDE; | |
31 virtual void OnQueryPlatformSpecific( | |
32 int query_id, | |
33 const webkit::forms::FormData& form, | |
34 const webkit::forms::FormField& field, | |
35 const gfx::Rect& bounds) OVERRIDE; | |
36 virtual void ApplyAutofillSuggestions( | |
37 const std::vector<string16>& autofill_values, | |
38 const std::vector<string16>& autofill_labels, | |
39 const std::vector<string16>& autofill_icons, | |
40 const std::vector<int>& autofill_unique_ids) OVERRIDE; | |
41 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | |
42 | |
43 private: | |
44 // Create a valid view to display the autofill results if one doesn't | |
45 // currently exist. | |
46 void CreateViewIfNeeded(); | |
47 | |
48 CHROMEGTK_CALLBACK_1(AutofillExternalDelegateGtk, gboolean, | |
49 HandleViewFocusOut, GdkEventFocus*); | |
50 | |
51 scoped_ptr<AutofillPopupViewGtk> view_; | |
52 | |
53 content::WebContents* web_contents_; // Weak reference. | |
54 gfx::NativeView tab_native_view_; // Weak reference. | |
55 | |
56 // The handler value for the focus out event, allows us to block and unblock | |
57 // it as needed. | |
58 gulong event_handler_id_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegateGtk); | |
61 }; | |
62 | |
63 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_GTK_H_ | |
OLD | NEW |