зеркало из https://github.com/electron/electron.git
Merge pull request #7549 from electron/about-panel-options
Support setting about panel options
This commit is contained in:
Коммит
4ae190dab9
|
@ -850,6 +850,8 @@ void App::BuildPrototype(
|
|||
base::Bind(&Browser::SetUserActivity, browser))
|
||||
.SetMethod("getCurrentActivityType",
|
||||
base::Bind(&Browser::GetCurrentActivityType, browser))
|
||||
.SetMethod("setAboutPanelOptions",
|
||||
base::Bind(&Browser::SetAboutPanelOptions, browser))
|
||||
#endif
|
||||
#if defined(OS_WIN)
|
||||
.SetMethod("setUserTasks", base::Bind(&Browser::SetUserTasks, browser))
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "base/macros.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/values.h"
|
||||
#include "native_mate/arguments.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
@ -21,7 +22,6 @@
|
|||
#endif
|
||||
|
||||
namespace base {
|
||||
class DictionaryValue;
|
||||
class FilePath;
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,9 @@ class Browser : public WindowListObserver {
|
|||
|
||||
// Set docks' icon.
|
||||
void DockSetIcon(const gfx::Image& image);
|
||||
|
||||
void ShowAboutPanel();
|
||||
void SetAboutPanelOptions(const base::DictionaryValue& options);
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
@ -245,6 +248,10 @@ class Browser : public WindowListObserver {
|
|||
base::string16 app_user_model_id_;
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
base::DictionaryValue about_panel_options_;
|
||||
#endif
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Browser);
|
||||
};
|
||||
|
||||
|
|
|
@ -253,4 +253,15 @@ void Browser::DockSetIcon(const gfx::Image& image) {
|
|||
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
|
||||
|
|
|
@ -87,4 +87,8 @@
|
|||
atom::Browser::Get()->OnAccessibilitySupportChanged();
|
||||
}
|
||||
|
||||
- (void)orderFrontStandardAboutPanel:(id)sender {
|
||||
atom::Browser::Get()->ShowAboutPanel();
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -853,6 +853,18 @@ technologies, such as screen readers, has been detected. See
|
|||
https://www.chromium.org/developers/design-documents/accessibility for more
|
||||
details.
|
||||
|
||||
### `app.setAboutPanelOptions(options)` _macOS_
|
||||
|
||||
* `options` Object
|
||||
* `ApplicationName` String (optional) - The app's name.
|
||||
* `ApplicationVersion` String (optional) - The app's version.
|
||||
* `Copyright` String (optional) - Copyright information.
|
||||
* `Credits` String (optional) - Credit information.
|
||||
* `Version` String (optional) - The app's build version number.
|
||||
|
||||
Set the about panel options. This will override the values defined in the app's
|
||||
`.plist` file. See the [Apple docs][about-panel-options] for more details.
|
||||
|
||||
### `app.commandLine.appendSwitch(switch[, value])`
|
||||
|
||||
* `switch` String - A command-line switch
|
||||
|
@ -943,3 +955,4 @@ Sets the `image` associated with this dock icon.
|
|||
[activity-type]: https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType
|
||||
[unity-requiremnt]: ../tutorial/desktop-environment-integration.md#unity-launcher-shortcuts-linux
|
||||
[JumpListBeginListMSDN]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378398(v=vs.85).aspx
|
||||
[about-panel-options]: https://developer.apple.com/reference/appkit/nsapplication/1428479-orderfrontstandardaboutpanelwith?language=objc
|
||||
|
|
Загрузка…
Ссылка в новой задаче