| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/omnibox/omnibox_popup_contents_view.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/search/search.h" | 7 #include "chrome/browser/search/search.h" |
| 8 #include "chrome/browser/ui/omnibox/omnibox_popup_non_view.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_popup_non_view.h" |
| 9 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 9 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 void OmniboxPopupContentsView::UpdatePopupAppearance() { | 164 void OmniboxPopupContentsView::UpdatePopupAppearance() { |
| 165 if (model_->result().empty()) { | 165 if (model_->result().empty()) { |
| 166 // No matches, close any existing popup. | 166 // No matches, close any existing popup. |
| 167 if (popup_ != NULL) { | 167 if (popup_ != NULL) { |
| 168 size_animation_.Stop(); | 168 size_animation_.Stop(); |
| 169 | 169 |
| 170 // NOTE: Do NOT use CloseNow() here, as we may be deep in a callstack | 170 // NOTE: Do NOT use CloseNow() here, as we may be deep in a callstack |
| 171 // triggered by the popup receiving a message (e.g. LBUTTONUP), and | 171 // triggered by the popup receiving a message (e.g. LBUTTONUP), and |
| 172 // destroying the popup would cause us to read garbage when we unwind back | 172 // destroying the popup would cause us to read garbage when we unwind back |
| 173 // to that level. | 173 // to that level. |
| 174 popup_->Close(); // This will eventually delete the popup. | 174 popup_->HideAndClose(); // This will eventually delete the popup. |
| 175 popup_.reset(); | 175 popup_.reset(); |
| 176 } | 176 } |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 | 179 |
| 180 // Update the match cached by each row, in the process of doing so make sure | 180 // Update the match cached by each row, in the process of doing so make sure |
| 181 // we have enough row views. | 181 // we have enough row views. |
| 182 size_t child_rv_count = child_count(); | 182 size_t child_rv_count = child_count(); |
| 183 const size_t result_size = model_->result().size(); | 183 const size_t result_size = model_->result().size(); |
| 184 for (size_t i = 0; i < result_size; ++i) { | 184 for (size_t i = 0; i < result_size; ++i) { |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 void OmniboxPopupContentsView::OpenSelectedLine( | 540 void OmniboxPopupContentsView::OpenSelectedLine( |
| 541 const ui::LocatedEvent& event, | 541 const ui::LocatedEvent& event, |
| 542 WindowOpenDisposition disposition) { | 542 WindowOpenDisposition disposition) { |
| 543 size_t index = GetIndexForPoint(event.location()); | 543 size_t index = GetIndexForPoint(event.location()); |
| 544 OpenIndex(index, disposition); | 544 OpenIndex(index, disposition); |
| 545 } | 545 } |
| 546 | 546 |
| 547 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 547 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 548 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 548 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 549 } | 549 } |
| OLD | NEW |