OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. |
| 4 |
| 5 #include "chrome/browser/views/autocomplete/autocomplete_popup_gtk.h" |
| 6 |
| 7 #include "app/gfx/insets.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 10 #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" |
| 11 |
| 12 //////////////////////////////////////////////////////////////////////////////// |
| 13 // AutocompletePopupGtk, public: |
| 14 |
| 15 AutocompletePopupGtk::AutocompletePopupGtk( |
| 16 AutocompletePopupContentsView* contents) |
| 17 : WidgetGtk(WidgetGtk::TYPE_POPUP), |
| 18 contents_(contents) { |
| 19 set_delete_on_destroy(false); |
| 20 } |
| 21 |
| 22 AutocompletePopupGtk::~AutocompletePopupGtk() { |
| 23 } |
| 24 |
| 25 void AutocompletePopupGtk::Init(AutocompleteEditView* edit_view, |
| 26 views::View* contents) { |
| 27 MakeTransparent(); |
| 28 // Create the popup |
| 29 WidgetGtk::Init(gtk_widget_get_parent(edit_view->GetNativeView()), |
| 30 contents_->GetPopupBounds()); |
| 31 // The contents is owned by the LocationBarView. |
| 32 contents_->SetParentOwned(false); |
| 33 SetContentsView(contents_); |
| 34 } |
| 35 |
| 36 void AutocompletePopupGtk::Show() { |
| 37 // Move the popup to the place appropriate for the window's current position - |
| 38 // it may have been moved since it was last shown. |
| 39 SetBounds(contents_->GetPopupBounds()); |
| 40 if (!IsVisible()) |
| 41 WidgetGtk::Show(); |
| 42 } |
| 43 |
| 44 bool AutocompletePopupGtk::IsOpen() const { |
| 45 return IsCreated() && IsVisible(); |
| 46 } |
| 47 |
| 48 bool AutocompletePopupGtk::IsCreated() const { |
| 49 return GTK_IS_WIDGET(GetNativeView()); |
| 50 } |
OLD | NEW |