Skip to content

Commit

Permalink
chore: fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Aug 11, 2020
1 parent 2547404 commit 7cec63a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
26 changes: 12 additions & 14 deletions shell/browser/api/electron_api_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1763,13 +1763,12 @@ void WebContents::EnableDeviceEmulation(

auto* frame_host = web_contents()->GetMainFrame();
if (frame_host) {
auto* widget_host =
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
if (widget_host) {
auto* impl = content::RenderWidgetHostImpl::FromID(
widget_host->GetProcess()->GetID(), widget_host->GetRoutingID());

auto& frame_widget = impl->GetAssociatedFrameWidget();
auto* widget_host_impl =
frame_host ? static_cast<content::RenderWidgetHostImpl*>(
frame_host->GetView()->GetRenderWidgetHost())
: nullptr;
if (widget_host_impl) {
auto& frame_widget = widget_host_impl->GetAssociatedFrameWidget();
frame_widget->EnableDeviceEmulation(params);
}
}
Expand All @@ -1781,13 +1780,12 @@ void WebContents::DisableDeviceEmulation() {

auto* frame_host = web_contents()->GetMainFrame();
if (frame_host) {
auto* widget_host =
frame_host ? frame_host->GetView()->GetRenderWidgetHost() : nullptr;
if (widget_host) {
auto* impl = content::RenderWidgetHostImpl::FromID(
widget_host->GetProcess()->GetID(), widget_host->GetRoutingID());

auto& frame_widget = impl->GetAssociatedFrameWidget();
auto* widget_host_impl =
frame_host ? static_cast<content::RenderWidgetHostImpl*>(
frame_host->GetView()->GetRenderWidgetHost())
: nullptr;
if (widget_host_impl) {
auto& frame_widget = widget_host_impl->GetAssociatedFrameWidget();
frame_widget->DisableDeviceEmulation();
}
}
Expand Down
8 changes: 3 additions & 5 deletions shell/browser/ui/x/window_state_watcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ void WindowStateWatcher::DidProcessXEvent(x11::Event* x11_event) {
}

bool WindowStateWatcher::IsWindowStateEvent(x11::Event* x11_event) const {
return (x11_event->As<x11::PropertyNotifyEvent>() &&
x11_event->As<x11::PropertyNotifyEvent>()->atom ==
window_state_atom_ &&
static_cast<uint32_t>(
x11_event->As<x11::PropertyNotifyEvent>()->window) == widget_);
auto* property = x11_event->As<x11::PropertyNotifyEvent>();
return (property && property->atom == window_state_atom_ &&
static_cast<uint32_t>(property->window) == widget_);
}

} // namespace electron

0 comments on commit 7cec63a

Please sign in to comment.