Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1288)

Unified Diff: chrome/browser/extensions/api/automation_internal/automation_internal_api.cc

Issue 2550593003: Expose media controls to accessibility (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/common/chrome_extension_externs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
diff --git a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
index f564ab7a490284cac960a3940235dea34d1b3639..ad698cc66459f5048228875ccf252a4d4cf6e8eb 100644
--- a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
+++ b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
@@ -28,6 +28,7 @@
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager.h"
+#include "content/public/browser/media_session.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
@@ -222,6 +223,26 @@ class AutomationWebContentsObserver
browser_context_);
}
+ void MediaStartedPlaying(const MediaPlayerInfo& video_type,
+ const MediaPlayerId& id) override {
dmazzoni 2016/12/02 17:01:43 nit: indentation
+ std::vector<content::AXEventNotificationDetails> details;
+ content::AXEventNotificationDetails detail;
+ detail.ax_tree_id = id.first->GetAXTreeID();
dmazzoni 2016/12/02 17:01:43 nit: extra space
+ detail.event_type = ui::AX_EVENT_MEDIA_STARTED_PLAYING;
+ details.push_back(detail);
+ AccessibilityEventReceived(details);
+ }
+
+ void MediaStoppedPlaying(const MediaPlayerInfo& video_type,
+ const MediaPlayerId& id) override {
dmazzoni 2016/12/02 17:01:43 same
+ std::vector<content::AXEventNotificationDetails> details;
+ content::AXEventNotificationDetails detail;
+ detail.ax_tree_id = id.first->GetAXTreeID();
dmazzoni 2016/12/02 17:01:43 same
+ detail.event_type = ui::AX_EVENT_MEDIA_STOPPED_PLAYING;
+ details.push_back(detail);
+ AccessibilityEventReceived(details);
+ }
+
private:
friend class content::WebContentsUserData<AutomationWebContentsObserver>;
@@ -334,13 +355,26 @@ AutomationInternalPerformActionFunction::Run() {
if (!rfh)
return RespondNow(Error("Ignoring action on destroyed node"));
- const content::WebContents* contents =
+ content::WebContents* contents =
content::WebContents::FromRenderFrameHost(rfh);
if (!CanRequestAutomation(extension(), automation_info, contents)) {
return RespondNow(
Error(kCannotRequestAutomationOnPage, contents->GetURL().spec()));
}
+ // These actions are handled directly for the WebContents.
+ if (params->args.action_type ==
+ api::automation_internal::ACTION_TYPE_STARTDUCKING) {
+ content::MediaSession* session = content::MediaSession::Get(contents);
+ session->StartDucking();
+ return RespondNow(NoArguments());
+ } else if (params->args.action_type ==
+ api::automation_internal::ACTION_TYPE_STOPDUCKING) {
+ content::MediaSession* session = content::MediaSession::Get(contents);
+ session->StopDucking();
+ return RespondNow(NoArguments());
+ }
+
RenderFrameHostActionAdapter adapter(rfh);
return RouteActionToAdapter(params.get(), &adapter);
}
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/common/chrome_extension_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698