create iconmanager as singleton class and cleanup code (#1)

* create iconmanager as singleton class and cleanup code
This commit is contained in:
Robo 2016-11-03 00:27:16 +05:30 committed by Kevin Sawicki
parent 1b3cd87fc9
commit b25b141642
15 changed files with 275 additions and 216 deletions

View file

@ -30,6 +30,7 @@
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "brightray/browser/brightray_paths.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/client_certificate_delegate.h"
@ -314,6 +315,26 @@ struct Converter<Browser::LoginItemSettings> {
}
};
template <>
struct Converter<IconLoader::IconSize> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
IconLoader::IconSize* out) {
std::string icon_size_string;
if (!ConvertFromV8(isolate, val, &icon_size_string))
return false;
if (icon_size_string == "small")
*out = IconLoader::IconSize::SMALL;
else if (icon_size_string == "normal")
*out = IconLoader::IconSize::NORMAL;
else if (icon_size_string == "large")
*out = IconLoader::IconSize::LARGE;
else
return false;
return true;
}
};
template<>
struct Converter<content::CertificateRequestResultType> {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
@ -462,6 +483,11 @@ int ImportIntoCertStore(
}
#endif
void OnIconDataAvailable(const App::FileIconCallback& callback,
gfx::Image* icon) {
callback.Run(icon ? *icon : gfx::Image());
}
} // namespace
App::App(v8::Isolate* isolate) {
@ -841,6 +867,19 @@ JumpListResult App::SetJumpList(v8::Local<v8::Value> val,
}
#endif // defined(OS_WIN)
void App::GetFileIcon(const base::FilePath& path,
IconLoader::IconSize icon_size,
const FileIconCallback& callback) {
IconManager* icon_manager = IconManager::GetInstance();
gfx::Image* icon = icon_manager->LookupIconFromFilepath(path, icon_size);
if (icon) {
callback.Run(*icon);
} else {
icon_manager->LoadIcon(path, icon_size,
base::Bind(&OnIconDataAvailable, callback));
}
}
// static
mate::Handle<App> App::Create(v8::Isolate* isolate) {
return mate::CreateHandle(isolate, new App(isolate));
@ -909,7 +948,8 @@ void App::BuildPrototype(
.SetMethod("isAccessibilitySupportEnabled",
&App::IsAccessibilitySupportEnabled)
.SetMethod("disableHardwareAcceleration",
&App::DisableHardwareAcceleration);
&App::DisableHardwareAcceleration)
.SetMethod("getFileIcon", &App::GetFileIcon);
}
} // namespace api

View file

@ -13,6 +13,7 @@
#include "atom/browser/browser.h"
#include "atom/browser/browser_observer.h"
#include "atom/common/native_mate_converters/callback.h"
#include "chrome/browser/icon_loader.h"
#include "chrome/browser/process_singleton.h"
#include "content/public/browser/gpu_data_manager_observer.h"
#include "native_mate/handle.h"
@ -43,6 +44,8 @@ class App : public AtomBrowserClient::Delegate,
public BrowserObserver,
public content::GpuDataManagerObserver {
public:
using FileIconCallback = base::Callback<void(const gfx::Image&)>;
static mate::Handle<App> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
@ -129,6 +132,9 @@ class App : public AtomBrowserClient::Delegate,
void ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback);
#endif
void GetFileIcon(const base::FilePath& path,
IconLoader::IconSize icon_size,
const FileIconCallback& callback);
#if defined(OS_WIN)
// Get the current Jump List settings.

View file

@ -17,7 +17,6 @@
#include "base/files/file_util.h"
#include "base/strings/pattern.h"
#include "base/strings/string_util.h"
#include "atom/common/fileicon_fetcher.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/base/data_url.h"
@ -303,23 +302,6 @@ gfx::Size NativeImage::GetSize() {
return image_.Size();
}
void NativeImage::CreateFromFileIcon(v8::Isolate* isolate,
const base::FilePath& path,
const IconLoadedCallback& callback) {
IconLoader::IconSize icon_size = IconLoader::IconSize::NORMAL;
float scale_factor = 1.0f;
auto onready = base::Bind(&NativeImage::OnIconLoaded,
base::Unretained(isolate),
callback);
FileIconFetcher::FetchFileIcon(path, scale_factor, icon_size, onready);
}
void NativeImage::OnIconLoaded(v8::Isolate* isolate,
const IconLoadedCallback& callback,
gfx::Image& image) {
callback.Run(Create(isolate, image));
}
float NativeImage::GetAspectRatio() {
gfx::Size size = GetSize();
if (size.IsEmpty())
@ -533,8 +515,6 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("createEmpty", &atom::api::NativeImage::CreateEmpty);
dict.SetMethod("createFromPath", &atom::api::NativeImage::CreateFromPath);
dict.SetMethod("createFromFileIcon",
&atom::api::NativeImage::CreateFromFileIcon);
dict.SetMethod("createFromBuffer", &atom::api::NativeImage::CreateFromBuffer);
dict.SetMethod("createFromDataURL",
&atom::api::NativeImage::CreateFromDataURL);

View file

@ -38,7 +38,6 @@ namespace atom {
namespace api {
class NativeImage : public mate::Wrappable<NativeImage> {
using IconLoadedCallback = base::Callback<void(mate::Handle<NativeImage>)>;
public:
static mate::Handle<NativeImage> CreateEmpty(v8::Isolate* isolate);
static mate::Handle<NativeImage> Create(
@ -53,9 +52,6 @@ class NativeImage : public mate::Wrappable<NativeImage> {
mate::Arguments* args, v8::Local<v8::Value> buffer);
static mate::Handle<NativeImage> CreateFromDataURL(
v8::Isolate* isolate, const GURL& url);
static void CreateFromFileIcon(v8::Isolate* isolate,
const base::FilePath& path,
const IconLoadedCallback& callback);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
@ -90,9 +86,6 @@ class NativeImage : public mate::Wrappable<NativeImage> {
gfx::Size GetSize();
float GetAspectRatio();
static void OnIconLoaded(v8::Isolate* isolate,
const IconLoadedCallback& callback,
gfx::Image& image);
// Mark the image as template image.
void SetTemplateImage(bool setAsTemplate);
// Determine if the image is a template image.

View file

@ -1,76 +0,0 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/common/fileicon_fetcher.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted_memory.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "net/base/escape.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "url/gurl.h"
void FileIconFetcher::FetchFileIcon(const base::FilePath& path,
float scale_factor,
IconLoader::IconSize icon_size,
const IconFetchedCallback& callback) {
IconManager* im = g_browser_process->icon_manager();
gfx::Image* icon = im->LookupIconFromFilepath(path, icon_size);
if (icon) {
scoped_refptr<base::RefCountedBytes> icon_data(new base::RefCountedBytes);
gfx::PNGCodec::EncodeBGRASkBitmap(
icon->ToImageSkia()->GetRepresentation(scale_factor).sk_bitmap(),
false,
&icon_data->data());
callback.Run(icon_data.get());
} else {
// Attach the ChromeURLDataManager request ID to the history request.
IconRequestDetails details;
details.callback = callback;
details.scale_factor = scale_factor;
// Icon was not in cache, go fetch it slowly.
im->LoadIcon(path,
icon_size,
base::Bind(&FileIconFetcher::OnFileIconDataAvailable, details),
&cancelable_task_tracker_);
}
}
void FileIconFetcher::OnFileIconDataAvailable(const IconRequestDetails& details,
gfx::Image* icon) {
if (icon) {
scoped_refptr<base::RefCountedBytes> icon_data(new base::RefCountedBytes);
gfx::PNGCodec::EncodeBGRASkBitmap(
icon->ToImageSkia()->GetRepresentation(
details.scale_factor).sk_bitmap(),
false,
&icon_data->data());
details.callback.Run(icon_data.get());
} else {
details.callback.Run(NULL);
}
}
FileIconFetcher::IconRequestDetails::IconRequestDetails() : scale_factor(1.0f) {
}
FileIconFetcher::IconRequestDetails::IconRequestDetails(
const IconRequestDetails& other) = default;
FileIconFetcher::IconRequestDetails::~IconRequestDetails() {
}

View file

@ -1,48 +0,0 @@
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_COMMON_API_FILEICON_FETCHER_H_
#define ATOM_COMMON_API_FILEICON_FETCHER_H_
#include <string>
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/task/cancelable_task_tracker.h"
#include "chrome/browser/icon_manager.h"
#include "content/public/browser/url_data_source.h"
namespace gfx {
class Image;
}
class FileIconFetcher {
using IconFetchedCallback = base::Callback<void(gfx::Image&)>;
public:
static void FetchFileIcon(const base::FilePath& path,
float scale_factor,
IconLoader::IconSize icon_size,
const IconFetchedCallback& callback);
private:
struct IconRequestDetails {
IconRequestDetails();
IconRequestDetails(const IconRequestDetails& other);
~IconRequestDetails();
// The callback to run with the response.
IconFetchedCallback callback;
// The requested scale factor to respond with.
float scale_factor;
};
// Called when favicon data is available from the history backend.
static void OnFileIconDataAvailable(const IconRequestDetails& details,
gfx::Image* icon);
// Tracks tasks requesting file icons.
static base::CancelableTaskTracker cancelable_task_tracker_;
};
#endif // ATOM_COMMON_API_FILEICON_FETCHER_H_

View file

@ -5,7 +5,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/icon_manager.h"
#include "ui/base/l10n/l10n_util.h"
BrowserProcess* g_browser_process = NULL;
@ -13,8 +12,6 @@ BrowserProcess* g_browser_process = NULL;
BrowserProcess::BrowserProcess()
: print_job_manager_(new printing::PrintJobManager) {
g_browser_process = this;
icon_manager_.reset(new IconManager);
}
BrowserProcess::~BrowserProcess() {
@ -28,7 +25,3 @@ std::string BrowserProcess::GetApplicationLocale() {
printing::PrintJobManager* BrowserProcess::print_job_manager() {
return print_job_manager_.get();
}
IconManager* BrowserProcess::icon_manager() {
return icon_manager_.get();
}

View file

@ -31,11 +31,9 @@ class BrowserProcess {
std::string GetApplicationLocale();
printing::PrintJobManager* print_job_manager();
IconManager* icon_manager();
private:
std::unique_ptr<printing::PrintJobManager> print_job_manager_;
std::unique_ptr<IconManager> icon_manager_;
DISALLOW_COPY_AND_ASSIGN(BrowserProcess);
};

View file

@ -18,8 +18,7 @@ IconLoader::IconLoader(const base::FilePath& file_path,
icon_size_(size),
delegate_(delegate) {}
IconLoader::~IconLoader() {
}
IconLoader::~IconLoader() {}
void IconLoader::Start() {
target_task_runner_ = base::ThreadTaskRunnerHandle::Get();

View file

@ -0,0 +1,55 @@
// Copyright 2013 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.
#include "chrome/browser/icon_loader.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/nix/mime_util_xdg.h"
#include "ui/views/linux_ui/linux_ui.h"
// static
IconGroupID IconLoader::ReadGroupIDFromFilepath(
const base::FilePath& filepath) {
return base::nix::GetFileMimeType(filepath);
}
// static
bool IconLoader::IsIconMutableFromFilepath(const base::FilePath&) {
return false;
}
// static
content::BrowserThread::ID IconLoader::ReadIconThreadID() {
// ReadIcon() calls into views::LinuxUI and GTK2 code, so it must be on the UI
// thread.
return content::BrowserThread::UI;
}
void IconLoader::ReadIcon() {
int size_pixels = 0;
switch (icon_size_) {
case IconLoader::SMALL:
size_pixels = 16;
break;
case IconLoader::NORMAL:
size_pixels = 32;
break;
case IconLoader::LARGE:
size_pixels = 48;
break;
default:
NOTREACHED();
}
views::LinuxUI* ui = views::LinuxUI::instance();
if (ui) {
gfx::Image image = ui->GetIconForContentType(group_, size_pixels);
if (!image.IsEmpty())
image_.reset(new gfx::Image(image));
}
target_task_runner_->PostTask(FROM_HERE,
base::Bind(&IconLoader::NotifyDelegate, this));
}

View file

@ -0,0 +1,62 @@
// Copyright (c) 2012 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.
#include "chrome/browser/icon_loader.h"
#import <AppKit/AppKit.h>
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "base/threading/thread.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_util_mac.h"
// static
IconGroupID IconLoader::ReadGroupIDFromFilepath(
const base::FilePath& filepath) {
return filepath.Extension();
}
// static
bool IconLoader::IsIconMutableFromFilepath(const base::FilePath&) {
return false;
}
// static
content::BrowserThread::ID IconLoader::ReadIconThreadID() {
return content::BrowserThread::FILE;
}
void IconLoader::ReadIcon() {
NSString* group = base::SysUTF8ToNSString(group_);
NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
NSImage* icon = [workspace iconForFileType:group];
if (icon_size_ == ALL) {
// The NSImage already has all sizes.
image_.reset(new gfx::Image([icon retain]));
} else {
NSSize size = NSZeroSize;
switch (icon_size_) {
case IconLoader::SMALL:
size = NSMakeSize(16, 16);
break;
case IconLoader::NORMAL:
size = NSMakeSize(32, 32);
break;
default:
NOTREACHED();
}
gfx::ImageSkia image_skia(gfx::ImageSkiaFromResizedNSImage(icon, size));
if (!image_skia.isNull()) {
image_skia.MakeThreadSafe();
image_.reset(new gfx::Image(image_skia));
}
}
target_task_runner_->PostTask(FROM_HERE,
base::Bind(&IconLoader::NotifyDelegate, this));
}

View file

@ -0,0 +1,75 @@
// Copyright (c) 2012 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.
#include "chrome/browser/icon_loader.h"
#include <windows.h>
#include <shellapi.h>
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/threading/thread.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/display/win/dpi.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/icon_util.h"
#include "ui/gfx/image/image_skia.h"
// static
IconGroupID IconLoader::ReadGroupIDFromFilepath(
const base::FilePath& filepath) {
if (!IsIconMutableFromFilepath(filepath))
return filepath.Extension();
return filepath.value();
}
// static
bool IconLoader::IsIconMutableFromFilepath(const base::FilePath& filepath) {
return filepath.MatchesExtension(L".exe") ||
filepath.MatchesExtension(L".dll") ||
filepath.MatchesExtension(L".ico");
}
// static
content::BrowserThread::ID IconLoader::ReadIconThreadID() {
return content::BrowserThread::FILE;
}
void IconLoader::ReadIcon() {
int size = 0;
switch (icon_size_) {
case IconLoader::SMALL:
size = SHGFI_SMALLICON;
break;
case IconLoader::NORMAL:
size = 0;
break;
case IconLoader::LARGE:
size = SHGFI_LARGEICON;
break;
default:
NOTREACHED();
}
image_.reset();
SHFILEINFO file_info = {0};
if (SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info,
sizeof(SHFILEINFO),
SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) {
std::unique_ptr<SkBitmap> bitmap(
IconUtil::CreateSkBitmapFromHICON(file_info.hIcon));
if (bitmap.get()) {
gfx::ImageSkia image_skia(
gfx::ImageSkiaRep(*bitmap, display::win::GetDPIScale()));
image_skia.MakeThreadSafe();
image_.reset(new gfx::Image(image_skia));
DestroyIcon(file_info.hIcon);
}
}
// Always notify the delegate, regardless of success.
target_task_runner_->PostTask(FROM_HERE,
base::Bind(&IconLoader::NotifyDelegate, this));
}

View file

@ -13,30 +13,21 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace {
void RunCallbackIfNotCanceled(
const base::CancelableTaskTracker::IsCanceledCallback& is_canceled,
const IconManager::IconRequestCallback& callback,
gfx::Image* image) {
if (is_canceled.Run())
return;
callback.Run(image);
}
} // namespace
struct IconManager::ClientRequest {
IconRequestCallback callback;
base::FilePath file_path;
IconLoader::IconSize size;
};
IconManager::IconManager() {
// static
IconManager* IconManager::GetInstance() {
return base::Singleton<IconManager>::get();
}
IconManager::IconManager() {}
IconManager::~IconManager() {
base::STLDeleteValues(&icon_cache_);
STLDeleteValues(&icon_cache_);
}
gfx::Image* IconManager::LookupIconFromFilepath(const base::FilePath& file_name,
@ -54,33 +45,23 @@ gfx::Image* IconManager::LookupIconFromGroup(const IconGroupID& group,
if (it != icon_cache_.end())
return it->second;
return NULL;
return nullptr;
}
base::CancelableTaskTracker::TaskId IconManager::LoadIcon(
const base::FilePath& file_name,
void IconManager::LoadIcon(const base::FilePath& file_name,
IconLoader::IconSize size,
const IconRequestCallback& callback,
base::CancelableTaskTracker* tracker) {
const IconRequestCallback& callback) {
IconLoader* loader = new IconLoader(file_name, size, this);
loader->AddRef();
loader->Start();
base::CancelableTaskTracker::IsCanceledCallback is_canceled;
base::CancelableTaskTracker::TaskId id =
tracker->NewTrackedTaskId(&is_canceled);
IconRequestCallback callback_runner = base::Bind(
&RunCallbackIfNotCanceled, is_canceled, callback);
ClientRequest client_request = { callback_runner, file_name, size };
ClientRequest client_request = {callback, file_name, size};
requests_[loader] = client_request;
return id;
}
// IconLoader::Delegate implementation -----------------------------------------
bool IconManager::OnGroupLoaded(IconLoader* loader,
const IconGroupID& group) {
bool IconManager::OnGroupLoaded(IconLoader* loader, const IconGroupID& group) {
ClientRequests::iterator rit = requests_.find(loader);
if (rit == requests_.end()) {
NOTREACHED();
@ -95,8 +76,9 @@ bool IconManager::OnGroupLoaded(IconLoader* loader,
return OnImageLoaded(loader, result, group);
}
bool IconManager::OnImageLoaded(
IconLoader* loader, gfx::Image* result, const IconGroupID& group) {
bool IconManager::OnImageLoaded(IconLoader* loader,
gfx::Image* result,
const IconGroupID& group) {
ClientRequests::iterator rit = requests_.find(loader);
// Balances the AddRef() in LoadIcon().
@ -139,10 +121,8 @@ bool IconManager::OnImageLoaded(
IconManager::CacheKey::CacheKey(const IconGroupID& group,
IconLoader::IconSize size)
: group(group),
size(size) {
}
: group(group), size(size) {}
bool IconManager::CacheKey::operator<(const CacheKey &other) const {
bool IconManager::CacheKey::operator<(const CacheKey& other) const {
return std::tie(group, size) < std::tie(other.group, other.size);
}

View file

@ -49,15 +49,13 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/memory/singleton.h"
#include "chrome/browser/icon_loader.h"
#include "ui/gfx/image/image.h"
class IconManager : public IconLoader::Delegate {
public:
IconManager();
~IconManager() override;
static IconManager* GetInstance();
// Synchronous call to examine the internal caches for the icon. Returns the
// icon if we have already loaded it, NULL if we don't have it and must load
// it via 'LoadIcon'. The returned bitmap is owned by the IconManager and must
@ -78,11 +76,9 @@ class IconManager : public IconLoader::Delegate {
// should never keep it or delete it.
// 3. The gfx::Image pointer passed to the callback may be NULL if decoding
// failed.
base::CancelableTaskTracker::TaskId LoadIcon(
const base::FilePath& file_name,
void LoadIcon(const base::FilePath& file_name,
IconLoader::IconSize size,
const IconRequestCallback& callback,
base::CancelableTaskTracker* tracker);
const IconRequestCallback& callback);
// IconLoader::Delegate interface.
bool OnGroupLoaded(IconLoader* loader, const IconGroupID& group) override;
@ -91,11 +87,16 @@ class IconManager : public IconLoader::Delegate {
const IconGroupID& group) override;
private:
friend struct base::DefaultSingletonTraits<IconManager>;
IconManager();
~IconManager() override;
struct CacheKey {
CacheKey(const IconGroupID& group, IconLoader::IconSize size);
// Used as a key in the map below, so we need this comparator.
bool operator<(const CacheKey &other) const;
bool operator<(const CacheKey& other) const;
IconGroupID group;
IconLoader::IconSize size;

View file

@ -404,8 +404,6 @@
'atom/common/crash_reporter/win/crash_service_main.h',
'atom/common/draggable_region.cc',
'atom/common/draggable_region.h',
'atom/common/fileicon_fetcher.cc',
'atom/common/fileicon_fetcher.h',
'atom/common/google_api_key.h',
'atom/common/key_weak_map.h',
'atom/common/keyboard_util.cc',
@ -476,11 +474,14 @@
'chromium_src/chrome/browser/browser_process.h',
'chromium_src/chrome/browser/chrome_process_finder_win.cc',
'chromium_src/chrome/browser/chrome_process_finder_win.h',
'chromium_src/chrome/browser/chrome_notification_types.h',
'chromium_src/chrome/browser/icon_loader_auralinux.cc',
'chromium_src/chrome/browser/icon_loader_mac.mm',
'chromium_src/chrome/browser/icon_loader_win.cc',
'chromium_src/chrome/browser/icon_loader.cc',
'chromium_src/chrome/browser/icon_loader.h',
'chromium_src/chrome/browser/icon_manager.cc',
'chromium_src/chrome/browser/icon_manager.h',
'chromium_src/chrome/browser/chrome_notification_types.h',
'chromium_src/chrome/browser/extensions/global_shortcut_listener.cc',
'chromium_src/chrome/browser/extensions/global_shortcut_listener.h',
'chromium_src/chrome/browser/extensions/global_shortcut_listener_mac.mm',