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/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/ui/omnibox/omnibox_view.h" | 7 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
8 #include "third_party/skia/include/core/SkPaint.h" | 8 #include "third_party/skia/include/core/SkPaint.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/canvas_skia.h" | 10 #include "ui/gfx/canvas_skia.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 double child_width = | 75 double child_width = |
76 static_cast<double>(bounds.width()) / visible_children.size(); | 76 static_cast<double>(bounds.width()) / visible_children.size(); |
77 int x = bounds.x(); | 77 int x = bounds.x(); |
78 for (size_t i = 0; i < visible_children.size(); ++i) { | 78 for (size_t i = 0; i < visible_children.size(); ++i) { |
79 int next_x = bounds.x() + static_cast<int>(((i + 1) * child_width) + 0.5); | 79 int next_x = bounds.x() + static_cast<int>(((i + 1) * child_width) + 0.5); |
80 visible_children[i]->SetBounds(x, bounds.y(), next_x - x, bounds.height()); | 80 visible_children[i]->SetBounds(x, bounds.y(), next_x - x, bounds.height()); |
81 x = next_x; | 81 x = next_x; |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 void TouchAutocompletePopupContentsView::PaintResultViews( | 85 void TouchAutocompletePopupContentsView::PaintResultViews(gfx::Canvas* canvas) { |
86 gfx::CanvasSkia* canvas) { | |
87 AutocompletePopupContentsView::PaintResultViews(canvas); | 86 AutocompletePopupContentsView::PaintResultViews(canvas); |
88 | 87 |
89 // Draw divider lines. | 88 // Draw divider lines. |
90 std::vector<View*> visible_children(GetVisibleChildren()); | 89 std::vector<View*> visible_children(GetVisibleChildren()); |
91 if (visible_children.size() < 2) | 90 if (visible_children.size() < 2) |
92 return; | 91 return; |
93 SkColor color = AutocompleteResultView::GetColor( | 92 SkColor color = AutocompleteResultView::GetColor( |
94 AutocompleteResultView::NORMAL, AutocompleteResultView::DIMMED_TEXT); | 93 AutocompleteResultView::NORMAL, AutocompleteResultView::DIMMED_TEXT); |
95 gfx::Rect bounds(GetContentsBounds()); | 94 gfx::Rect bounds(GetContentsBounds()); |
96 for (std::vector<View*>::const_iterator i(visible_children.begin() + 1); | 95 for (std::vector<View*>::const_iterator i(visible_children.begin() + 1); |
(...skipping 26 matching lines...) Expand all Loading... |
123 std::vector<views::View*> | 122 std::vector<views::View*> |
124 TouchAutocompletePopupContentsView::GetVisibleChildren() { | 123 TouchAutocompletePopupContentsView::GetVisibleChildren() { |
125 std::vector<View*> visible_children; | 124 std::vector<View*> visible_children; |
126 for (int i = 0; i < child_count(); ++i) { | 125 for (int i = 0; i < child_count(); ++i) { |
127 View* v = child_at(i); | 126 View* v = child_at(i); |
128 if (child_at(i)->visible()) | 127 if (child_at(i)->visible()) |
129 visible_children.push_back(v); | 128 visible_children.push_back(v); |
130 } | 129 } |
131 return visible_children; | 130 return visible_children; |
132 } | 131 } |
OLD | NEW |