OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/touch_autocomplete_popup_contents
_view.h" | 5 #include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents
_view.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 canvas->DrawLineInt(color, (*i)->x(), bounds.y(), (*i)->x(), | 100 canvas->DrawLineInt(color, (*i)->x(), bounds.y(), (*i)->x(), |
101 bounds.bottom()); | 101 bounds.bottom()); |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 int TouchAutocompletePopupContentsView::CalculatePopupHeight() { | 105 int TouchAutocompletePopupContentsView::CalculatePopupHeight() { |
106 DCHECK_GE(static_cast<size_t>(child_count()), model_->result().size()); | 106 DCHECK_GE(static_cast<size_t>(child_count()), model_->result().size()); |
107 int popup_height = 0; | 107 int popup_height = 0; |
108 for (size_t i = 0; i < model_->result().size(); ++i) { | 108 for (size_t i = 0; i < model_->result().size(); ++i) { |
109 popup_height = std::max(popup_height, | 109 popup_height = std::max(popup_height, |
110 GetChildViewAt(i)->GetPreferredSize().height()); | 110 child_at(i)->GetPreferredSize().height()); |
111 } | 111 } |
112 popup_height = std::max(popup_height, opt_in_view_ ? | 112 popup_height = std::max(popup_height, opt_in_view_ ? |
113 opt_in_view_->GetPreferredSize().height() : 0); | 113 opt_in_view_->GetPreferredSize().height() : 0); |
114 return popup_height; | 114 return popup_height; |
115 } | 115 } |
116 | 116 |
117 AutocompleteResultView* TouchAutocompletePopupContentsView::CreateResultView( | 117 AutocompleteResultView* TouchAutocompletePopupContentsView::CreateResultView( |
118 AutocompleteResultViewModel* model, | 118 AutocompleteResultViewModel* model, |
119 int model_index, | 119 int model_index, |
120 const gfx::Font& font, | 120 const gfx::Font& font, |
121 const gfx::Font& bold_font) { | 121 const gfx::Font& bold_font) { |
122 return new TouchAutocompleteResultView(model, model_index, font, bold_font); | 122 return new TouchAutocompleteResultView(model, model_index, font, bold_font); |
123 } | 123 } |
124 | 124 |
125 std::vector<views::View*> | 125 std::vector<views::View*> |
126 TouchAutocompletePopupContentsView::GetVisibleChildren() { | 126 TouchAutocompletePopupContentsView::GetVisibleChildren() { |
127 std::vector<View*> visible_children; | 127 std::vector<View*> visible_children; |
128 for (int i = 0; i < child_count(); ++i) { | 128 for (int i = 0; i < child_count(); ++i) { |
129 View* v = GetChildViewAt(i); | 129 View* v = child_at(i); |
130 if (GetChildViewAt(i)->IsVisible()) | 130 if (child_at(i)->IsVisible()) |
131 visible_children.push_back(v); | 131 visible_children.push_back(v); |
132 } | 132 } |
133 return visible_children; | 133 return visible_children; |
134 } | 134 } |
OLD | NEW |