Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f820055

Browse files
committed
[API] Add properties: isFullscreen, isKioskMode and methods: toggleKioskMode()
and toggleFullscreen() to Window
1 parent ca3da68 commit f820055

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/api/window_bindings.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ WindowBindings::GetNativeFunction(v8::Handle<v8::String> name) {
4848
return v8::FunctionTemplate::New(BindToShell);
4949
else if (name->Equals(v8::String::New("CallObjectMethod")))
5050
return v8::FunctionTemplate::New(CallObjectMethod);
51+
else if (name->Equals(v8::String::New("CallObjectMethodSync")))
52+
return v8::FunctionTemplate::New(CallObjectMethodSync);
5153
else if (name->Equals(v8::String::New("GetWindowObject")))
5254
return v8::FunctionTemplate::New(GetWindowObject);
5355

src/api/window_bindings.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ Window.prototype.__defineGetter__('menu', function() {
100100
return this.getHiddenValue('menu');
101101
});
102102

103+
Window.prototype.__defineGetter__('isFullscreen', function() {
104+
var result = CallObjectMethodSync(this, 'IsFullscreen', []);
105+
return Boolean(result[0]);
106+
});
107+
108+
Window.prototype.__defineGetter__('isKioskMode', function() {
109+
var result = CallObjectMethodSync(this, 'IsKioskMode', []);
110+
return Boolean(result[0]);
111+
});
112+
103113
Window.prototype.moveTo = function(x, y) {
104114
this.window.moveTo(x, y);
105115
}
@@ -170,6 +180,10 @@ Window.prototype.leaveFullscreen = function() {
170180
CallObjectMethod(this, 'LeaveFullscreen', []);
171181
}
172182

183+
Window.prototype.toggleFullscreen = function() {
184+
CallObjectMethod(this, 'ToggleFullscreen', []);
185+
}
186+
173187
Window.prototype.enterKioskMode = function() {
174188
CallObjectMethod(this, 'EnterKioskMode', []);
175189
}
@@ -178,6 +192,10 @@ Window.prototype.leaveKioskMode = function() {
178192
CallObjectMethod(this, 'LeaveKioskMode', []);
179193
}
180194

195+
Window.prototype.toggleKioskMode = function() {
196+
CallObjectMethod(this, 'ToggleKioskMode', []);
197+
}
198+
181199
Window.prototype.showDevTools = function() {
182200
CallObjectMethod(this, 'ShowDevTools', []);
183201
}

0 commit comments

Comments
 (0)