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 "components/omnibox/browser/omnibox_popup_model.h" | 5 #include "components/omnibox/browser/omnibox_popup_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // If we're going to trim the window size to no longer include the hovered | 277 // If we're going to trim the window size to no longer include the hovered |
278 // line, turn hover off. Practically, this shouldn't happen, but it | 278 // line, turn hover off. Practically, this shouldn't happen, but it |
279 // doesn't hurt to be defensive. | 279 // doesn't hurt to be defensive. |
280 if ((hovered_line_ != kNoMatch) && (result.size() <= hovered_line_)) | 280 if ((hovered_line_ != kNoMatch) && (result.size() <= hovered_line_)) |
281 SetHoveredLine(kNoMatch); | 281 SetHoveredLine(kNoMatch); |
282 | 282 |
283 bool popup_was_open = view_->IsOpen(); | 283 bool popup_was_open = view_->IsOpen(); |
284 view_->UpdatePopupAppearance(); | 284 view_->UpdatePopupAppearance(); |
285 // If popup has just been shown or hidden, notify observers. | 285 // If popup has just been shown or hidden, notify observers. |
286 if (view_->IsOpen() != popup_was_open) { | 286 if (view_->IsOpen() != popup_was_open) { |
287 FOR_EACH_OBSERVER(OmniboxPopupModelObserver, observers_, | 287 for (OmniboxPopupModelObserver& observer : observers_) |
288 OnOmniboxPopupShownOrHidden()); | 288 observer.OnOmniboxPopupShownOrHidden(); |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 void OmniboxPopupModel::AddObserver(OmniboxPopupModelObserver* observer) { | 292 void OmniboxPopupModel::AddObserver(OmniboxPopupModelObserver* observer) { |
293 observers_.AddObserver(observer); | 293 observers_.AddObserver(observer); |
294 } | 294 } |
295 | 295 |
296 void OmniboxPopupModel::RemoveObserver(OmniboxPopupModelObserver* observer) { | 296 void OmniboxPopupModel::RemoveObserver(OmniboxPopupModelObserver* observer) { |
297 observers_.RemoveObserver(observer); | 297 observers_.RemoveObserver(observer); |
298 } | 298 } |
299 | 299 |
300 void OmniboxPopupModel::SetAnswerBitmap(const SkBitmap& bitmap) { | 300 void OmniboxPopupModel::SetAnswerBitmap(const SkBitmap& bitmap) { |
301 answer_bitmap_ = bitmap; | 301 answer_bitmap_ = bitmap; |
302 view_->UpdatePopupAppearance(); | 302 view_->UpdatePopupAppearance(); |
303 } | 303 } |
OLD | NEW |