Support setting about panel options

This commit is contained in:
Kevin Sawicki 2016-10-10 13:30:58 -07:00
parent 2efb7a12cb
commit 7de6a06acf
4 changed files with 25 additions and 1 deletions

View file

@ -850,6 +850,8 @@ void App::BuildPrototype(
base::Bind(&Browser::SetUserActivity, browser)) base::Bind(&Browser::SetUserActivity, browser))
.SetMethod("getCurrentActivityType", .SetMethod("getCurrentActivityType",
base::Bind(&Browser::GetCurrentActivityType, browser)) base::Bind(&Browser::GetCurrentActivityType, browser))
.SetMethod("setAboutPanelOptions",
base::Bind(&Browser::SetAboutPanelOptions, browser))
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
.SetMethod("setUserTasks", base::Bind(&Browser::SetUserTasks, browser)) .SetMethod("setUserTasks", base::Bind(&Browser::SetUserTasks, browser))

View file

@ -14,6 +14,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/values.h"
#include "native_mate/arguments.h" #include "native_mate/arguments.h"
#if defined(OS_WIN) #if defined(OS_WIN)
@ -21,7 +22,6 @@
#endif #endif
namespace base { namespace base {
class DictionaryValue;
class FilePath; class FilePath;
} }
@ -146,6 +146,9 @@ class Browser : public WindowListObserver {
// Set docks' icon. // Set docks' icon.
void DockSetIcon(const gfx::Image& image); void DockSetIcon(const gfx::Image& image);
void ShowAboutPanel();
void SetAboutPanelOptions(const base::DictionaryValue& options);
#endif // defined(OS_MACOSX) #endif // defined(OS_MACOSX)
#if defined(OS_WIN) #if defined(OS_WIN)
@ -245,6 +248,10 @@ class Browser : public WindowListObserver {
base::string16 app_user_model_id_; base::string16 app_user_model_id_;
#endif #endif
#if defined(OS_MACOSX)
base::DictionaryValue about_panel_options_;
#endif
DISALLOW_COPY_AND_ASSIGN(Browser); DISALLOW_COPY_AND_ASSIGN(Browser);
}; };

View file

@ -253,4 +253,15 @@ void Browser::DockSetIcon(const gfx::Image& image) {
setApplicationIconImage:image.AsNSImage()]; setApplicationIconImage:image.AsNSImage()];
} }
void Browser::ShowAboutPanel() {
NSDictionary* options = DictionaryValueToNSDictionary(about_panel_options_);
[[AtomApplication sharedApplication]
orderFrontStandardAboutPanelWithOptions:options];
}
void Browser::SetAboutPanelOptions(const base::DictionaryValue& options) {
about_panel_options_.Clear();
about_panel_options_.MergeDictionary(&options);
}
} // namespace atom } // namespace atom

View file

@ -87,4 +87,8 @@
atom::Browser::Get()->OnAccessibilitySupportChanged(); atom::Browser::Get()->OnAccessibilitySupportChanged();
} }
- (void)orderFrontStandardAboutPanel:(id)sender {
atom::Browser::Get()->ShowAboutPanel();
}
@end @end