REVIEW: remove device emulation ipc dependecny on rvh
This commit is contained in:
parent
5684f8886f
commit
719980a948
4 changed files with 20 additions and 15 deletions
|
@ -65,8 +65,6 @@
|
|||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/plugin_service.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/browser/resource_request_details.h"
|
||||
|
@ -1278,20 +1276,30 @@ void WebContents::EnableDeviceEmulation(
|
|||
if (type_ == REMOTE)
|
||||
return;
|
||||
|
||||
auto host = web_contents()->GetRenderViewHost();
|
||||
|
||||
if (host)
|
||||
host->Send(new ViewMsg_EnableDeviceEmulation(host->GetRoutingID(), params));
|
||||
auto frame_host = web_contents()->GetMainFrame();
|
||||
if (frame_host) {
|
||||
auto widget_host =
|
||||
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
|
||||
if (!widget_host)
|
||||
return;
|
||||
widget_host->Send(
|
||||
new ViewMsg_EnableDeviceEmulation(widget_host->GetRoutingID(), params));
|
||||
}
|
||||
}
|
||||
|
||||
void WebContents::DisableDeviceEmulation() {
|
||||
if (type_ == REMOTE)
|
||||
return;
|
||||
|
||||
auto host = web_contents()->GetRenderViewHost();
|
||||
|
||||
if (host)
|
||||
host->Send(new ViewMsg_DisableDeviceEmulation(host->GetRoutingID()));
|
||||
auto frame_host = web_contents()->GetMainFrame();
|
||||
if (frame_host) {
|
||||
auto widget_host =
|
||||
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
|
||||
if (!widget_host)
|
||||
return;
|
||||
widget_host->Send(
|
||||
new ViewMsg_DisableDeviceEmulation(widget_host->GetRoutingID()));
|
||||
}
|
||||
}
|
||||
|
||||
void WebContents::ToggleDevTools() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue