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/touch_omnibox_popup_contents_view.h" | 5 #include "chrome/browser/ui/views/omnibox/touch_omnibox_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/font.h" | 10 #include "ui/gfx/font.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // Draw a line at the bottom of each child except the last. The | 82 // Draw a line at the bottom of each child except the last. The |
83 // color of the line is determined to blend appropriately with the | 83 // color of the line is determined to blend appropriately with the |
84 // most dominant of the two surrounding cells, in precedence order, | 84 // most dominant of the two surrounding cells, in precedence order, |
85 // i.e. selected > hovered > normal. | 85 // i.e. selected > hovered > normal. |
86 for (std::vector<View*>::const_iterator i(visible_children.begin()); | 86 for (std::vector<View*>::const_iterator i(visible_children.begin()); |
87 i + 1 != visible_children.end(); ++i) { | 87 i + 1 != visible_children.end(); ++i) { |
88 TouchOmniboxResultView* child = static_cast<TouchOmniboxResultView*>(*i); | 88 TouchOmniboxResultView* child = static_cast<TouchOmniboxResultView*>(*i); |
89 TouchOmniboxResultView* next_child = | 89 TouchOmniboxResultView* next_child = |
90 static_cast<TouchOmniboxResultView*>(*(i + 1)); | 90 static_cast<TouchOmniboxResultView*>(*(i + 1)); |
91 SkColor divider_color = OmniboxResultView::GetColor( | 91 SkColor divider_color = child->GetColor( |
92 std::max(child->GetState(), next_child->GetState()), | 92 std::max(child->GetState(), next_child->GetState()), |
93 OmniboxResultView::DIVIDER); | 93 OmniboxResultView::DIVIDER); |
94 int line_y = child->y() + child->height() - 1; | 94 int line_y = child->y() + child->height() - 1; |
95 canvas->DrawLine(gfx::Point(bounds.x(), line_y), | 95 canvas->DrawLine(gfx::Point(bounds.x(), line_y), |
96 gfx::Point(bounds.right(), line_y), divider_color); | 96 gfx::Point(bounds.right(), line_y), divider_color); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 OmniboxResultView* TouchOmniboxPopupContentsView::CreateResultView( | 100 OmniboxResultView* TouchOmniboxPopupContentsView::CreateResultView( |
101 OmniboxResultViewModel* model, | 101 OmniboxResultViewModel* model, |
102 int model_index, | 102 int model_index, |
103 const gfx::Font& font, | 103 const gfx::Font& font, |
104 const gfx::Font& bold_font) { | 104 const gfx::Font& bold_font) { |
105 return new TouchOmniboxResultView(model, model_index, font, bold_font); | 105 return new TouchOmniboxResultView(model, model_index, font, bold_font); |
106 } | 106 } |
107 | 107 |
108 std::vector<views::View*> TouchOmniboxPopupContentsView::GetVisibleChildren() { | 108 std::vector<views::View*> TouchOmniboxPopupContentsView::GetVisibleChildren() { |
109 std::vector<View*> visible_children; | 109 std::vector<View*> visible_children; |
110 for (int i = 0; i < child_count(); ++i) { | 110 for (int i = 0; i < child_count(); ++i) { |
111 View* v = child_at(i); | 111 View* v = child_at(i); |
112 if (child_at(i)->visible()) | 112 if (child_at(i)->visible()) |
113 visible_children.push_back(v); | 113 visible_children.push_back(v); |
114 } | 114 } |
115 return visible_children; | 115 return visible_children; |
116 } | 116 } |
OLD | NEW |