From bec671bac83c23dcf6b74bc6de582aa363c8b900 Mon Sep 17 00:00:00 2001 From: Yury Solovyov Date: Thu, 3 Nov 2016 21:04:56 +0300 Subject: [PATCH] Make size optional --- atom/browser/api/atom_api_app.cc | 15 +++++++++++++-- atom/browser/api/atom_api_app.h | 3 +-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 5f878aace1c6..f5d9201f84ee 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -868,8 +868,19 @@ JumpListResult App::SetJumpList(v8::Local val, #endif // defined(OS_WIN) void App::GetFileIcon(const base::FilePath& path, - IconLoader::IconSize icon_size, - const FileIconCallback& callback) { + mate::Arguments* args) { + IconLoader::IconSize icon_size; + FileIconCallback callback; + + if (!args->GetNext(&icon_size)) { + icon_size = IconLoader::IconSize::NORMAL; + } + + if (!args->GetNext(&callback)) { + args->ThrowError(); + return; + } + IconManager* icon_manager = IconManager::GetInstance(); gfx::Image* icon = icon_manager->LookupIconFromFilepath(path, icon_size); if (icon) { diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index b42b201fff36..7d2f6f752b39 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -133,8 +133,7 @@ class App : public AtomBrowserClient::Delegate, const net::CompletionCallback& callback); #endif void GetFileIcon(const base::FilePath& path, - IconLoader::IconSize icon_size, - const FileIconCallback& callback); + mate::Arguments* args); #if defined(OS_WIN) // Get the current Jump List settings.