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 #include "chrome/browser/autofill/autofill_external_delegate_gtk.h" | 5 #include "chrome/browser/autofill/autofill_external_delegate_gtk.h" |
6 | 6 |
7 #include "chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h" | 7 #include "chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h" |
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/browser/web_contents_view.h" | 10 #include "content/public/browser/web_contents_view.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void AutofillExternalDelegateGtk::SetBounds(const gfx::Rect& bounds) { | 62 void AutofillExternalDelegateGtk::SetBounds(const gfx::Rect& bounds) { |
63 CreateViewIfNeeded(); | 63 CreateViewIfNeeded(); |
64 view_->set_element_bounds(bounds); | 64 view_->set_element_bounds(bounds); |
65 } | 65 } |
66 | 66 |
67 void AutofillExternalDelegateGtk::CreateViewIfNeeded() { | 67 void AutofillExternalDelegateGtk::CreateViewIfNeeded() { |
68 if (view_.get()) | 68 if (view_.get()) |
69 return; | 69 return; |
70 | 70 |
71 view_.reset(new AutofillPopupViewGtk(web_contents_, | 71 view_.reset(new AutofillPopupViewGtk(web_contents_, |
| 72 profile(), |
72 this, | 73 this, |
73 tab_native_view_)); | 74 tab_native_view_)); |
74 | 75 |
75 GtkWidget* toplevel = gtk_widget_get_toplevel(tab_native_view_); | 76 GtkWidget* toplevel = gtk_widget_get_toplevel(tab_native_view_); |
76 if (!g_signal_handler_is_connected(toplevel, event_handler_id_)) { | 77 if (!g_signal_handler_is_connected(toplevel, event_handler_id_)) { |
77 event_handler_id_ = g_signal_connect( | 78 event_handler_id_ = g_signal_connect( |
78 toplevel, | 79 toplevel, |
79 "focus-out-event", | 80 "focus-out-event", |
80 G_CALLBACK(HandleViewFocusOutThunk), | 81 G_CALLBACK(HandleViewFocusOutThunk), |
81 this); | 82 this); |
82 } | 83 } |
83 } | 84 } |
84 | 85 |
85 gboolean AutofillExternalDelegateGtk::HandleViewFocusOut(GtkWidget* sender, | 86 gboolean AutofillExternalDelegateGtk::HandleViewFocusOut(GtkWidget* sender, |
86 GdkEventFocus* event) { | 87 GdkEventFocus* event) { |
87 HideAutofillPopup(); | 88 HideAutofillPopup(); |
88 | 89 |
89 return TRUE; | 90 return TRUE; |
90 } | 91 } |
OLD | NEW |