Commit c7862264 authored by Qiang Xu's avatar Qiang Xu Committed by Commit Bot

app_list: update icons for search result list views

changes:
(1) Define a TypeToVectorIcon used for app list, as for new launcher,
the assets are different from AutocompleteMatch::TypeToVectorIcon.
(2) update domain/search/history/bookmark/calculator icons.
(3) update icon related layouts.

screenshot 1: https://screenshot.googleplex.com/iiY03xRvK8q
screenshot 2: https://screenshot.googleplex.com/DPK5Jjv6D8Q

specs: https://screenshot.googleplex.com/8Xvhv8svjbg
Test: emulator test with/without fullscreen app list flag
Bug: 748667
Change-Id: I852eb4a1a204b22cf143dd2ccac11121fe9a8a37
Reviewed-on: https://chromium-review.googlesource.com/590503Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Qiang(Joe) Xu <warx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491103}
parent 94783785
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "components/omnibox/browser/autocomplete_match_type.h" #include "components/omnibox/browser/autocomplete_match_type.h"
#include "components/omnibox/browser/vector_icons.h" #include "components/omnibox/browser/vector_icons.h"
#include "ui/app_list/app_list_constants.h" #include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_features.h"
#include "ui/app_list/vector_icons/vector_icons.h"
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
#include "url/gurl.h" #include "url/gurl.h"
#include "url/url_canon.h" #include "url/url_canon.h"
...@@ -27,6 +29,9 @@ namespace app_list { ...@@ -27,6 +29,9 @@ namespace app_list {
namespace { namespace {
// #000 at 87% opacity.
constexpr SkColor kListIconColor = SkColorSetARGBMacro(0xDE, 0x00, 0x00, 0x00);
int ACMatchStyleToTagStyle(int styles) { int ACMatchStyleToTagStyle(int styles) {
int tag_styles = 0; int tag_styles = 0;
if (styles & ACMatchClassification::URL) if (styles & ACMatchClassification::URL)
...@@ -40,10 +45,9 @@ int ACMatchStyleToTagStyle(int styles) { ...@@ -40,10 +45,9 @@ int ACMatchStyleToTagStyle(int styles) {
} }
// Translates ACMatchClassifications into SearchResult tags. // Translates ACMatchClassifications into SearchResult tags.
void ACMatchClassificationsToTags( void ACMatchClassificationsToTags(const base::string16& text,
const base::string16& text, const ACMatchClassifications& text_classes,
const ACMatchClassifications& text_classes, SearchResult::Tags* tags) {
SearchResult::Tags* tags) {
int tag_styles = SearchResult::Tag::NONE; int tag_styles = SearchResult::Tag::NONE;
size_t tag_start = 0; size_t tag_start = 0;
...@@ -52,8 +56,8 @@ void ACMatchClassificationsToTags( ...@@ -52,8 +56,8 @@ void ACMatchClassificationsToTags(
// Closes current tag. // Closes current tag.
if (tag_styles != SearchResult::Tag::NONE) { if (tag_styles != SearchResult::Tag::NONE) {
tags->push_back(SearchResult::Tag( tags->push_back(
tag_styles, tag_start, text_class.offset)); SearchResult::Tag(tag_styles, tag_start, text_class.offset));
tag_styles = SearchResult::Tag::NONE; tag_styles = SearchResult::Tag::NONE;
} }
...@@ -65,8 +69,7 @@ void ACMatchClassificationsToTags( ...@@ -65,8 +69,7 @@ void ACMatchClassificationsToTags(
} }
if (tag_styles != SearchResult::Tag::NONE) { if (tag_styles != SearchResult::Tag::NONE) {
tags->push_back(SearchResult::Tag( tags->push_back(SearchResult::Tag(tag_styles, tag_start, text.length()));
tag_styles, tag_start, text.length()));
} }
} }
...@@ -103,6 +106,48 @@ GURL MakeGoogleSearchSpokenFeedbackUrl(const GURL& search_url) { ...@@ -103,6 +106,48 @@ GURL MakeGoogleSearchSpokenFeedbackUrl(const GURL& search_url) {
return search_url.ReplaceComponents(replacements); return search_url.ReplaceComponents(replacements);
} }
// AutocompleteMatchType::Type to vector icon, used for app list.
const gfx::VectorIcon& TypeToVectorIcon(AutocompleteMatchType::Type type) {
switch (type) {
case AutocompleteMatchType::URL_WHAT_YOU_TYPED:
case AutocompleteMatchType::HISTORY_URL:
case AutocompleteMatchType::HISTORY_TITLE:
case AutocompleteMatchType::HISTORY_BODY:
case AutocompleteMatchType::HISTORY_KEYWORD:
case AutocompleteMatchType::NAVSUGGEST:
case AutocompleteMatchType::BOOKMARK_TITLE:
case AutocompleteMatchType::NAVSUGGEST_PERSONALIZED:
case AutocompleteMatchType::CLIPBOARD:
case AutocompleteMatchType::PHYSICAL_WEB:
case AutocompleteMatchType::PHYSICAL_WEB_OVERFLOW:
return kIcDomainIcon;
case AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED:
case AutocompleteMatchType::SEARCH_SUGGEST:
case AutocompleteMatchType::SEARCH_SUGGEST_ENTITY:
case AutocompleteMatchType::SEARCH_SUGGEST_TAIL:
case AutocompleteMatchType::SEARCH_SUGGEST_PROFILE:
case AutocompleteMatchType::SEARCH_OTHER_ENGINE:
case AutocompleteMatchType::CONTACT_DEPRECATED:
case AutocompleteMatchType::VOICE_SUGGEST:
return kIcSearchIcon;
case AutocompleteMatchType::SEARCH_HISTORY:
case AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED:
return kIcHistoryIcon;
case AutocompleteMatchType::CALCULATOR:
return kIcEqualIcon;
case AutocompleteMatchType::EXTENSION_APP:
case AutocompleteMatchType::NUM_TYPES:
NOTREACHED();
break;
}
NOTREACHED();
return kIcDomainIcon;
}
} // namespace } // namespace
OmniboxResult::OmniboxResult(Profile* profile, OmniboxResult::OmniboxResult(Profile* profile,
...@@ -144,8 +189,7 @@ OmniboxResult::OmniboxResult(Profile* profile, ...@@ -144,8 +189,7 @@ OmniboxResult::OmniboxResult(Profile* profile,
} }
} }
OmniboxResult::~OmniboxResult() { OmniboxResult::~OmniboxResult() = default;
}
void OmniboxResult::Open(int event_flags) { void OmniboxResult::Open(int event_flags) {
RecordHistogram(OMNIBOX_SEARCH_RESULT); RecordHistogram(OMNIBOX_SEARCH_RESULT);
...@@ -169,10 +213,17 @@ void OmniboxResult::UpdateIcon() { ...@@ -169,10 +213,17 @@ void OmniboxResult::UpdateIcon() {
bool is_bookmarked = bool is_bookmarked =
bookmark_model && bookmark_model->IsBookmarked(match_.destination_url); bookmark_model && bookmark_model->IsBookmarked(match_.destination_url);
const gfx::VectorIcon& icon = if (features::IsFullscreenAppListEnabled()) {
is_bookmarked ? omnibox::kStarIcon const gfx::VectorIcon& icon =
: AutocompleteMatch::TypeToVectorIcon(match_.type); is_bookmarked ? kIcBookmarkIcon : TypeToVectorIcon(match_.type);
SetIcon(gfx::CreateVectorIcon(icon, 16, app_list::kIconColor)); SetIcon(
gfx::CreateVectorIcon(icon, kListIconSizeFullscreen, kListIconColor));
} else {
const gfx::VectorIcon& icon =
is_bookmarked ? omnibox::kStarIcon
: AutocompleteMatch::TypeToVectorIcon(match_.type);
SetIcon(gfx::CreateVectorIcon(icon, 16, kIconColor));
}
} }
void OmniboxResult::UpdateTitleAndDetails() { void OmniboxResult::UpdateTitleAndDetails() {
......
...@@ -102,7 +102,9 @@ const int kBadgeBackgroundRadius = 10; ...@@ -102,7 +102,9 @@ const int kBadgeBackgroundRadius = 10;
// Preferred search result icon sizes. // Preferred search result icon sizes.
const int kListIconSize = 24; const int kListIconSize = 24;
const int kListIconSizeFullscreen = 18;
const int kListBadgeIconSize = 16; const int kListBadgeIconSize = 16;
const int kListBadgeIconSizeFullscreen = 14;
const int kListBadgeIconOffsetX = 6; const int kListBadgeIconOffsetX = 6;
const int kListBadgeIconOffsetY = 6; const int kListBadgeIconOffsetY = 6;
const int kTileIconSize = 48; const int kTileIconSize = 48;
......
...@@ -79,7 +79,9 @@ APP_LIST_EXPORT extern const int kAppBadgeIconSize; ...@@ -79,7 +79,9 @@ APP_LIST_EXPORT extern const int kAppBadgeIconSize;
APP_LIST_EXPORT extern const int kBadgeBackgroundRadius; APP_LIST_EXPORT extern const int kBadgeBackgroundRadius;
APP_LIST_EXPORT extern const int kListIconSize; APP_LIST_EXPORT extern const int kListIconSize;
APP_LIST_EXPORT extern const int kListIconSizeFullscreen;
APP_LIST_EXPORT extern const int kListBadgeIconSize; APP_LIST_EXPORT extern const int kListBadgeIconSize;
APP_LIST_EXPORT extern const int kListBadgeIconSizeFullscreen;
APP_LIST_EXPORT extern const int kListBadgeIconOffsetX; APP_LIST_EXPORT extern const int kListBadgeIconOffsetX;
APP_LIST_EXPORT extern const int kListBadgeIconOffsetY; APP_LIST_EXPORT extern const int kListBadgeIconOffsetY;
APP_LIST_EXPORT extern const int kTileIconSize; APP_LIST_EXPORT extern const int kTileIconSize;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <map> #include <map>
#include "ui/app_list/app_list_constants.h" #include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_features.h"
#include "ui/app_list/search/tokenized_string.h" #include "ui/app_list/search/tokenized_string.h"
#include "ui/app_list/search/tokenized_string_match.h" #include "ui/app_list/search/tokenized_string_match.h"
#include "ui/app_list/search_result_observer.h" #include "ui/app_list/search_result_observer.h"
...@@ -97,7 +98,8 @@ int SearchResult::GetPreferredIconDimension() const { ...@@ -97,7 +98,8 @@ int SearchResult::GetPreferredIconDimension() const {
case DISPLAY_TILE: case DISPLAY_TILE:
return kTileIconSize; return kTileIconSize;
case DISPLAY_LIST: case DISPLAY_LIST:
return kListIconSize; return features::IsFullscreenAppListEnabled() ? kListIconSizeFullscreen
: kListIconSize;
case DISPLAY_NONE: case DISPLAY_NONE:
case DISPLAY_CARD: case DISPLAY_CARD:
return 0; return 0;
......
...@@ -16,14 +16,24 @@ aggregate_vector_icons("app_list_vector_icons") { ...@@ -16,14 +16,24 @@ aggregate_vector_icons("app_list_vector_icons") {
"ic_badge_play.icon", "ic_badge_play.icon",
"ic_badge_rating.1x.icon", "ic_badge_rating.1x.icon",
"ic_badge_rating.icon", "ic_badge_rating.icon",
"ic_bookmark.1x.icon",
"ic_bookmark.icon",
"ic_close.1x.icon", "ic_close.1x.icon",
"ic_close.icon", "ic_close.icon",
"ic_domain.1x.icon",
"ic_domain.icon",
"ic_equal.1x.icon",
"ic_equal.icon",
"ic_google_black.1x.icon", "ic_google_black.1x.icon",
"ic_google_black.icon", "ic_google_black.icon",
"ic_google_color.1x.icon", "ic_google_color.1x.icon",
"ic_google_color.icon", "ic_google_color.icon",
"ic_history.1x.icon",
"ic_history.icon",
"ic_mic_black.1x.icon", "ic_mic_black.1x.icon",
"ic_mic_black.icon", "ic_mic_black.icon",
"ic_search.1x.icon",
"ic_search.icon",
"ic_search_engine_not_google.1x.icon", "ic_search_engine_not_google.1x.icon",
"ic_search_engine_not_google.icon", "ic_search_engine_not_google.icon",
] ]
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 18,
MOVE_TO, 9, 13.25f,
LINE_TO, 13.33f, 16,
R_LINE_TO, -1.15f, -5.18f,
LINE_TO, 16, 7.34f,
R_LINE_TO, -5.03f, -0.45f,
LINE_TO, 9, 2,
LINE_TO, 7.03f, 6.89f,
LINE_TO, 2, 7.34f,
R_LINE_TO, 3.82f, 3.49f,
LINE_TO, 4.67f, 16,
CLOSE,
END
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 36,
MOVE_TO, 18, 26.5f,
LINE_TO, 27.27f, 32,
R_LINE_TO, -2.46f, -10.36f,
LINE_TO, 33, 14.67f,
R_LINE_TO, -10.78f, -0.9f,
LINE_TO, 18, 4,
R_LINE_TO, -4.21f, 9.77f,
LINE_TO, 3, 14.67f,
R_LINE_TO, 8.19f, 6.97f,
LINE_TO, 8.73f, 32,
CLOSE,
END
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 18,
MOVE_TO, 3, 1,
LINE_TO, 10, 1,
LINE_TO, 15, 6,
LINE_TO, 15, 17,
LINE_TO, 3, 17,
LINE_TO, 3, 1,
CLOSE,
MOVE_TO, 8, 3,
LINE_TO, 5, 3,
LINE_TO, 5, 15,
LINE_TO, 13, 15,
LINE_TO, 13, 8,
LINE_TO, 8, 8,
LINE_TO, 8, 3,
CLOSE,
MOVE_TO, 13, 6,
LINE_TO, 10, 3,
LINE_TO, 10, 6,
LINE_TO, 13, 6,
CLOSE,
END
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 36,
MOVE_TO, 7, 3,
LINE_TO, 19.8f, 3,
LINE_TO, 29, 13,
LINE_TO, 29, 33,
LINE_TO, 7, 33,
LINE_TO, 7, 3,
CLOSE,
MOVE_TO, 17, 6,
LINE_TO, 10, 6,
LINE_TO, 10, 30,
LINE_TO, 26, 30,
LINE_TO, 26, 16,
LINE_TO, 17, 16,
LINE_TO, 17, 6,
CLOSE,
MOVE_TO, 26, 13,
LINE_TO, 20, 6,
LINE_TO, 20, 13,
LINE_TO, 26, 13,
CLOSE,
END
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 18,
MOVE_TO, 4, 6,
R_H_LINE_TO, 10,
R_V_LINE_TO, 2,
H_LINE_TO, 4,
V_LINE_TO, 6,
CLOSE,
R_MOVE_TO, 0, 4,
R_H_LINE_TO, 10,
R_V_LINE_TO, 2,
H_LINE_TO, 4,
R_V_LINE_TO, -2,
CLOSE,
END
\ No newline at end of file
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 36,
MOVE_TO, 9, 13,
R_H_LINE_TO, 18,
R_V_LINE_TO, 3,
H_LINE_TO, 9,
R_V_LINE_TO, -3,
CLOSE,
R_MOVE_TO, 0, 7,
R_H_LINE_TO, 18,
R_V_LINE_TO, 3,
H_LINE_TO, 9,
R_V_LINE_TO, -3,
CLOSE,
END
\ No newline at end of file
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 18,
MOVE_TO, 8.99f, 1,
CUBIC_TO, 13.42f, 1, 17, 4.58f, 17, 9,
CUBIC_TO, 17, 13.42f, 13.42f, 17, 8.99f, 17,
CUBIC_TO, 4.58f, 17, 1, 13.42f, 1, 9,
CUBIC_TO, 1, 4.58f, 4.58f, 1, 8.99f, 1,
CLOSE,
MOVE_TO, 9, 15.4f,
CUBIC_TO, 12.54f, 15.4f, 15.4f, 12.54f, 15.4f, 9,
CUBIC_TO, 15.4f, 5.46f, 12.54f, 2.6f, 9, 2.6f,
CUBIC_TO, 5.46f, 2.6f, 2.6f, 5.46f, 2.6f, 9,
CUBIC_TO, 2.6f, 12.54f, 5.46f, 15.4f, 9, 15.4f,
CLOSE,
MOVE_TO, 9.4f, 5,
LINE_TO, 9.4f, 9.2f,
LINE_TO, 13, 11.34f,
LINE_TO, 12.4f, 12.32f,
LINE_TO, 8.2f, 9.8f,
LINE_TO, 8.2f, 5,
LINE_TO, 9.4f, 5,
CLOSE,
END
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 36,
MOVE_TO, 17.99f, 3,
CUBIC_TO, 26.28f, 3, 33, 9.72f, 33, 18,
CUBIC_TO, 33, 26.28f, 26.28f, 33, 17.99f, 33,
CUBIC_TO, 9.71f, 33, 3, 26.28f, 3, 18,
CUBIC_TO, 3, 9.72f, 9.71f, 3, 17.99f, 3,
CLOSE,
MOVE_TO, 18, 30,
CUBIC_TO, 24.63f, 30, 30, 24.63f, 30, 18,
CUBIC_TO, 30, 11.37f, 24.63f, 6, 18, 6,
CUBIC_TO, 11.37f, 6, 6, 11.37f, 6, 18,
CUBIC_TO, 6, 24.63f, 11.37f, 30, 18, 30,
CLOSE,
MOVE_TO, 18.75f, 10.5f,
LINE_TO, 18.75f, 18.38f,
LINE_TO, 25.5f, 22.38f,
LINE_TO, 24.38f, 24.23f,
LINE_TO, 16.5f, 19.5f,
LINE_TO, 16.5f, 10.5f,
LINE_TO, 18.75f, 10.5f,
CLOSE,
END
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 18,
MOVE_TO, 11.71f, 11.06f,
LINE_TO, 11.46f, 10.82f,
CUBIC_TO, 12.35f, 9.77f, 12.89f, 8.42f, 12.89f, 6.95f,
CUBIC_TO, 12.89f, 3.66f, 10.23f, 1, 6.95f, 1,
CUBIC_TO, 3.66f, 1, 1, 3.66f, 1, 6.95f,
CUBIC_TO, 1, 10.23f, 3.66f, 12.89f, 6.95f, 12.89f,
CUBIC_TO, 8.42f, 12.89f, 9.77f, 12.35f, 10.82f, 11.46f,
LINE_TO, 11.06f, 11.71f,
LINE_TO, 11.06f, 12.44f,
LINE_TO, 15.64f, 17,
LINE_TO, 17, 15.64f,
LINE_TO, 12.44f, 11.06f,
LINE_TO, 11.71f, 11.06f,
CLOSE,
MOVE_TO, 6.95f, 11.06f,
CUBIC_TO, 4.67f, 11.06f, 2.83f, 9.22f, 2.83f, 6.95f,
CUBIC_TO, 2.83f, 4.67f, 4.67f, 2.83f, 6.95f, 2.83f,
CUBIC_TO, 9.22f, 2.83f, 11.06f, 4.67f, 11.06f, 6.95f,
CUBIC_TO, 11.06f, 9.22f, 9.22f, 11.06f, 6.95f, 11.06f,
CLOSE,
END
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 36,
MOVE_TO, 23.58f, 21.35f,
LINE_TO, 22.41f, 21.35f,
LINE_TO, 21.99f, 20.95f,
CUBIC_TO, 23.45f, 19.26f, 24.33f, 17.06f, 24.33f, 14.66f,
CUBIC_TO, 24.33f, 9.33f, 20, 5, 14.66f, 5,
CUBIC_TO, 9.33f, 5, 5, 9.33f, 5, 14.66f,
CUBIC_TO, 5, 20, 9.33f, 24.33f, 14.66f, 24.33f,
CUBIC_TO, 17.06f, 24.33f, 19.26f, 23.45f, 20.95f, 21.99f,
LINE_TO, 21.35f, 22.41f,
LINE_TO, 21.35f, 23.58f,
LINE_TO, 28.79f, 31,
LINE_TO, 31, 28.79f,
LINE_TO, 23.58f, 21.35f,
LINE_TO, 23.58f, 21.35f,
CLOSE,
MOVE_TO, 14.66f, 21.35f,
CUBIC_TO, 10.96f, 21.35f, 7.97f, 18.36f, 7.97f, 14.66f,
CUBIC_TO, 7.97f, 10.96f, 10.96f, 7.97f, 14.66f, 7.97f,
CUBIC_TO, 18.36f, 7.97f, 21.35f, 10.96f, 21.35f, 14.66f,
CUBIC_TO, 21.35f, 18.36f, 18.36f, 21.35f, 14.66f, 21.35f,
CLOSE,
END
...@@ -26,22 +26,25 @@ namespace app_list { ...@@ -26,22 +26,25 @@ namespace app_list {
namespace { namespace {
const int kPreferredWidth = 300; constexpr int kPreferredWidth = 300;
const int kPreferredHeight = 56; constexpr int kPreferredWidthFullscreen = 640;
const int kIconLeftPadding = 16; constexpr int kPreferredHeight = 56;
const int kIconRightPadding = 24; constexpr int kPreferredHeightFullscreen = 48;
const int kTextTrailPadding = 16; constexpr int kIconLeftPadding = 16;
const int kSeparatorPadding = 62; constexpr int kIconRightPadding = 24;
const int kBorderSize = 1; constexpr int kIconLeftRightPadding = 19;
const SkColor kSeparatorColor = SkColorSetRGB(0xE1, 0xE1, 0xE1); constexpr int kTextTrailPadding = 16;
constexpr int kSeparatorPadding = 62;
constexpr int kPreferredHeightFullScreen = 48; constexpr int kBorderSize = 1;
constexpr SkColor kSeparatorColor = SkColorSetARGBMacro(0xFF, 0xE1, 0xE1, 0xE1);
// Extra margin at the right of the rightmost action icon. // Extra margin at the right of the rightmost action icon.
const int kActionButtonRightMargin = 8; constexpr int kActionButtonRightMargin = 8;
int GetIconViewWidth() { int GetIconViewWidth() {
return kListIconSize + kIconLeftPadding + kIconRightPadding; if (!features::IsFullscreenAppListEnabled())
return kListIconSize + kIconLeftPadding + kIconRightPadding;
return kListIconSizeFullscreen + 2 * kIconLeftRightPadding;
} }
// Creates a RenderText of given |text| and |styles|. Caller takes ownership // Creates a RenderText of given |text| and |styles|. Caller takes ownership
...@@ -168,9 +171,10 @@ const char* SearchResultView::GetClassName() const { ...@@ -168,9 +171,10 @@ const char* SearchResultView::GetClassName() const {
} }
gfx::Size SearchResultView::CalculatePreferredSize() const { gfx::Size SearchResultView::CalculatePreferredSize() const {
return gfx::Size(kPreferredWidth, is_fullscreen_app_list_enabled_ if (!is_fullscreen_app_list_enabled_)
? kPreferredHeightFullScreen return gfx::Size(kPreferredWidth, kPreferredHeight);
: kPreferredHeight);
return gfx::Size(kPreferredWidthFullscreen, kPreferredHeightFullscreen);
} }
void SearchResultView::Layout() { void SearchResultView::Layout() {
...@@ -180,16 +184,31 @@ void SearchResultView::Layout() { ...@@ -180,16 +184,31 @@ void SearchResultView::Layout() {
gfx::Rect icon_bounds(rect); gfx::Rect icon_bounds(rect);
icon_bounds.set_width(GetIconViewWidth()); icon_bounds.set_width(GetIconViewWidth());
const int top_bottom_padding = (rect.height() - kListIconSize) / 2; if (is_fullscreen_app_list_enabled_) {
icon_bounds.Inset(kIconLeftPadding, top_bottom_padding, kIconRightPadding, const int top_bottom_padding =
top_bottom_padding); (rect.height() - kListIconSizeFullscreen) / 2;
icon_bounds.Inset(kIconLeftRightPadding, top_bottom_padding,
kIconLeftRightPadding, top_bottom_padding);
} else {
const int top_bottom_padding = (rect.height() - kListIconSize) / 2;
icon_bounds.Inset(kIconLeftPadding, top_bottom_padding, kIconRightPadding,
top_bottom_padding);
}
icon_bounds.Intersect(rect); icon_bounds.Intersect(rect);
icon_->SetBoundsRect(icon_bounds); icon_->SetBoundsRect(icon_bounds);
gfx::Rect badge_icon_bounds( gfx::Rect badge_icon_bounds;
icon_bounds.right() - kListBadgeIconSize + kListBadgeIconOffsetX, if (is_fullscreen_app_list_enabled_) {
icon_bounds.bottom() - kListBadgeIconSize + kListBadgeIconOffsetY, badge_icon_bounds =
kListBadgeIconSize, kListBadgeIconSize); gfx::Rect(icon_bounds.right() - kListBadgeIconSizeFullscreen / 2,
icon_bounds.bottom() - kListBadgeIconSizeFullscreen / 2,
kListBadgeIconSizeFullscreen, kListBadgeIconSizeFullscreen);
} else {
badge_icon_bounds = gfx::Rect(
icon_bounds.right() - kListBadgeIconSize + kListBadgeIconOffsetX,
icon_bounds.bottom() - kListBadgeIconSize + kListBadgeIconOffsetY,
kListBadgeIconSize, kListBadgeIconSize);
}
badge_icon_bounds.Intersect(rect); badge_icon_bounds.Intersect(rect);
badge_icon_->SetBoundsRect(badge_icon_bounds); badge_icon_->SetBoundsRect(badge_icon_bounds);
...@@ -331,7 +350,9 @@ void SearchResultView::OnIconChanged() { ...@@ -331,7 +350,9 @@ void SearchResultView::OnIconChanged() {
if (image.isNull()) if (image.isNull())
return; return;
SetIconImage(image, icon_, kListIconSize); SetIconImage(image, icon_,
is_fullscreen_app_list_enabled_ ? kListIconSizeFullscreen
: kListIconSize);
} }
void SearchResultView::OnBadgeIconChanged() { void SearchResultView::OnBadgeIconChanged() {
...@@ -342,7 +363,9 @@ void SearchResultView::OnBadgeIconChanged() { ...@@ -342,7 +363,9 @@ void SearchResultView::OnBadgeIconChanged() {
return; return;
} }
SetIconImage(image, badge_icon_, kListBadgeIconSize); SetIconImage(image, badge_icon_,
is_fullscreen_app_list_enabled_ ? kListBadgeIconSizeFullscreen
: kListBadgeIconSize);
badge_icon_->SetVisible(true); badge_icon_->SetVisible(true);
} }
......
...@@ -112,7 +112,7 @@ class APP_LIST_EXPORT SearchResultView ...@@ -112,7 +112,7 @@ class APP_LIST_EXPORT SearchResultView
// Parent list view. Owned by views hierarchy. // Parent list view. Owned by views hierarchy.
SearchResultListView* list_view_; SearchResultListView* list_view_;
views::ImageView* icon_; // Owned by views hierarchy. views::ImageView* icon_; // Owned by views hierarchy.
views::ImageView* badge_icon_; // Owned by views hierarchy. views::ImageView* badge_icon_; // Owned by views hierarchy.
std::unique_ptr<gfx::RenderText> title_text_; std::unique_ptr<gfx::RenderText> title_text_;
std::unique_ptr<gfx::RenderText> details_text_; std::unique_ptr<gfx::RenderText> details_text_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment