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