REVIEW: remove device emulation ipc dependecny on rvh

This commit is contained in:
deepak1556 2017-12-30 21:55:09 +05:30 committed by Aleksei Kuzmin
parent 5684f8886f
commit 719980a948
4 changed files with 20 additions and 15 deletions

View file

@ -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() {

View file

@ -7,6 +7,7 @@
#include <vector>
#include "atom/common/native_mate_converters/string16_converter.h"
#include "native_mate/converter.h"
namespace mate {

View file

@ -7,8 +7,6 @@
#include <string>
#include <vector>
// Put this before event_emitter_caller.h to have string16 support.
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/api/event_emitter_caller.h"
#include "atom/common/native_mate_converters/value_converter.h"

View file

@ -92,9 +92,7 @@ describe('webContents module', () => {
})
})
// TODO(alexeykuzmin): Disabled during Ch63 upgrade.
// Fix it and enable back.
xdescribe('setDevToolsWebCotnents() API', () => {
describe('setDevToolsWebCotnents() API', () => {
it('sets arbitry webContents as devtools', (done) => {
let devtools = new BrowserWindow({show: false})
devtools.webContents.once('dom-ready', () => {