diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 19:40:26 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 19:40:26 +0000 |
commit | 878aa5b7751069c616a5fbb266d9e85d5cfa198a (patch) | |
tree | 9a19c9bf713565049bae9f9de9021a41b3d3f448 /chrome/browser/views/autocomplete | |
parent | b83f1ac177017ce8738cdf8a3ddc863d5c392c64 (diff) | |
download | chromium_src-878aa5b7751069c616a5fbb266d9e85d5cfa198a.zip chromium_src-878aa5b7751069c616a5fbb266d9e85d5cfa198a.tar.gz chromium_src-878aa5b7751069c616a5fbb266d9e85d5cfa198a.tar.bz2 |
Fix checkfailure on Linux Views build by actually opening the popup when it's initted.
Also add sanity checking like in the Windows version.
BUG=20511
TEST=none
Review URL: http://codereview.chromium.org/361020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/autocomplete')
3 files changed, 31 insertions, 16 deletions
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc index d7698ec..bffd707 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc @@ -17,13 +17,30 @@ AutocompletePopupGtk::AutocompletePopupGtk( AutocompletePopupContentsView* contents) : WidgetGtk(WidgetGtk::TYPE_POPUP), contents_(contents), - edit_view_(NULL) { + edit_view_(NULL), + is_open_(false) { set_delete_on_destroy(false); } AutocompletePopupGtk::~AutocompletePopupGtk() { } +void AutocompletePopupGtk::Show() { + // Move the popup to the place appropriate for the window's current position - + // it may have been moved since it was last shown. + SetBounds(contents_->GetPopupBounds()); + if (!IsVisible()) { + WidgetGtk::Show(); + StackWindow(); + } + is_open_ = true; +} + +void AutocompletePopupGtk::Hide() { + WidgetGtk::Hide(); + is_open_ = false; +} + void AutocompletePopupGtk::Init(AutocompleteEditView* edit_view, views::View* contents) { MakeTransparent(); @@ -35,20 +52,14 @@ void AutocompletePopupGtk::Init(AutocompleteEditView* edit_view, SetContentsView(contents_); edit_view_ = edit_view; -} -void AutocompletePopupGtk::Show() { - // Move the popup to the place appropriate for the window's current position - - // it may have been moved since it was last shown. - SetBounds(contents_->GetPopupBounds()); - if (!IsVisible()) { - WidgetGtk::Show(); - StackWindow(); - } + Show(); } bool AutocompletePopupGtk::IsOpen() const { - return IsCreated() && IsVisible(); + const bool is_open = IsCreated() && IsVisible(); + CHECK(is_open == is_open_); + return is_open; } bool AutocompletePopupGtk::IsCreated() const { diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h index 08e003e..f15bfe1 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h +++ b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h @@ -15,26 +15,29 @@ class AutocompletePopupGtk : public views::WidgetGtk { explicit AutocompletePopupGtk(AutocompletePopupContentsView* contents); virtual ~AutocompletePopupGtk(); + // Overridden from WidgetWin: + virtual void Show(); + virtual void Hide(); + // Creates the popup and shows it for the first time. |edit_view| is the edit // that created us. void Init(AutocompleteEditView* edit_view, views::View* contents); - // Shows the popup and moves it to the right position. - void Show(); - // Returns true if the popup is open. bool IsOpen() const; // Returns true if the popup has been created. bool IsCreated() const; + private: // Restack the popup window directly above the browser's toplevel window. void StackWindow(); - private: AutocompletePopupContentsView* contents_; AutocompleteEditView* edit_view_; + bool is_open_; // Used only for sanity-checking. + DISALLOW_COPY_AND_ASSIGN(AutocompletePopupGtk); }; diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_win.cc b/chrome/browser/views/autocomplete/autocomplete_popup_win.cc index 30721d7..6caf2b6 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_win.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_win.cc @@ -29,7 +29,8 @@ void AutocompletePopupWin::Show() { // Move the popup to the place appropriate for the window's current position - // it may have been moved since it was last shown. SetBounds(contents_->GetPopupBounds()); - WidgetWin::Show(); + if (!IsVisible()) + WidgetWin::Show(); is_open_ = true; } |