Chromium Code Reviews| 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/autocomplete/autocomplete_popup_model.h" | 5 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "unicode/ubidi.h" | 9 #include "unicode/ubidi.h" |
| 10 | 10 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 selected_line_ = result->default_match() == result->end() ? | 310 selected_line_ = result->default_match() == result->end() ? |
| 311 kNoMatch : static_cast<size_t>(result->default_match() - result->begin()); | 311 kNoMatch : static_cast<size_t>(result->default_match() - result->begin()); |
| 312 // There had better not be a nonempty result set with no default match. | 312 // There had better not be a nonempty result set with no default match. |
| 313 CHECK((selected_line_ != kNoMatch) || result->empty()); | 313 CHECK((selected_line_ != kNoMatch) || result->empty()); |
| 314 // If we're going to trim the window size to no longer include the hovered | 314 // If we're going to trim the window size to no longer include the hovered |
| 315 // line, turn hover off. Practically, this shouldn't happen, but it | 315 // line, turn hover off. Practically, this shouldn't happen, but it |
| 316 // doesn't hurt to be defensive. | 316 // doesn't hurt to be defensive. |
| 317 if ((hovered_line_ != kNoMatch) && (result->size() <= hovered_line_)) | 317 if ((hovered_line_ != kNoMatch) && (result->size() <= hovered_line_)) |
| 318 SetHoveredLine(kNoMatch); | 318 SetHoveredLine(kNoMatch); |
| 319 | 319 |
| 320 const bool was_open = view_->IsOpen(); | |
| 320 view_->UpdatePopupAppearance(); | 321 view_->UpdatePopupAppearance(); |
| 321 edit_model_->PopupBoundsChangedTo(view_->GetTargetBounds()); | 322 |
|
Peter Kasting
2011/01/24 22:10:19
Nit: Unnecessary blank line
| |
| 323 if (view_->IsOpen()) { | |
| 324 edit_model_->PopupBoundsChangedTo(view_->GetTargetBounds()); | |
| 325 } else if (was_open) { | |
| 326 edit_model_->PopupBoundsChangedTo(gfx::Rect()); | |
|
Peter Kasting
2011/01/24 22:10:19
Nit: Let's roll this call into the body of OnPopup
| |
| 327 edit_model_->OnPopupClosed(); | |
| 328 } | |
| 322 } | 329 } |
| 323 | 330 |
| 324 const SkBitmap* AutocompletePopupModel::GetSpecialIconForMatch( | 331 const SkBitmap* AutocompletePopupModel::GetSpecialIconForMatch( |
| 325 const AutocompleteMatch& match) const { | 332 const AutocompleteMatch& match) const { |
| 326 if (!match.template_url || !match.template_url->IsExtensionKeyword()) | 333 if (!match.template_url || !match.template_url->IsExtensionKeyword()) |
| 327 return NULL; | 334 return NULL; |
| 328 | 335 |
| 329 return &profile_->GetExtensionService()->GetOmniboxPopupIcon( | 336 return &profile_->GetExtensionService()->GetOmniboxPopupIcon( |
| 330 match.template_url->GetExtensionId()); | 337 match.template_url->GetExtensionId()); |
| 331 } | 338 } |
| OLD | NEW |