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 "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_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" |
11 #include "ui/gfx/font.h" | 11 #include "ui/gfx/font_list.h" |
12 #include "ui/gfx/path.h" | 12 #include "ui/gfx/path.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
16 | 16 |
17 // TouchOmniboxResultView ------------------------------------------------ | 17 // TouchOmniboxResultView ------------------------------------------------ |
18 | 18 |
19 TouchOmniboxResultView::TouchOmniboxResultView( | 19 TouchOmniboxResultView::TouchOmniboxResultView( |
20 OmniboxResultViewModel* model, | 20 OmniboxResultViewModel* model, |
21 int model_index, | 21 int model_index, |
22 LocationBarView* location_bar_view, | 22 LocationBarView* location_bar_view, |
23 const gfx::Font& font) | 23 const gfx::FontList& font_list) |
24 : OmniboxResultView(model, model_index, location_bar_view, font) { | 24 : OmniboxResultView(model, model_index, location_bar_view, font_list) { |
25 set_edge_item_padding(8); | 25 set_edge_item_padding(8); |
26 set_item_padding(8); | 26 set_item_padding(8); |
27 set_minimum_text_vertical_padding(10); | 27 set_minimum_text_vertical_padding(10); |
28 } | 28 } |
29 | 29 |
30 TouchOmniboxResultView::~TouchOmniboxResultView() { | 30 TouchOmniboxResultView::~TouchOmniboxResultView() { |
31 } | 31 } |
32 | 32 |
33 void TouchOmniboxResultView::PaintMatch(gfx::Canvas* canvas, | 33 void TouchOmniboxResultView::PaintMatch(gfx::Canvas* canvas, |
34 const AutocompleteMatch& match, | 34 const AutocompleteMatch& match, |
(...skipping 14 matching lines...) Expand all Loading... |
49 DrawString(canvas, match.contents, match.contents_class, false, x, y); | 49 DrawString(canvas, match.contents, match.contents_class, false, x, y); |
50 } | 50 } |
51 | 51 |
52 int TouchOmniboxResultView::GetTextHeight() const { | 52 int TouchOmniboxResultView::GetTextHeight() const { |
53 return OmniboxResultView::GetTextHeight() * 2; | 53 return OmniboxResultView::GetTextHeight() * 2; |
54 } | 54 } |
55 | 55 |
56 // TouchOmniboxPopupContentsView ----------------------------------------- | 56 // TouchOmniboxPopupContentsView ----------------------------------------- |
57 | 57 |
58 TouchOmniboxPopupContentsView::TouchOmniboxPopupContentsView( | 58 TouchOmniboxPopupContentsView::TouchOmniboxPopupContentsView( |
59 const gfx::Font& font, | 59 const gfx::FontList& font_list, |
60 OmniboxView* omnibox_view, | 60 OmniboxView* omnibox_view, |
61 OmniboxEditModel* edit_model, | 61 OmniboxEditModel* edit_model, |
62 LocationBarView* location_bar_view) | 62 LocationBarView* location_bar_view) |
63 : OmniboxPopupContentsView(font, omnibox_view, edit_model, | 63 : OmniboxPopupContentsView(font_list, omnibox_view, edit_model, |
64 location_bar_view) { | 64 location_bar_view) { |
65 } | 65 } |
66 | 66 |
67 TouchOmniboxPopupContentsView::~TouchOmniboxPopupContentsView() { | 67 TouchOmniboxPopupContentsView::~TouchOmniboxPopupContentsView() { |
68 } | 68 } |
69 | 69 |
70 void TouchOmniboxPopupContentsView::UpdatePopupAppearance() { | 70 void TouchOmniboxPopupContentsView::UpdatePopupAppearance() { |
71 OmniboxPopupContentsView::UpdatePopupAppearance(); | 71 OmniboxPopupContentsView::UpdatePopupAppearance(); |
72 Layout(); | 72 Layout(); |
73 } | 73 } |
(...skipping 21 matching lines...) Expand all Loading... |
95 OmniboxResultView::DIVIDER); | 95 OmniboxResultView::DIVIDER); |
96 int line_y = child->y() + child->height() - 1; | 96 int line_y = child->y() + child->height() - 1; |
97 canvas->DrawLine(gfx::Point(bounds.x(), line_y), | 97 canvas->DrawLine(gfx::Point(bounds.x(), line_y), |
98 gfx::Point(bounds.right(), line_y), divider_color); | 98 gfx::Point(bounds.right(), line_y), divider_color); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 OmniboxResultView* TouchOmniboxPopupContentsView::CreateResultView( | 102 OmniboxResultView* TouchOmniboxPopupContentsView::CreateResultView( |
103 OmniboxResultViewModel* model, | 103 OmniboxResultViewModel* model, |
104 int model_index, | 104 int model_index, |
105 const gfx::Font& font) { | 105 const gfx::FontList& font_list) { |
106 return new TouchOmniboxResultView(model, model_index, location_bar_view(), | 106 return new TouchOmniboxResultView(model, model_index, location_bar_view(), |
107 font); | 107 font_list); |
108 } | 108 } |
109 | 109 |
110 std::vector<views::View*> TouchOmniboxPopupContentsView::GetVisibleChildren() { | 110 std::vector<views::View*> TouchOmniboxPopupContentsView::GetVisibleChildren() { |
111 std::vector<View*> visible_children; | 111 std::vector<View*> visible_children; |
112 for (int i = 0; i < child_count(); ++i) { | 112 for (int i = 0; i < child_count(); ++i) { |
113 View* v = child_at(i); | 113 View* v = child_at(i); |
114 if (child_at(i)->visible()) | 114 if (child_at(i)->visible()) |
115 visible_children.push_back(v); | 115 visible_children.push_back(v); |
116 } | 116 } |
117 return visible_children; | 117 return visible_children; |
118 } | 118 } |
OLD | NEW |