1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROMECAST_RENDERER_CAST_MEDIA_LOAD_DEFERRER_H_
6 #define CHROMECAST_RENDERER_CAST_MEDIA_LOAD_DEFERRER_H_
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "content/public/renderer/render_frame_observer.h"
12 namespace chromecast
{
14 // Defers media player loading in background web apps until brought into
16 class CastMediaLoadDeferrer
: public content::RenderFrameObserver
{
18 // Will run |closure| to continue loading the media resource once the page is
20 CastMediaLoadDeferrer(content::RenderFrame
* render_frame
,
21 const base::Closure
& continue_loading_cb
);
22 ~CastMediaLoadDeferrer() override
;
25 // content::RenderFrameObserver implementation:
26 void WasShown() override
;
28 base::Closure continue_loading_cb_
;
30 DISALLOW_COPY_AND_ASSIGN(CastMediaLoadDeferrer
);
33 } // namespace chromecast
35 #endif // CHROMECAST_RENDERER_CAST_MEDIA_LOAD_DEFERRER_H_