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 "base/macros.h" | 9 #include "base/macros.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 77 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
78 if (ui::MaterialDesignController::IsModeMaterial()) { | 78 if (ui::MaterialDesignController::IsModeMaterial()) { |
79 top_shadow_ = rb->GetImageSkiaNamed(IDR_OMNIBOX_DROPDOWN_SHADOW_TOP); | 79 top_shadow_ = rb->GetImageSkiaNamed(IDR_OMNIBOX_DROPDOWN_SHADOW_TOP); |
80 bottom_shadow_ = rb->GetImageSkiaNamed(IDR_OMNIBOX_DROPDOWN_SHADOW_BOTTOM); | 80 bottom_shadow_ = rb->GetImageSkiaNamed(IDR_OMNIBOX_DROPDOWN_SHADOW_BOTTOM); |
81 } else { | 81 } else { |
82 bottom_shadow_ = rb->GetImageSkiaNamed(IDR_BUBBLE_B); | 82 bottom_shadow_ = rb->GetImageSkiaNamed(IDR_BUBBLE_B); |
83 } | 83 } |
84 | 84 |
85 SetEventTargeter( | 85 SetEventTargeter( |
86 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 86 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
87 } | 87 } |
88 | 88 |
89 void OmniboxPopupContentsView::Init() { | 89 void OmniboxPopupContentsView::Init() { |
90 // This can't be done in the constructor as at that point we aren't | 90 // This can't be done in the constructor as at that point we aren't |
91 // necessarily our final class yet, and we may have subclasses | 91 // necessarily our final class yet, and we may have subclasses |
92 // overriding CreateResultView. | 92 // overriding CreateResultView. |
93 for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) { | 93 for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) { |
94 OmniboxResultView* result_view = CreateResultView(i, font_list_); | 94 OmniboxResultView* result_view = CreateResultView(i, font_list_); |
95 result_view->SetVisible(false); | 95 result_view->SetVisible(false); |
96 AddChildViewAt(result_view, static_cast<int>(i)); | 96 AddChildViewAt(result_view, static_cast<int>(i)); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 size_t index = GetIndexForPoint(event.location()); | 528 size_t index = GetIndexForPoint(event.location()); |
529 if (!HasMatchAt(index)) | 529 if (!HasMatchAt(index)) |
530 return; | 530 return; |
531 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, | 531 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, |
532 GURL(), base::string16(), index); | 532 GURL(), base::string16(), index); |
533 } | 533 } |
534 | 534 |
535 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 535 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
536 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 536 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
537 } | 537 } |
OLD | NEW |