Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Side by Side Diff: chrome/browser/ui/views/omnibox/touch_omnibox_popup_contents_view.cc

Issue 11360144: Converts some of the omnibox related classes to support multiple (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // Draw divider lines. 76 // Draw divider lines.
77 std::vector<View*> visible_children(GetVisibleChildren()); 77 std::vector<View*> visible_children(GetVisibleChildren());
78 if (visible_children.size() < 2) 78 if (visible_children.size() < 2)
79 return; 79 return;
80 gfx::Rect bounds(GetContentsBounds()); 80 gfx::Rect bounds(GetContentsBounds());
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 const ui::NativeTheme* theme = GetNativeTheme();
86 for (std::vector<View*>::const_iterator i(visible_children.begin()); 87 for (std::vector<View*>::const_iterator i(visible_children.begin());
87 i + 1 != visible_children.end(); ++i) { 88 i + 1 != visible_children.end(); ++i) {
88 TouchOmniboxResultView* child = static_cast<TouchOmniboxResultView*>(*i); 89 TouchOmniboxResultView* child = static_cast<TouchOmniboxResultView*>(*i);
89 TouchOmniboxResultView* next_child = 90 TouchOmniboxResultView* next_child =
90 static_cast<TouchOmniboxResultView*>(*(i + 1)); 91 static_cast<TouchOmniboxResultView*>(*(i + 1));
91 SkColor divider_color = OmniboxResultView::GetColor( 92 SkColor divider_color = OmniboxResultView::GetColor(
92 std::max(child->GetState(), next_child->GetState()), 93 theme, std::max(child->GetState(), next_child->GetState()),
93 OmniboxResultView::DIVIDER); 94 OmniboxResultView::DIVIDER);
94 int line_y = child->y() + child->height() - 1; 95 int line_y = child->y() + child->height() - 1;
95 canvas->DrawLine(gfx::Point(bounds.x(), line_y), 96 canvas->DrawLine(gfx::Point(bounds.x(), line_y),
96 gfx::Point(bounds.right(), line_y), divider_color); 97 gfx::Point(bounds.right(), line_y), divider_color);
97 } 98 }
98 } 99 }
99 100
100 OmniboxResultView* TouchOmniboxPopupContentsView::CreateResultView( 101 OmniboxResultView* TouchOmniboxPopupContentsView::CreateResultView(
101 OmniboxResultViewModel* model, 102 OmniboxResultViewModel* model,
102 int model_index, 103 int model_index,
103 const gfx::Font& font, 104 const gfx::Font& font,
104 const gfx::Font& bold_font) { 105 const gfx::Font& bold_font) {
105 return new TouchOmniboxResultView(model, model_index, font, bold_font); 106 return new TouchOmniboxResultView(model, model_index, font, bold_font);
106 } 107 }
107 108
108 std::vector<views::View*> TouchOmniboxPopupContentsView::GetVisibleChildren() { 109 std::vector<views::View*> TouchOmniboxPopupContentsView::GetVisibleChildren() {
109 std::vector<View*> visible_children; 110 std::vector<View*> visible_children;
110 for (int i = 0; i < child_count(); ++i) { 111 for (int i = 0; i < child_count(); ++i) {
111 View* v = child_at(i); 112 View* v = child_at(i);
112 if (child_at(i)->visible()) 113 if (child_at(i)->visible())
113 visible_children.push_back(v); 114 visible_children.push_back(v);
114 } 115 }
115 return visible_children; 116 return visible_children;
116 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698