| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/autocomplete/autocomplete_popup_gtk.h" | 5 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_gtk.h" |
| 6 | 6 |
| 7 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 7 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 8 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 9 #include "chrome/browser/ui/gtk/gtk_util.h" | 9 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 10 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" | 10 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" |
| 11 #include "gfx/insets.h" | 11 #include "ui/gfx/insets.h" |
| 12 | 12 |
| 13 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
| 14 // AutocompletePopupGtk, public: | 14 // AutocompletePopupGtk, public: |
| 15 | 15 |
| 16 AutocompletePopupGtk::AutocompletePopupGtk( | 16 AutocompletePopupGtk::AutocompletePopupGtk( |
| 17 AutocompleteEditView* edit_view, | 17 AutocompleteEditView* edit_view, |
| 18 AutocompletePopupContentsView* contents) | 18 AutocompletePopupContentsView* contents) |
| 19 : WidgetGtk(WidgetGtk::TYPE_POPUP) { | 19 : WidgetGtk(WidgetGtk::TYPE_POPUP) { |
| 20 // Create the popup. | 20 // Create the popup. |
| 21 MakeTransparent(); | 21 MakeTransparent(); |
| 22 WidgetGtk::Init(gtk_widget_get_parent(edit_view->GetNativeView()), | 22 WidgetGtk::Init(gtk_widget_get_parent(edit_view->GetNativeView()), |
| 23 contents->GetPopupBounds()); | 23 contents->GetPopupBounds()); |
| 24 // The contents is owned by the LocationBarView. | 24 // The contents is owned by the LocationBarView. |
| 25 contents->set_parent_owned(false); | 25 contents->set_parent_owned(false); |
| 26 SetContentsView(contents); | 26 SetContentsView(contents); |
| 27 | 27 |
| 28 Show(); | 28 Show(); |
| 29 | 29 |
| 30 // Restack the popup window directly above the browser's toplevel window. | 30 // Restack the popup window directly above the browser's toplevel window. |
| 31 GtkWidget* toplevel = gtk_widget_get_toplevel(edit_view->GetNativeView()); | 31 GtkWidget* toplevel = gtk_widget_get_toplevel(edit_view->GetNativeView()); |
| 32 DCHECK(GTK_WIDGET_TOPLEVEL(toplevel)); | 32 DCHECK(GTK_WIDGET_TOPLEVEL(toplevel)); |
| 33 gtk_util::StackPopupWindow(GetNativeView(), toplevel); | 33 gtk_util::StackPopupWindow(GetNativeView(), toplevel); |
| 34 } | 34 } |
| 35 | 35 |
| 36 AutocompletePopupGtk::~AutocompletePopupGtk() { | 36 AutocompletePopupGtk::~AutocompletePopupGtk() { |
| 37 } | 37 } |
| OLD | NEW |