forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcast_media_load_deferrer.h
35 lines (26 loc) · 1.09 KB
/
cast_media_load_deferrer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_RENDERER_CAST_MEDIA_LOAD_DEFERRER_H_
#define CHROMECAST_RENDERER_CAST_MEDIA_LOAD_DEFERRER_H_
#include "base/callback.h"
#include "base/macros.h"
#include "content/public/renderer/render_frame_observer.h"
namespace chromecast {
// Defers media player loading in background web apps until brought into
// foreground.
class CastMediaLoadDeferrer : public content::RenderFrameObserver {
public:
// Will run |closure| to continue loading the media resource once the page is
// swapped in.
CastMediaLoadDeferrer(content::RenderFrame* render_frame,
const base::Closure& continue_loading_cb);
~CastMediaLoadDeferrer() override;
private:
// content::RenderFrameObserver implementation:
void WasShown() override;
base::Closure continue_loading_cb_;
DISALLOW_COPY_AND_ASSIGN(CastMediaLoadDeferrer);
};
} // namespace chromecast
#endif // CHROMECAST_RENDERER_CAST_MEDIA_LOAD_DEFERRER_H_