| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "content/renderer/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "cc/surfaces/surface.h" | 16 #include "cc/surfaces/surface.h" |
| 17 #include "content/common/browser_plugin/browser_plugin_constants.h" | 17 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 18 #include "content/common/browser_plugin/browser_plugin_messages.h" | 18 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 19 #include "content/common/view_messages.h" | 19 #include "content/common/view_messages.h" |
| 20 #include "content/public/common/content_client.h" | 20 #include "content/public/common/content_client.h" |
| 21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/renderer/browser_plugin_delegate.h" | 22 #include "content/public/renderer/browser_plugin_delegate.h" |
| 23 #include "content/public/renderer/content_renderer_client.h" | 23 #include "content/public/renderer/content_renderer_client.h" |
| 24 #include "content/renderer/accessibility/render_accessibility_impl.h" |
| 24 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 25 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 25 #include "content/renderer/child_frame_compositing_helper.h" | 26 #include "content/renderer/child_frame_compositing_helper.h" |
| 26 #include "content/renderer/cursor_utils.h" | 27 #include "content/renderer/cursor_utils.h" |
| 27 #include "content/renderer/drop_data_builder.h" | 28 #include "content/renderer/drop_data_builder.h" |
| 28 #include "content/renderer/render_thread_impl.h" | 29 #include "content/renderer/render_thread_impl.h" |
| 29 #include "content/renderer/sad_plugin.h" | 30 #include "content/renderer/sad_plugin.h" |
| 30 #include "third_party/WebKit/public/platform/WebRect.h" | 31 #include "third_party/WebKit/public/platform/WebRect.h" |
| 32 #include "third_party/WebKit/public/web/WebAXObject.h" |
| 31 #include "third_party/WebKit/public/web/WebDocument.h" | 33 #include "third_party/WebKit/public/web/WebDocument.h" |
| 32 #include "third_party/WebKit/public/web/WebElement.h" | 34 #include "third_party/WebKit/public/web/WebElement.h" |
| 33 #include "third_party/WebKit/public/web/WebInputEvent.h" | 35 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 34 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 36 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 35 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 37 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 36 #include "third_party/WebKit/public/web/WebView.h" | 38 #include "third_party/WebKit/public/web/WebView.h" |
| 37 #include "ui/events/keycodes/keyboard_codes.h" | 39 #include "ui/events/keycodes/keyboard_codes.h" |
| 38 | 40 |
| 39 using blink::WebPluginContainer; | 41 using blink::WebPluginContainer; |
| 40 using blink::WebPoint; | 42 using blink::WebPoint; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 attach_params.is_full_page_plugin = | 159 attach_params.is_full_page_plugin = |
| 158 frame->view()->mainFrame()->isWebLocalFrame() && | 160 frame->view()->mainFrame()->isWebLocalFrame() && |
| 159 frame->view()->mainFrame()->document().isPluginDocument(); | 161 frame->view()->mainFrame()->document().isPluginDocument(); |
| 160 } | 162 } |
| 161 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_Attach( | 163 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_Attach( |
| 162 render_frame_routing_id_, | 164 render_frame_routing_id_, |
| 163 browser_plugin_instance_id_, | 165 browser_plugin_instance_id_, |
| 164 attach_params)); | 166 attach_params)); |
| 165 | 167 |
| 166 attached_ = true; | 168 attached_ = true; |
| 169 |
| 170 // Post an update event to the associated accessibility object. |
| 171 auto* render_frame = |
| 172 RenderFrameImpl::FromRoutingID(render_frame_routing_id()); |
| 173 if (render_frame && render_frame->render_accessibility() && container()) { |
| 174 blink::WebElement element = container()->element(); |
| 175 blink::WebAXObject ax_element = element.accessibilityObject(); |
| 176 if (!ax_element.isDetached()) { |
| 177 render_frame->render_accessibility()->HandleAXEvent( |
| 178 ax_element, |
| 179 ui::AX_EVENT_CHILDREN_CHANGED); |
| 180 } |
| 181 } |
| 167 } | 182 } |
| 168 | 183 |
| 169 void BrowserPlugin::Detach() { | 184 void BrowserPlugin::Detach() { |
| 170 if (!attached()) | 185 if (!attached()) |
| 171 return; | 186 return; |
| 172 | 187 |
| 173 attached_ = false; | 188 attached_ = false; |
| 174 guest_crashed_ = false; | 189 guest_crashed_ = false; |
| 175 EnableCompositing(false); | 190 EnableCompositing(false); |
| 176 | 191 |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 | 594 |
| 580 bool BrowserPlugin::HandleMouseLockedInputEvent( | 595 bool BrowserPlugin::HandleMouseLockedInputEvent( |
| 581 const blink::WebMouseEvent& event) { | 596 const blink::WebMouseEvent& event) { |
| 582 BrowserPluginManager::Get()->Send( | 597 BrowserPluginManager::Get()->Send( |
| 583 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 598 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
| 584 &event)); | 599 &event)); |
| 585 return true; | 600 return true; |
| 586 } | 601 } |
| 587 | 602 |
| 588 } // namespace content | 603 } // namespace content |
| OLD | NEW |