Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4228)

Unified Diff: chrome/browser/views/autocomplete/autocomplete_popup_win.cc

Issue 342112: Try to add more sanity checking to help track down a crash.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/autocomplete/autocomplete_popup_win.cc
===================================================================
--- chrome/browser/views/autocomplete/autocomplete_popup_win.cc (revision 30836)
+++ chrome/browser/views/autocomplete/autocomplete_popup_win.cc (working copy)
@@ -15,7 +15,8 @@
AutocompletePopupWin::AutocompletePopupWin(
AutocompletePopupContentsView* contents)
- : contents_(contents) {
+ : contents_(contents),
+ is_open_(false) {
set_delete_on_destroy(false);
set_window_style(WS_POPUP | WS_CLIPCHILDREN);
set_window_ex_style(WS_EX_TOOLWINDOW | WS_EX_LAYERED);
@@ -24,6 +25,19 @@
AutocompletePopupWin::~AutocompletePopupWin() {
}
+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();
+ is_open_ = true;
+}
+
+void AutocompletePopupWin::Hide() {
+ WidgetWin::Hide();
+ is_open_ = false;
+}
+
void AutocompletePopupWin::Init(AutocompleteEditView* edit_view,
views::View* contents) {
// Create the popup
@@ -41,18 +55,13 @@
HWND ime_window = ImmGetDefaultIMEWnd(edit_view->GetNativeView());
SetWindowPos(ime_window ? ime_window : HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
+ is_open_ = true;
}
-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());
- if (!IsVisible())
- WidgetWin::Show();
-}
-
bool AutocompletePopupWin::IsOpen() const {
- return IsCreated() && IsVisible();
+ const bool is_open = IsCreated() && IsVisible();
+ CHECK(is_open == is_open_);
+ return is_open;
}
bool AutocompletePopupWin::IsCreated() const {

Powered by Google App Engine
This is Rietveld 408576698