[Android] Added UMA for search by image context menu.
[chromium-blink-merge.git] / chrome / renderer / prerender / prerender_media_load_deferrer.h
blob2c0f4aa03ff72f659a0b18a1f43076b1a60e4dad
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"
11 namespace prerender {
13 // Defers media player loading in prerendered pages until the prerendered page
14 // is swapped in.
15 class PrerenderMediaLoadDeferrer : public content::RenderViewObserver {
16 public:
17 // Will run |closure| to continue loading the media resource once the page is
18 // swapped in.
19 PrerenderMediaLoadDeferrer(content::RenderView* render_view,
20 const base::Closure& closure);
21 virtual ~PrerenderMediaLoadDeferrer();
23 private:
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_