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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 const std::vector<string16>& autofill_icons, | 54 const std::vector<string16>& autofill_icons, |
55 const std::vector<int>& autofill_unique_ids, | 55 const std::vector<int>& autofill_unique_ids, |
56 int separator_index) { | 56 int separator_index) { |
57 view_->Show(autofill_values, | 57 view_->Show(autofill_values, |
58 autofill_labels, | 58 autofill_labels, |
59 autofill_icons, | 59 autofill_icons, |
60 autofill_unique_ids, | 60 autofill_unique_ids, |
61 separator_index); | 61 separator_index); |
62 } | 62 } |
63 | 63 |
| 64 void AutofillExternalDelegateGtk::SetBounds(const gfx::Rect& bounds) { |
| 65 CreateViewIfNeeded(); |
| 66 view_->set_element_bounds(bounds); |
| 67 } |
| 68 |
64 void AutofillExternalDelegateGtk::CreateViewIfNeeded() { | 69 void AutofillExternalDelegateGtk::CreateViewIfNeeded() { |
65 if (view_.get()) | 70 if (view_.get()) |
66 return; | 71 return; |
67 | 72 |
68 view_.reset(new AutofillPopupViewGtk(web_contents_, | 73 view_.reset(new AutofillPopupViewGtk(web_contents_, |
69 this, | 74 this, |
70 tab_native_view_)); | 75 tab_native_view_)); |
71 | 76 |
72 GtkWidget* toplevel = gtk_widget_get_toplevel(tab_native_view_); | 77 GtkWidget* toplevel = gtk_widget_get_toplevel(tab_native_view_); |
73 if (!g_signal_handler_is_connected(toplevel, event_handler_id_)) { | 78 if (!g_signal_handler_is_connected(toplevel, event_handler_id_)) { |
74 event_handler_id_ = g_signal_connect( | 79 event_handler_id_ = g_signal_connect( |
75 toplevel, | 80 toplevel, |
76 "focus-out-event", | 81 "focus-out-event", |
77 G_CALLBACK(HandleViewFocusOutThunk), | 82 G_CALLBACK(HandleViewFocusOutThunk), |
78 this); | 83 this); |
79 } | 84 } |
80 } | 85 } |
81 | 86 |
82 gboolean AutofillExternalDelegateGtk::HandleViewFocusOut(GtkWidget* sender, | 87 gboolean AutofillExternalDelegateGtk::HandleViewFocusOut(GtkWidget* sender, |
83 GdkEventFocus* event) { | 88 GdkEventFocus* event) { |
84 HideAutofillPopup(); | 89 HideAutofillPopup(); |
85 | 90 |
86 return TRUE; | 91 return TRUE; |
87 } | 92 } |
OLD | NEW |