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" |
11 #include "ui/gfx/path.h" | 11 #include "ui/gfx/path.h" |
12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
14 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
15 | 15 |
16 // TouchOmniboxResultView ------------------------------------------------ | 16 // TouchOmniboxResultView ------------------------------------------------ |
17 | 17 |
18 TouchOmniboxResultView::TouchOmniboxResultView(OmniboxResultViewModel* model, | 18 TouchOmniboxResultView::TouchOmniboxResultView(OmniboxResultViewModel* model, |
19 int model_index, | 19 int model_index, |
| 20 views::View* location_bar, |
20 const gfx::Font& font) | 21 const gfx::Font& font) |
21 : OmniboxResultView(model, model_index, font) { | 22 : OmniboxResultView(model, model_index, location_bar, font) { |
22 set_edge_item_padding(8); | 23 set_edge_item_padding(8); |
23 set_item_padding(8); | 24 set_item_padding(8); |
24 set_minimum_text_vertical_padding(10); | 25 set_minimum_text_vertical_padding(10); |
25 } | 26 } |
26 | 27 |
27 TouchOmniboxResultView::~TouchOmniboxResultView() { | 28 TouchOmniboxResultView::~TouchOmniboxResultView() { |
28 } | 29 } |
29 | 30 |
30 void TouchOmniboxResultView::PaintMatch(gfx::Canvas* canvas, | 31 void TouchOmniboxResultView::PaintMatch(gfx::Canvas* canvas, |
31 const AutocompleteMatch& match, | 32 const AutocompleteMatch& match, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 int line_y = child->y() + child->height() - 1; | 93 int line_y = child->y() + child->height() - 1; |
93 canvas->DrawLine(gfx::Point(bounds.x(), line_y), | 94 canvas->DrawLine(gfx::Point(bounds.x(), line_y), |
94 gfx::Point(bounds.right(), line_y), divider_color); | 95 gfx::Point(bounds.right(), line_y), divider_color); |
95 } | 96 } |
96 } | 97 } |
97 | 98 |
98 OmniboxResultView* TouchOmniboxPopupContentsView::CreateResultView( | 99 OmniboxResultView* TouchOmniboxPopupContentsView::CreateResultView( |
99 OmniboxResultViewModel* model, | 100 OmniboxResultViewModel* model, |
100 int model_index, | 101 int model_index, |
101 const gfx::Font& font) { | 102 const gfx::Font& font) { |
102 return new TouchOmniboxResultView(model, model_index, font); | 103 return new TouchOmniboxResultView(model, model_index, location_bar(), font); |
103 } | 104 } |
104 | 105 |
105 std::vector<views::View*> TouchOmniboxPopupContentsView::GetVisibleChildren() { | 106 std::vector<views::View*> TouchOmniboxPopupContentsView::GetVisibleChildren() { |
106 std::vector<View*> visible_children; | 107 std::vector<View*> visible_children; |
107 for (int i = 0; i < child_count(); ++i) { | 108 for (int i = 0; i < child_count(); ++i) { |
108 View* v = child_at(i); | 109 View* v = child_at(i); |
109 if (child_at(i)->visible()) | 110 if (child_at(i)->visible()) |
110 visible_children.push_back(v); | 111 visible_children.push_back(v); |
111 } | 112 } |
112 return visible_children; | 113 return visible_children; |
113 } | 114 } |
OLD | NEW |