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_popup_non_view.h" | 7 #include "chrome/browser/ui/omnibox/omnibox_popup_non_view.h" |
8 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" | 10 #include "chrome/browser/ui/views/omnibox/omnibox_result_view.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 OmniboxEditModel* edit_model, | 86 OmniboxEditModel* edit_model, |
87 views::View* location_bar) | 87 views::View* location_bar) |
88 : model_(new OmniboxPopupModel(this, edit_model)), | 88 : model_(new OmniboxPopupModel(this, edit_model)), |
89 omnibox_view_(omnibox_view), | 89 omnibox_view_(omnibox_view), |
90 profile_(edit_model->profile()), | 90 profile_(edit_model->profile()), |
91 location_bar_(location_bar), | 91 location_bar_(location_bar), |
92 result_font_(font.DeriveFont(kEditFontAdjust)), | 92 result_font_(font.DeriveFont(kEditFontAdjust)), |
93 result_bold_font_(result_font_.DeriveFont(0, gfx::Font::BOLD)), | 93 result_bold_font_(result_font_.DeriveFont(0, gfx::Font::BOLD)), |
94 ignore_mouse_drag_(false), | 94 ignore_mouse_drag_(false), |
95 ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)) { | 95 ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)) { |
96 // The following little dance is required because set_border() requires a | 96 bubble_border_ = new views::BubbleBorder(views::BubbleBorder::NONE, |
97 // pointer to a non-const object. | 97 views::BubbleBorder::NO_SHADOW, SK_ColorWHITE); |
98 views::BubbleBorder* bubble_border = | 98 set_border(const_cast<views::BubbleBorder*>(bubble_border_)); |
99 new views::BubbleBorder(views::BubbleBorder::NONE, | |
100 views::BubbleBorder::NO_SHADOW); | |
101 bubble_border_ = bubble_border; | |
102 set_border(bubble_border); | |
103 // The contents is owned by the LocationBarView. | 99 // The contents is owned by the LocationBarView. |
104 set_owned_by_client(); | 100 set_owned_by_client(); |
105 } | 101 } |
106 | 102 |
107 void OmniboxPopupContentsView::Init() { | 103 void OmniboxPopupContentsView::Init() { |
108 // This can't be done in the constructor as at that point we aren't | 104 // This can't be done in the constructor as at that point we aren't |
109 // necessarily our final class yet, and we may have subclasses | 105 // necessarily our final class yet, and we may have subclasses |
110 // overriding CreateResultView. | 106 // overriding CreateResultView. |
111 for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) { | 107 for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) { |
112 OmniboxResultView* result_view = | 108 OmniboxResultView* result_view = |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 void OmniboxPopupContentsView::OpenSelectedLine( | 544 void OmniboxPopupContentsView::OpenSelectedLine( |
549 const ui::LocatedEvent& event, | 545 const ui::LocatedEvent& event, |
550 WindowOpenDisposition disposition) { | 546 WindowOpenDisposition disposition) { |
551 size_t index = GetIndexForPoint(event.location()); | 547 size_t index = GetIndexForPoint(event.location()); |
552 OpenIndex(index, disposition); | 548 OpenIndex(index, disposition); |
553 } | 549 } |
554 | 550 |
555 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { | 551 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { |
556 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); | 552 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); |
557 } | 553 } |
OLD | NEW |