1 // Copyright 2013 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 CHROME_RENDERER_PRERENDER_PRERENDER_MEDIA_LOAD_DEFERRER_H_
6 #define CHROME_RENDERER_PRERENDER_PRERENDER_MEDIA_LOAD_DEFERRER_H_
8 #include "base/callback.h"
9 #include "content/public/renderer/render_frame_observer.h"
13 // Defers media player loading in prerendered pages until the prerendered page
15 class PrerenderMediaLoadDeferrer
: public content::RenderFrameObserver
{
17 // Will run |closure| to continue loading the media resource once the page is
19 PrerenderMediaLoadDeferrer(content::RenderFrame
* render_frame
,
20 const base::Closure
& closure
);
21 ~PrerenderMediaLoadDeferrer() override
;
24 // RenderFrameObserver method:
25 bool OnMessageReceived(const IPC::Message
& message
) override
;
27 void OnSetIsPrerendering(bool is_prerendering
);
29 bool is_prerendering_
;
30 base::Closure continue_loading_cb_
;
32 DISALLOW_COPY_AND_ASSIGN(PrerenderMediaLoadDeferrer
);
35 } // namespace prerender
37 #endif // CHROME_RENDERER_PRERENDER_PRERENDER_MEDIA_LOAD_DEFERRER_H_