refactor: eliminate duplicate code (#29174)
This commit is contained in:
parent
6330f8be9f
commit
241cceb2c9
10 changed files with 66 additions and 151 deletions
|
@ -2217,10 +2217,8 @@ void WebContents::EnableDeviceEmulation(
|
|||
DCHECK(web_contents());
|
||||
auto* frame_host = web_contents()->GetMainFrame();
|
||||
if (frame_host) {
|
||||
auto* widget_host_impl =
|
||||
frame_host ? static_cast<content::RenderWidgetHostImpl*>(
|
||||
frame_host->GetView()->GetRenderWidgetHost())
|
||||
: nullptr;
|
||||
auto* widget_host_impl = static_cast<content::RenderWidgetHostImpl*>(
|
||||
frame_host->GetView()->GetRenderWidgetHost());
|
||||
if (widget_host_impl) {
|
||||
auto& frame_widget = widget_host_impl->GetAssociatedFrameWidget();
|
||||
frame_widget->EnableDeviceEmulation(params);
|
||||
|
@ -2235,10 +2233,8 @@ void WebContents::DisableDeviceEmulation() {
|
|||
DCHECK(web_contents());
|
||||
auto* frame_host = web_contents()->GetMainFrame();
|
||||
if (frame_host) {
|
||||
auto* widget_host_impl =
|
||||
frame_host ? static_cast<content::RenderWidgetHostImpl*>(
|
||||
frame_host->GetView()->GetRenderWidgetHost())
|
||||
: nullptr;
|
||||
auto* widget_host_impl = static_cast<content::RenderWidgetHostImpl*>(
|
||||
frame_host->GetView()->GetRenderWidgetHost());
|
||||
if (widget_host_impl) {
|
||||
auto& frame_widget = widget_host_impl->GetAssociatedFrameWidget();
|
||||
frame_widget->DisableDeviceEmulation();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue