diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index a2851415d198..db7b1d5ca1fc 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -8,7 +8,6 @@ #include "atom/browser/api/atom_api_web_contents.h" #include "atom/browser/browser.h" #include "atom/browser/native_window.h" -#include "atom/common/node_includes.h" #include "atom/common/native_mate_converters/blink_converter.h" #include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/gfx_converter.h" diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 55fe206ff18f..809545255498 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -107,9 +107,8 @@ NativeWindow* NativeWindow::FromWebContents( content::WebContents* web_contents) { WindowList& window_list = *WindowList::GetInstance(); for (NativeWindow* window : window_list) { - if (window->web_contents() == web_contents){ + if (window->web_contents() == web_contents) return window; - } } return nullptr; } @@ -290,16 +289,12 @@ void NativeWindow::SetAspectRatio(double aspect_ratio, void NativeWindow::SetFrameSubscription(bool isOffscreen) { const auto view = web_contents()->GetRenderWidgetHostView(); - if (view) { if (isOffscreen) { scoped_ptr subscriber( new RenderSubscriber( view->GetVisibleViewportSize(), - base::Bind(&NativeWindow::OnFrameReceived, base::Unretained(this)) - ) - ); - + base::Bind(&NativeWindow::OnFrameReceived, base::Unretained(this)))); view->BeginFrameSubscription(subscriber.Pass()); } else { view->EndFrameSubscription(); @@ -593,7 +588,8 @@ bool RenderSubscriber::ShouldCaptureFrame( gfx::Rect(size_), size_, base::TimeDelta()); - *callback = base::Bind(&RenderSubscriber::CallbackMethod, callback_, *storage); + *callback = + base::Bind(&RenderSubscriber::CallbackMethod, callback_, *storage); return true; } diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 1eabd5e693d1..3344cfb65c32 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -313,10 +313,14 @@ class NativeWindow : public content::WebContentsObserver, DISALLOW_COPY_AND_ASSIGN(NativeWindow); }; -//This class provides a way to listen to frame renders and to use the rendered frames for offscreen rendering +// This class provides a way to listen to frame renders and to use the rendered +// frames for offscreen rendering class RenderSubscriber : public content::RenderWidgetHostViewFrameSubscriber { public: - RenderSubscriber(gfx::Size size, base::Callback)> callback) : size_(size), callback_(callback) {} + RenderSubscriber( + gfx::Size size, + base::Callback)> callback) + : size_(size), callback_(callback) {} bool ShouldCaptureFrame(const gfx::Rect& damage_rect, base::TimeTicks present_time, @@ -325,10 +329,11 @@ class RenderSubscriber : public content::RenderWidgetHostViewFrameSubscriber { base::TimeTicks last_present_time() const { return last_present_time_; } - static void CallbackMethod(base::Callback)> callback, - scoped_refptr frame, - base::TimeTicks present_time, - bool success) { + static void CallbackMethod( + base::Callback)> callback, + scoped_refptr frame, + base::TimeTicks present_time, + bool success) { callback.Run(success, frame); }