Merge pull request #1980 from magicae/set-audio-mute

webContents: add setAudioMuted to webContents
This commit is contained in:
Cheng Zhao 2015-06-16 14:46:31 +08:00
commit bf9af4d45b
5 changed files with 34 additions and 0 deletions

View file

@ -580,6 +580,14 @@ void WebContents::UnregisterServiceWorker(
callback); callback);
} }
void WebContents::SetAudioMuted(bool muted) {
web_contents()->SetAudioMuted(muted);
}
bool WebContents::IsAudioMuted() {
return web_contents()->IsAudioMuted();
}
void WebContents::Undo() { void WebContents::Undo() {
web_contents()->Undo(); web_contents()->Undo();
} }
@ -731,6 +739,8 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
.SetMethod("isDevToolsOpened", &WebContents::IsDevToolsOpened) .SetMethod("isDevToolsOpened", &WebContents::IsDevToolsOpened)
.SetMethod("toggleDevTools", &WebContents::ToggleDevTools) .SetMethod("toggleDevTools", &WebContents::ToggleDevTools)
.SetMethod("inspectElement", &WebContents::InspectElement) .SetMethod("inspectElement", &WebContents::InspectElement)
.SetMethod("setAudioMuted", &WebContents::SetAudioMuted)
.SetMethod("isAudioMuted", &WebContents::IsAudioMuted)
.SetMethod("undo", &WebContents::Undo) .SetMethod("undo", &WebContents::Undo)
.SetMethod("redo", &WebContents::Redo) .SetMethod("redo", &WebContents::Redo)
.SetMethod("cut", &WebContents::Cut) .SetMethod("cut", &WebContents::Cut)

View file

@ -87,6 +87,8 @@ class WebContents : public mate::EventEmitter,
void InspectServiceWorker(); void InspectServiceWorker();
void HasServiceWorker(const base::Callback<void(bool)>&); void HasServiceWorker(const base::Callback<void(bool)>&);
void UnregisterServiceWorker(const base::Callback<void(bool)>&); void UnregisterServiceWorker(const base::Callback<void(bool)>&);
void SetAudioMuted(bool muted);
bool IsAudioMuted();
// Editing commands. // Editing commands.
void Undo(); void Undo();

View file

@ -275,6 +275,8 @@ registerWebViewElement = ->
"closeDevTools" "closeDevTools"
"isDevToolsOpened" "isDevToolsOpened"
"inspectElement" "inspectElement"
"setAudioMuted"
"isAudioMuted"
"undo" "undo"
"redo" "redo"
"cut" "cut"

View file

@ -877,6 +877,16 @@ Injects CSS into this page.
Evaluates `code` in page. Evaluates `code` in page.
### WebContents.setAudioMuted(muted)
+ `muted` Boolean
Set the page muted.
### WebContents.isAudioMuted()
Returns whether this page has been muted.
### WebContents.undo() ### WebContents.undo()
Executes editing command `undo` in page. Executes editing command `undo` in page.

View file

@ -250,6 +250,16 @@ Starts inspecting element at position (`x`, `y`) of guest page.
Opens the devtools for the service worker context present in the guest page. Opens the devtools for the service worker context present in the guest page.
### `<webview>`.setAudioMuted(muted)
+ `muted` Boolean
Set guest page muted.
### `<webview>`.isAudioMuted()
Returns whether guest page has been muted.
### `<webview>`.undo() ### `<webview>`.undo()
Executes editing command `undo` in page. Executes editing command `undo` in page.