[Eraser strings] Remove unused Supervised User infobar and corresponding strings
[chromium-blink-merge.git] / chrome / renderer / prerender / prerender_media_load_deferrer.cc
blob93bea76626f7593bb0c37fa54bf6654e7690d723
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 #include "chrome/renderer/prerender/prerender_media_load_deferrer.h"
7 #include "base/callback_helpers.h"
8 #include "chrome/common/prerender_messages.h"
10 namespace prerender {
12 PrerenderMediaLoadDeferrer::PrerenderMediaLoadDeferrer(
13 content::RenderFrame* render_frame,
14 const base::Closure& closure)
15 : RenderFrameObserver(render_frame),
16 is_prerendering_(true),
17 continue_loading_cb_(closure) {
18 DCHECK(!continue_loading_cb_.is_null());
21 PrerenderMediaLoadDeferrer::~PrerenderMediaLoadDeferrer() {}
23 bool PrerenderMediaLoadDeferrer::OnMessageReceived(
24 const IPC::Message& message) {
25 IPC_BEGIN_MESSAGE_MAP(PrerenderMediaLoadDeferrer, message)
26 IPC_MESSAGE_HANDLER(PrerenderMsg_SetIsPrerendering, OnSetIsPrerendering)
27 IPC_END_MESSAGE_MAP()
29 return false;
32 void PrerenderMediaLoadDeferrer::OnSetIsPrerendering(bool is_prerendering) {
33 // Prerendering can only be enabled prior to a RenderFrame's first
34 // navigation, so no PrerenderMediaLoadDeferrer should see the notification
35 // that enables prerendering.
36 DCHECK(!is_prerendering);
37 if (!is_prerendering_ || is_prerendering)
38 return;
40 is_prerendering_ = false;
41 base::ResetAndReturn(&continue_loading_cb_).Run();
44 } // namespace prerender