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

Unified Diff: ui/app_list/views/search_result_view.cc

Issue 458983004: Move app list search result icon sizes to app_list_constants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/search_result.cc ('k') | ui/app_list/views/tile_item_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/search_result_view.cc
diff --git a/ui/app_list/views/search_result_view.cc b/ui/app_list/views/search_result_view.cc
index 74e3d7ab262bafdcef071685e5e73c25fbb9a1da..38978f5e2c5c8144984285ec949aa2ac69c26dc9 100644
--- a/ui/app_list/views/search_result_view.cc
+++ b/ui/app_list/views/search_result_view.cc
@@ -25,15 +25,17 @@ namespace {
const int kPreferredWidth = 300;
const int kPreferredHeight = 52;
-const int kIconDimension = 32;
const int kIconPadding = 14;
-const int kIconViewWidth = kIconDimension + 2 * kIconPadding;
const int kTextTrailPadding = kIconPadding;
const int kBorderSize = 1;
// Extra margin at the right of the rightmost action icon.
const int kActionButtonRightMargin = 8;
+int GetIconViewWidth() {
+ return kListIconSize + 2 * kIconPadding;
+}
+
// Creates a RenderText of given |text| and |styles|. Caller takes ownership
// of returned RenderText.
gfx::RenderText* CreateRenderText(const base::string16& text,
@@ -143,8 +145,8 @@ void SearchResultView::Layout() {
return;
gfx::Rect icon_bounds(rect);
- icon_bounds.set_width(kIconViewWidth);
- icon_bounds.Inset(kIconPadding, (rect.height() - kIconDimension) / 2);
+ icon_bounds.set_width(GetIconViewWidth());
+ icon_bounds.Inset(kIconPadding, (rect.height() - kListIconSize) / 2);
icon_bounds.Intersect(rect);
icon_->SetBoundsRect(icon_bounds);
@@ -221,16 +223,16 @@ void SearchResultView::OnPaint(gfx::Canvas* canvas) {
canvas->FillRect(border_bottom, kResultBorderColor);
gfx::Rect text_bounds(rect);
- text_bounds.set_x(kIconViewWidth);
+ text_bounds.set_x(GetIconViewWidth());
if (actions_view_->visible()) {
text_bounds.set_width(
- rect.width() - kIconViewWidth - kTextTrailPadding -
+ rect.width() - GetIconViewWidth() - kTextTrailPadding -
actions_view_->bounds().width() -
(actions_view_->has_children() ? kActionButtonRightMargin : 0));
} else {
- text_bounds.set_width(
- rect.width() - kIconViewWidth - kTextTrailPadding -
- progress_bar_->bounds().width() - kActionButtonRightMargin);
+ text_bounds.set_width(rect.width() - GetIconViewWidth() -
+ kTextTrailPadding - progress_bar_->bounds().width() -
+ kActionButtonRightMargin);
}
text_bounds.set_x(GetMirroredXWithWidthInView(text_bounds.x(),
text_bounds.width()));
@@ -279,11 +281,11 @@ void SearchResultView::OnIconChanged() {
return;
// Scales down big icons but leave small ones unchanged.
- if (image.width() > kIconDimension || image.height() > kIconDimension) {
+ if (image.width() > kListIconSize || image.height() > kListIconSize) {
image = gfx::ImageSkiaOperations::CreateResizedImage(
image,
skia::ImageOperations::RESIZE_BEST,
- gfx::Size(kIconDimension, kIconDimension));
+ gfx::Size(kListIconSize, kListIconSize));
} else {
icon_->ResetImageSize();
}
« no previous file with comments | « ui/app_list/search_result.cc ('k') | ui/app_list/views/tile_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698