OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/api/automation_internal/automation_internal_
api.h" | 5 #include "chrome/browser/extensions/api/automation_internal/automation_internal_
api.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 detail.event_type = ui::AX_EVENT_MEDIA_STOPPED_PLAYING; | 241 detail.event_type = ui::AX_EVENT_MEDIA_STOPPED_PLAYING; |
242 details.push_back(detail); | 242 details.push_back(detail); |
243 AccessibilityEventReceived(details); | 243 AccessibilityEventReceived(details); |
244 } | 244 } |
245 | 245 |
246 private: | 246 private: |
247 friend class content::WebContentsUserData<AutomationWebContentsObserver>; | 247 friend class content::WebContentsUserData<AutomationWebContentsObserver>; |
248 | 248 |
249 explicit AutomationWebContentsObserver(content::WebContents* web_contents) | 249 explicit AutomationWebContentsObserver(content::WebContents* web_contents) |
250 : content::WebContentsObserver(web_contents), | 250 : content::WebContentsObserver(web_contents), |
251 browser_context_(web_contents->GetBrowserContext()) {} | 251 browser_context_(web_contents->GetBrowserContext()) { |
| 252 if (web_contents->WasRecentlyAudible()) { |
| 253 std::vector<content::AXEventNotificationDetails> details; |
| 254 content::RenderFrameHost* rfh = web_contents->GetMainFrame(); |
| 255 if (!rfh) |
| 256 return; |
| 257 |
| 258 content::AXEventNotificationDetails detail; |
| 259 detail.ax_tree_id = rfh->GetAXTreeID(); |
| 260 detail.event_type = ui::AX_EVENT_MEDIA_STARTED_PLAYING; |
| 261 details.push_back(detail); |
| 262 AccessibilityEventReceived(details); |
| 263 } |
| 264 } |
252 | 265 |
253 content::BrowserContext* browser_context_; | 266 content::BrowserContext* browser_context_; |
254 | 267 |
255 DISALLOW_COPY_AND_ASSIGN(AutomationWebContentsObserver); | 268 DISALLOW_COPY_AND_ASSIGN(AutomationWebContentsObserver); |
256 }; | 269 }; |
257 | 270 |
258 ExtensionFunction::ResponseAction | 271 ExtensionFunction::ResponseAction |
259 AutomationInternalEnableTabFunction::Run() { | 272 AutomationInternalEnableTabFunction::Run() { |
260 const AutomationInfo* automation_info = AutomationInfo::Get(extension()); | 273 const AutomationInfo* automation_info = AutomationInfo::Get(extension()); |
261 EXTENSION_FUNCTION_VALIDATE(automation_info); | 274 EXTENSION_FUNCTION_VALIDATE(automation_info); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 if (!error.empty()) { | 534 if (!error.empty()) { |
522 Respond(Error(error)); | 535 Respond(Error(error)); |
523 return; | 536 return; |
524 } | 537 } |
525 | 538 |
526 Respond( | 539 Respond( |
527 OneArgument(base::MakeUnique<base::FundamentalValue>(result_acc_obj_id))); | 540 OneArgument(base::MakeUnique<base::FundamentalValue>(result_acc_obj_id))); |
528 } | 541 } |
529 | 542 |
530 } // namespace extensions | 543 } // namespace extensions |
OLD | NEW |