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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_popup_model.cc

Issue 391011: Avoid inconsistent state (leading to checkfailures) due to Windows minimize/r... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/autocomplete/autocomplete_popup_model.h" 5 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/autocomplete/autocomplete_edit.h" 8 #include "chrome/browser/autocomplete/autocomplete_edit.h"
9 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" 9 #include "chrome/browser/autocomplete/autocomplete_popup_view.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // The query isn't running, so the standard result set can't possibly be out 168 // The query isn't running, so the standard result set can't possibly be out
169 // of date. 169 // of date.
170 // 170 //
171 // NOTE: In practice, it should actually be safe to use 171 // NOTE: In practice, it should actually be safe to use
172 // controller_->latest_result() here too, since the controller keeps that 172 // controller_->latest_result() here too, since the controller keeps that
173 // up-to-date. However we generally try to avoid referring to that. 173 // up-to-date. However we generally try to avoid referring to that.
174 result = &controller_->result(); 174 result = &controller_->result();
175 // If there are no results, the popup should be closed (so we should have 175 // If there are no results, the popup should be closed (so we should have
176 // failed the CHECK above), and URLsForDefaultMatch() should have been 176 // failed the CHECK above), and URLsForDefaultMatch() should have been
177 // called instead. 177 // called instead.
178 if (result->empty()) { 178 CHECK(!result->empty());
179 // We're going to checkfail, but first see whether
180 // controller_->latest_result() is actually in sync with |result|.
181 CHECK(controller_->latest_result().empty());
182 CHECK(false);
183 }
184 CHECK(selected_line_ < result->size()); 179 CHECK(selected_line_ < result->size());
185 match = result->begin() + selected_line_; 180 match = result->begin() + selected_line_;
186 } 181 }
187 if (transition) 182 if (transition)
188 *transition = match->transition; 183 *transition = match->transition;
189 if (is_history_what_you_typed_match) 184 if (is_history_what_you_typed_match)
190 *is_history_what_you_typed_match = match->is_history_what_you_typed_match; 185 *is_history_what_you_typed_match = match->is_history_what_you_typed_match;
191 if (alternate_nav_url && manually_selected_match_.empty()) 186 if (alternate_nav_url && manually_selected_match_.empty())
192 *alternate_nav_url = result->alternate_nav_url(); 187 *alternate_nav_url = result->alternate_nav_url();
193 return match->destination_url; 188 return match->destination_url;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // There had better not be a nonempty result set with no default match. 278 // There had better not be a nonempty result set with no default match.
284 CHECK((selected_line_ != kNoMatch) || result->empty()); 279 CHECK((selected_line_ != kNoMatch) || result->empty());
285 // If we're going to trim the window size to no longer include the hovered 280 // If we're going to trim the window size to no longer include the hovered
286 // line, turn hover off. Practically, this shouldn't happen, but it 281 // line, turn hover off. Practically, this shouldn't happen, but it
287 // doesn't hurt to be defensive. 282 // doesn't hurt to be defensive.
288 if ((hovered_line_ != kNoMatch) && (result->size() <= hovered_line_)) 283 if ((hovered_line_ != kNoMatch) && (result->size() <= hovered_line_))
289 SetHoveredLine(kNoMatch); 284 SetHoveredLine(kNoMatch);
290 285
291 view_->UpdatePopupAppearance(); 286 view_->UpdatePopupAppearance();
292 } 287 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698