From ac9e0b458d3924773b595c46df85a112c1555988 Mon Sep 17 00:00:00 2001 From: Tereza Tomcova Date: Sat, 12 Nov 2016 17:21:31 +0100 Subject: [PATCH] Added BrowserWindow.setAppDetails to set user model id, icon and relaunch command --- atom/browser/api/atom_api_window.cc | 22 ++++++++++++++++++++++ atom/browser/api/atom_api_window.h | 1 + 2 files changed, 23 insertions(+) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 75be28028d3..f719cead752 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -10,6 +10,7 @@ #include "atom/browser/browser.h" #include "atom/browser/native_window.h" #include "atom/common/native_mate_converters/callback.h" +#include "atom/common/native_mate_converters/file_path_converter.h" #include "atom/common/native_mate_converters/gfx_converter.h" #include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/image_converter.h" @@ -20,6 +21,7 @@ #include "content/public/common/content_switches.h" #include "native_mate/constructor.h" #include "native_mate/dictionary.h" +#include "ui/base/win/shell.h" #include "ui/gfx/geometry/rect.h" #if defined(TOOLKIT_VIEWS) @@ -708,6 +710,25 @@ bool Window::SetThumbnailToolTip(const std::string& tooltip) { return window->taskbar_host().SetThumbnailToolTip( window_->GetAcceleratedWidget(), tooltip); } + +void Window::SetAppDetails(const mate::Dictionary& options) { + base::string16 app_id; + base::FilePath app_icon_path; + int app_icon_index; + base::string16 relaunch_command; + base::string16 relaunch_display_name; + + options.Get("appId", &app_id); + options.Get("appIconPath", &app_icon_path); + options.Get("appIconIndex", &app_icon_index); + options.Get("relaunchCommand", &relaunch_command); + options.Get("relaunchDisplayName", &relaunch_display_name); + + ui::win::SetAppDetailsForWindow( + app_id, app_icon_path, app_icon_index, + relaunch_command, relaunch_display_name, + window_->GetAcceleratedWidget()); +} #endif #if defined(TOOLKIT_VIEWS) @@ -916,6 +937,7 @@ void Window::BuildPrototype(v8::Isolate* isolate, .SetMethod("unhookAllWindowMessages", &Window::UnhookAllWindowMessages) .SetMethod("setThumbnailClip", &Window::SetThumbnailClip) .SetMethod("setThumbnailToolTip", &Window::SetThumbnailToolTip) + .SetMethod("setAppDetails", &Window::SetAppDetails) #endif #if defined(TOOLKIT_VIEWS) .SetMethod("setIcon", &Window::SetIcon) diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index 8a5b95ba8f9..5819c7b2f2a 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -187,6 +187,7 @@ class Window : public mate::TrackableObject, void UnhookAllWindowMessages(); bool SetThumbnailClip(const gfx::Rect& region); bool SetThumbnailToolTip(const std::string& tooltip); + void SetAppDetails(const mate::Dictionary& options); #endif #if defined(TOOLKIT_VIEWS)