Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/api/nw_window_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,15 @@ NwCurrentWindowInternalToggleKioskModeInternalFunction::Run() {
return RespondNow(NoArguments());
}

bool NwCurrentWindowInternalIsAACActiveInternalFunction::RunNWSync(base::ListValue* response, std::string* error) {
#if defined(OS_MAC)
response->AppendBoolean((NWGetAACActive()));
#else
response->AppendBoolean(false);
#endif
return true;
}

bool NwCurrentWindowInternalIsKioskInternalFunction::RunNWSync(base::ListValue* response, std::string* error) {
if (base::FeatureList::IsEnabled(::features::kNWNewWin)) {
int id = 0;
Expand Down
10 changes: 10 additions & 0 deletions src/api/nw_window_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ class NwCurrentWindowInternalToggleKioskModeInternalFunction : public ExtensionF
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.toggleKioskModeInternal", UNKNOWN)
};

class NwCurrentWindowInternalIsAACActiveInternalFunction : public NWSyncExtensionFunction {
public:
NwCurrentWindowInternalIsAACActiveInternalFunction() {}
bool RunNWSync(base::ListValue* response, std::string* error) override;

protected:
~NwCurrentWindowInternalIsAACActiveInternalFunction() override {}
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.isAACActiveInternal", UNKNOWN)
};

class NwCurrentWindowInternalIsKioskInternalFunction : public NWSyncExtensionFunction {
public:
NwCurrentWindowInternalIsKioskInternalFunction() {}
Expand Down
1 change: 1 addition & 0 deletions src/nw_content_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ void NWSetNSWindowShowInTaskbar(extensions::NativeAppWindow* win, bool show);
void NWSetNSWindowShowInTaskbar(gfx::NativeWindow win, bool show);
void NWSetNSAppKioskOptions(void);
void NWRestoreNSAppKioskOptions(void);
bool NWGetAACActive(void);
#endif
7 changes: 7 additions & 0 deletions src/nw_content_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,10 @@ void NWRestoreNSAppKioskOptions(void) {
}
}
}

bool NWGetAACActive(void) {
if (@available(macOS 10.15.4, *)) {
return [session isActive];
}
return false;
}
5 changes: 5 additions & 0 deletions src/resources/api_nw_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,11 @@ apiBridge.registerCustomHook(function(bindingsAPI) {
return this.appWindow.alphaEnabled();
}
});
Object.defineProperty(NWWindow.prototype, 'isAACActive', {
get: function() {
return currentNWWindowInternal.isAACActiveInternal();
}
});
Object.defineProperty(NWWindow.prototype, 'isKioskMode', {
get: function() {
return currentNWWindowInternal.isKioskInternal();
Expand Down