Commit 9a044d72 authored by Jiaquan He's avatar Jiaquan He Committed by Commit Bot

app_list: refactor GetPreferredIconDimension.

Uses SearchResultDisplayType instead of SearchResult as input.

Bug: 733662
Change-Id: I52f11485d3a90fce44acf2abf4a93424ba5895d4
Reviewed-on: https://chromium-review.googlesource.com/998680Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jiaquan He <hejq@google.com>
Cr-Commit-Position: refs/heads/master@{#548577}
parent b4a2e1e9
......@@ -26,8 +26,8 @@ ArcAppResult::ArcAppResult(Profile* profile,
std::string id = kArcAppPrefix;
id += app_id;
set_id(id);
icon_loader_.reset(
new ArcAppIconLoader(profile, GetPreferredIconDimension(this), this));
icon_loader_.reset(new ArcAppIconLoader(
profile, GetPreferredIconDimension(display_type()), this));
icon_loader_->FetchImage(app_id);
}
......
......@@ -41,7 +41,7 @@ ExtensionAppResult::ExtensionAppResult(Profile* profile,
is_platform_app_ = extension->is_platform_app();
icon_ = extensions::ChromeAppIconService::Get(profile)->CreateIcon(
this, app_id, GetPreferredIconDimension(this));
this, app_id, GetPreferredIconDimension(display_type()));
StartObservingExtensionRegistry();
}
......
......@@ -40,7 +40,7 @@ LauncherSearchResult::LauncherSearchResult(
chromeos::launcher_search_provider::kMaxSearchResultScore);
icon_image_loader_.reset(new LauncherSearchIconImageLoaderImpl(
icon_url, profile, extension, GetPreferredIconDimension(this),
icon_url, profile, extension, GetPreferredIconDimension(display_type()),
std::move(error_reporter)));
icon_image_loader_->LoadResources();
......
......@@ -58,7 +58,7 @@ WebstoreResult::WebstoreResult(Profile* profile,
InitAndStartObserving();
UpdateActions();
int icon_dimension = GetPreferredIconDimension(this);
int icon_dimension = GetPreferredIconDimension(display_type());
icon_ = gfx::ImageSkia(
std::make_unique<UrlIconSource>(
base::Bind(&WebstoreResult::OnIconLoaded, weak_factory_.GetWeakPtr()),
......
......@@ -77,10 +77,9 @@ bool ProcessLeftRightKeyTraversalForTextfield(views::Textfield* textfield,
return true;
}
int GetPreferredIconDimension(SearchResult* search_result) {
switch (search_result->display_type()) {
case ash::SearchResultDisplayType::kRecommendation: // Falls
// through.
int GetPreferredIconDimension(SearchResult::DisplayType display_type) {
switch (display_type) {
case ash::SearchResultDisplayType::kRecommendation: // Falls through.
case ash::SearchResultDisplayType::kTile:
return kTileIconSize;
case ash::SearchResultDisplayType::kList:
......
......@@ -30,7 +30,8 @@ APP_LIST_EXPORT bool ProcessLeftRightKeyTraversalForTextfield(
const ui::KeyEvent& key_event);
// Returns the dimension at which a result's icon should be displayed.
APP_LIST_EXPORT int GetPreferredIconDimension(SearchResult* search_result);
APP_LIST_EXPORT int GetPreferredIconDimension(
ash::SearchResultDisplayType display_type);
} // namespace app_list
......
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