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_view_observer.h"
13 // Defers media player loading in prerendered pages until the prerendered page
15 class PrerenderMediaLoadDeferrer
: public content::RenderViewObserver
{
17 // Will run |closure| to continue loading the media resource once the page is
19 PrerenderMediaLoadDeferrer(content::RenderView
* render_view
,
20 const base::Closure
& closure
);
21 virtual ~PrerenderMediaLoadDeferrer();
24 // RenderViewObserver method:
25 virtual 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_