| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/public/test/browser_test_utils.h" | 5 #include "content/public/test/browser_test_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "base/values.h" | 27 #include "base/values.h" |
| 28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 29 #include "cc/surfaces/surface.h" | 29 #include "cc/surfaces/surface.h" |
| 30 #include "cc/surfaces/surface_manager.h" | 30 #include "cc/surfaces/surface_manager.h" |
| 31 #include "content/browser/accessibility/browser_accessibility.h" | 31 #include "content/browser/accessibility/browser_accessibility.h" |
| 32 #include "content/browser/accessibility/browser_accessibility_manager.h" | 32 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 33 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 33 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 34 #include "content/browser/compositor/surface_utils.h" | 34 #include "content/browser/compositor/surface_utils.h" |
| 35 #include "content/browser/frame_host/cross_process_frame_connector.h" | 35 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 36 #include "content/browser/frame_host/frame_tree_node.h" | 36 #include "content/browser/frame_host/frame_tree_node.h" |
| 37 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 37 #include "content/browser/frame_host/render_frame_host_impl.h" | 38 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 38 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 39 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 39 #include "content/browser/renderer_host/render_widget_host_impl.h" | 40 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 41 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
| 40 #include "content/browser/web_contents/web_contents_impl.h" | 42 #include "content/browser/web_contents/web_contents_impl.h" |
| 41 #include "content/browser/web_contents/web_contents_view.h" | 43 #include "content/browser/web_contents/web_contents_view.h" |
| 42 #include "content/common/fileapi/file_system_messages.h" | 44 #include "content/common/fileapi/file_system_messages.h" |
| 43 #include "content/common/fileapi/webblob_messages.h" | 45 #include "content/common/fileapi/webblob_messages.h" |
| 46 #include "content/common/frame_messages.h" |
| 44 #include "content/common/input/synthetic_web_input_event_builders.h" | 47 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 45 #include "content/common/input_messages.h" | 48 #include "content/common/input_messages.h" |
| 46 #include "content/common/view_messages.h" | 49 #include "content/common/view_messages.h" |
| 47 #include "content/public/browser/browser_context.h" | 50 #include "content/public/browser/browser_context.h" |
| 48 #include "content/public/browser/browser_plugin_guest_manager.h" | 51 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 49 #include "content/public/browser/browser_thread.h" | 52 #include "content/public/browser/browser_thread.h" |
| 50 #include "content/public/browser/histogram_fetcher.h" | 53 #include "content/public/browser/histogram_fetcher.h" |
| 54 #include "content/public/browser/interstitial_page.h" |
| 51 #include "content/public/browser/navigation_entry.h" | 55 #include "content/public/browser/navigation_entry.h" |
| 52 #include "content/public/browser/navigation_handle.h" | 56 #include "content/public/browser/navigation_handle.h" |
| 53 #include "content/public/browser/navigation_throttle.h" | 57 #include "content/public/browser/navigation_throttle.h" |
| 54 #include "content/public/browser/notification_service.h" | 58 #include "content/public/browser/notification_service.h" |
| 55 #include "content/public/browser/notification_types.h" | 59 #include "content/public/browser/notification_types.h" |
| 56 #include "content/public/browser/render_frame_host.h" | 60 #include "content/public/browser/render_frame_host.h" |
| 57 #include "content/public/browser/render_process_host.h" | 61 #include "content/public/browser/render_process_host.h" |
| 58 #include "content/public/browser/render_view_host.h" | 62 #include "content/public/browser/render_view_host.h" |
| 59 #include "content/public/browser/storage_partition.h" | 63 #include "content/public/browser/storage_partition.h" |
| 60 #include "content/public/browser/web_contents.h" | 64 #include "content/public/browser/web_contents.h" |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 static_cast<WebContentsImpl*>(web_contents); | 1186 static_cast<WebContentsImpl*>(web_contents); |
| 1183 BrowserPluginGuest* browser_plugin_guest = | 1187 BrowserPluginGuest* browser_plugin_guest = |
| 1184 web_contents_impl->GetBrowserPluginGuest(); | 1188 web_contents_impl->GetBrowserPluginGuest(); |
| 1185 return browser_plugin_guest ? browser_plugin_guest->focused() : false; | 1189 return browser_plugin_guest ? browser_plugin_guest->focused() : false; |
| 1186 } | 1190 } |
| 1187 | 1191 |
| 1188 RenderWidgetHost* GetMouseLockWidget(WebContents* web_contents) { | 1192 RenderWidgetHost* GetMouseLockWidget(WebContents* web_contents) { |
| 1189 return static_cast<WebContentsImpl*>(web_contents)->GetMouseLockWidget(); | 1193 return static_cast<WebContentsImpl*>(web_contents)->GetMouseLockWidget(); |
| 1190 } | 1194 } |
| 1191 | 1195 |
| 1196 bool IsInnerInterstitialPageConnected(InterstitialPage* interstitial_page) { |
| 1197 InterstitialPageImpl* impl = |
| 1198 static_cast<InterstitialPageImpl*>(interstitial_page); |
| 1199 |
| 1200 RenderWidgetHostViewBase* rwhvb = |
| 1201 static_cast<RenderWidgetHostViewBase*>(impl->GetView()); |
| 1202 EXPECT_TRUE(rwhvb->IsRenderWidgetHostViewChildFrame()); |
| 1203 RenderWidgetHostViewChildFrame* rwhvcf = |
| 1204 static_cast<RenderWidgetHostViewChildFrame*>(rwhvb); |
| 1205 |
| 1206 CrossProcessFrameConnector* frame_connector = |
| 1207 rwhvcf->FrameConnectorForTesting(); |
| 1208 |
| 1209 WebContentsImpl* inner_web_contents = |
| 1210 static_cast<WebContentsImpl*>(impl->GetWebContents()); |
| 1211 FrameTreeNode* outer_node = FrameTreeNode::GloballyFindByID( |
| 1212 inner_web_contents->GetOuterDelegateFrameTreeNodeId()); |
| 1213 |
| 1214 return outer_node->current_frame_host()->GetView() == |
| 1215 frame_connector->GetParentRenderWidgetHostView(); |
| 1216 } |
| 1217 |
| 1218 std::vector<RenderWidgetHostView*> GetInputEventRouterRenderWidgetHostViews( |
| 1219 WebContents* web_contents) { |
| 1220 return static_cast<WebContentsImpl*>(web_contents) |
| 1221 ->GetInputEventRouter() |
| 1222 ->GetRenderWidgetHostViewsForTests(); |
| 1223 } |
| 1224 |
| 1225 RenderWidgetHost* GetFocusedRenderWidgetHost(WebContents* web_contents) { |
| 1226 WebContentsImpl* web_contents_impl = |
| 1227 static_cast<WebContentsImpl*>(web_contents); |
| 1228 return web_contents_impl->GetFocusedRenderWidgetHost( |
| 1229 web_contents_impl->GetMainFrame()->GetRenderWidgetHost()); |
| 1230 } |
| 1231 |
| 1232 void RouteMouseEvent(WebContents* web_contents, blink::WebMouseEvent* event) { |
| 1233 WebContentsImpl* web_contents_impl = |
| 1234 static_cast<WebContentsImpl*>(web_contents); |
| 1235 web_contents_impl->GetInputEventRouter()->RouteMouseEvent( |
| 1236 static_cast<RenderWidgetHostViewBase*>( |
| 1237 web_contents_impl->GetMainFrame()->GetView()), |
| 1238 event, ui::LatencyInfo()); |
| 1239 } |
| 1240 |
| 1192 #if defined(USE_AURA) | 1241 #if defined(USE_AURA) |
| 1193 void SendRoutedTouchTapSequence(content::WebContents* web_contents, | 1242 void SendRoutedTouchTapSequence(content::WebContents* web_contents, |
| 1194 gfx::Point point) { | 1243 gfx::Point point) { |
| 1195 RenderWidgetHostViewAura* rwhva = static_cast<RenderWidgetHostViewAura*>( | 1244 RenderWidgetHostViewAura* rwhva = static_cast<RenderWidgetHostViewAura*>( |
| 1196 web_contents->GetRenderWidgetHostView()); | 1245 web_contents->GetRenderWidgetHostView()); |
| 1197 ui::TouchEvent touch_start( | 1246 ui::TouchEvent touch_start( |
| 1198 ui::ET_TOUCH_PRESSED, point, base::TimeTicks::Now(), | 1247 ui::ET_TOUCH_PRESSED, point, base::TimeTicks::Now(), |
| 1199 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0)); | 1248 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0)); |
| 1200 rwhva->OnTouchEvent(&touch_start); | 1249 rwhva->OnTouchEvent(&touch_start); |
| 1201 ui::TouchEvent touch_end( | 1250 ui::TouchEvent touch_end( |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1960 bool user_gesture, | 2009 bool user_gesture, |
| 1961 bool last_unlocked_by_target, | 2010 bool last_unlocked_by_target, |
| 1962 bool privileged) { | 2011 bool privileged) { |
| 1963 IPC::IpcSecurityTestUtil::PwnMessageReceived( | 2012 IPC::IpcSecurityTestUtil::PwnMessageReceived( |
| 1964 process->GetChannel(), | 2013 process->GetChannel(), |
| 1965 ViewHostMsg_LockMouse(routing_id, user_gesture, last_unlocked_by_target, | 2014 ViewHostMsg_LockMouse(routing_id, user_gesture, last_unlocked_by_target, |
| 1966 privileged)); | 2015 privileged)); |
| 1967 } | 2016 } |
| 1968 | 2017 |
| 1969 } // namespace content | 2018 } // namespace content |
| OLD | NEW |