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/ui/omnibox/omnibox_view.h" | 7 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
9 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h" | 9 #include "chrome/browser/ui/views/omnibox/inline_omnibox_popup_view.h" |
10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" | 10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" |
11 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" | 11 #include "chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.h" |
12 #include "ui/base/theme_provider.h" | 12 #include "ui/base/theme_provider.h" |
13 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
| 14 #include "ui/gfx/image/image.h" |
14 #include "ui/gfx/path.h" | 15 #include "ui/gfx/path.h" |
15 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
16 | 17 |
17 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
18 #include <dwmapi.h> | 19 #include <dwmapi.h> |
19 | 20 |
20 #include "base/win/scoped_gdi_object.h" | 21 #include "base/win/scoped_gdi_object.h" |
21 #if !defined(USE_AURA) | 22 #if !defined(USE_AURA) |
22 #include "ui/views/widget/native_widget_win.h" | 23 #include "ui/views/widget/native_widget_win.h" |
23 #endif | 24 #endif |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // OmniboxPopupContentsView, OmniboxResultViewModel implementation: | 269 // OmniboxPopupContentsView, OmniboxResultViewModel implementation: |
269 | 270 |
270 bool OmniboxPopupContentsView::IsSelectedIndex(size_t index) const { | 271 bool OmniboxPopupContentsView::IsSelectedIndex(size_t index) const { |
271 return index == model_->selected_line(); | 272 return index == model_->selected_line(); |
272 } | 273 } |
273 | 274 |
274 bool OmniboxPopupContentsView::IsHoveredIndex(size_t index) const { | 275 bool OmniboxPopupContentsView::IsHoveredIndex(size_t index) const { |
275 return index == model_->hovered_line(); | 276 return index == model_->hovered_line(); |
276 } | 277 } |
277 | 278 |
278 const SkBitmap* OmniboxPopupContentsView::GetIconIfExtensionMatch( | 279 gfx::Image OmniboxPopupContentsView::GetIconIfExtensionMatch( |
279 size_t index) const { | 280 size_t index) const { |
280 if (!HasMatchAt(index)) | 281 if (!HasMatchAt(index)) |
281 return NULL; | 282 return gfx::Image(); |
282 return model_->GetIconIfExtensionMatch(GetMatchAtIndex(index)); | 283 return model_->GetIconIfExtensionMatch(GetMatchAtIndex(index)); |
283 } | 284 } |
284 | 285 |
285 //////////////////////////////////////////////////////////////////////////////// | 286 //////////////////////////////////////////////////////////////////////////////// |
286 // OmniboxPopupContentsView, AnimationDelegate implementation: | 287 // OmniboxPopupContentsView, AnimationDelegate implementation: |
287 | 288 |
288 void OmniboxPopupContentsView::AnimationProgressed( | 289 void OmniboxPopupContentsView::AnimationProgressed( |
289 const ui::Animation* animation) { | 290 const ui::Animation* animation) { |
290 // We should only be running the animation when the popup is already visible. | 291 // We should only be running the animation when the popup is already visible. |
291 DCHECK(popup_ != NULL); | 292 DCHECK(popup_ != NULL); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 if (HasMatchAt(index) && should_set_selected_line) | 549 if (HasMatchAt(index) && should_set_selected_line) |
549 model_->SetSelectedLine(index, false, false); | 550 model_->SetSelectedLine(index, false, false); |
550 } | 551 } |
551 | 552 |
552 void OmniboxPopupContentsView::OpenSelectedLine( | 553 void OmniboxPopupContentsView::OpenSelectedLine( |
553 const ui::LocatedEvent& event, | 554 const ui::LocatedEvent& event, |
554 WindowOpenDisposition disposition) { | 555 WindowOpenDisposition disposition) { |
555 size_t index = GetIndexForPoint(event.location()); | 556 size_t index = GetIndexForPoint(event.location()); |
556 OpenIndex(index, disposition); | 557 OpenIndex(index, disposition); |
557 } | 558 } |
OLD | NEW |