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