| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/browser/themes/theme_properties.h" | 10 #include "chrome/browser/themes/theme_properties.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 location_bar_view_(location_bar_view), | 62 location_bar_view_(location_bar_view), |
| 63 font_list_(font_list), | 63 font_list_(font_list), |
| 64 ignore_mouse_drag_(false), | 64 ignore_mouse_drag_(false), |
| 65 size_animation_(this), | 65 size_animation_(this), |
| 66 start_margin_(0), | 66 start_margin_(0), |
| 67 end_margin_(0) { | 67 end_margin_(0) { |
| 68 // The contents is owned by the LocationBarView. | 68 // The contents is owned by the LocationBarView. |
| 69 set_owned_by_client(); | 69 set_owned_by_client(); |
| 70 | 70 |
| 71 ui::ThemeProvider* theme = location_bar_view_->GetThemeProvider(); | 71 ui::ThemeProvider* theme = location_bar_view_->GetThemeProvider(); |
| 72 top_shadow_ = theme->GetImageSkiaNamed(IDR_OMNIBOX_DROPDOWN_SHADOW_TOP); | 72 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 73 int bottom_shadow_asset = ui::MaterialDesignController::IsModeMaterial() ? | 73 top_shadow_ = theme->GetImageSkiaNamed(IDR_OMNIBOX_DROPDOWN_SHADOW_TOP); |
| 74 IDR_OMNIBOX_DROPDOWN_SHADOW_BOTTOM : IDR_BUBBLE_B; | 74 bottom_shadow_ = |
| 75 bottom_shadow_ = theme->GetImageSkiaNamed(bottom_shadow_asset); | 75 theme->GetImageSkiaNamed(IDR_OMNIBOX_DROPDOWN_SHADOW_BOTTOM); |
| 76 } else { |
| 77 bottom_shadow_ = theme->GetImageSkiaNamed(IDR_BUBBLE_B); |
| 78 } |
| 76 | 79 |
| 77 SetEventTargeter( | 80 SetEventTargeter( |
| 78 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 81 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
| 79 } | 82 } |
| 80 | 83 |
| 81 void OmniboxPopupContentsView::Init() { | 84 void OmniboxPopupContentsView::Init() { |
| 82 // This can't be done in the constructor as at that point we aren't | 85 // This can't be done in the constructor as at that point we aren't |
| 83 // necessarily our final class yet, and we may have subclasses | 86 // necessarily our final class yet, and we may have subclasses |
| 84 // overriding CreateResultView. | 87 // overriding CreateResultView. |
| 85 for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) { | 88 for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) { |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 size_t index = GetIndexForPoint(event.location()); | 540 size_t index = GetIndexForPoint(event.location()); |
| 538 if (!HasMatchAt(index)) | 541 if (!HasMatchAt(index)) |
| 539 return; | 542 return; |
| 540 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 543 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
| 541 GURL(), base::string16(), index); | 544 GURL(), base::string16(), index); |
| 542 } | 545 } |
| 543 | 546 |
| 544 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 547 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
| 545 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 548 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
| 546 } | 549 } |
| OLD | NEW |