]> khamidou — GitHub mirrors - electron.git/commitdiff
Add setAudioMuted to webContents
authorMagica <i@0u0.moe>
Mon, 15 Jun 2015 13:40:49 +0000 (21:40 +0800)
committerMagica <i@0u0.moe>
Mon, 15 Jun 2015 13:40:49 +0000 (21:40 +0800)
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h
atom/renderer/lib/web-view/web-view.coffee
docs/api/browser-window.md
docs/api/web-view-tag.md

index 029c098a8daa9789b9fb9064ac6adda6487469ef..ec24ab45fa241b35e2f40ba51e99c787f9dbc992 100644 (file)
@@ -580,6 +580,14 @@ void WebContents::UnregisterServiceWorker(
                                    callback);
 }
 
+void WebContents::SetAudioMuted(bool muted) {
+  web_contents()->SetAudioMuted(muted);
+}
+
+bool WebContents::IsAudioMuted() {
+  return web_contents()->IsAudioMuted();
+}
+
 void WebContents::Undo() {
   web_contents()->Undo();
 }
@@ -731,6 +739,8 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
         .SetMethod("isDevToolsOpened", &WebContents::IsDevToolsOpened)
         .SetMethod("toggleDevTools", &WebContents::ToggleDevTools)
         .SetMethod("inspectElement", &WebContents::InspectElement)
+        .SetMethod("setAudioMuted", &WebContents::SetAudioMuted)
+        .SetMethod("isAudioMuted", &WebContents::IsAudioMuted)
         .SetMethod("undo", &WebContents::Undo)
         .SetMethod("redo", &WebContents::Redo)
         .SetMethod("cut", &WebContents::Cut)
index 9e3016f5da8e549228ea97ca79db302667fc9d03..7c20144517f38b4245005d4d6d809e4ce02aa69b 100644 (file)
@@ -87,6 +87,8 @@ class WebContents : public mate::EventEmitter,
   void InspectServiceWorker();
   void HasServiceWorker(const base::Callback<void(bool)>&);
   void UnregisterServiceWorker(const base::Callback<void(bool)>&);
+  void SetAudioMuted(bool muted);
+  bool IsAudioMuted();
 
   // Editing commands.
   void Undo();
index a815dc6499dc0daa9d67e9ad3518906a0f4b5d6f..443b2bca1f2dd5658956c68be4e6354510429d2d 100644 (file)
@@ -275,6 +275,8 @@ registerWebViewElement = ->
     "closeDevTools"
     "isDevToolsOpened"
     "inspectElement"
+    "setAudioMuted"
+    "isAudioMuted"
     "undo"
     "redo"
     "cut"
index 4211ac8020fd305140c9df8c3457d83af4789f0b..11ac53096038d5121392b862e13e626ef0f8226c 100644 (file)
@@ -877,6 +877,16 @@ Injects CSS into this 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()
 
 Executes editing command `undo` in page.
index c83994768478e38ad500caf5e6967345a2ab1a0e..4a227d769cb76c252dfad93a485c687d471ceb9d 100644 (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.
 
+### `<webview>`.setAudioMuted(muted)
+
++ `muted` Boolean
+
+Set guest page muted.
+
+### `<webview>`.isAudioMuted()
+
+Returns whether guest page has been muted.
+
 ### `<webview>`.undo()
 
 Executes editing command `undo` in page.