1 // Copyright (c) 2011 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_HELPER_H_
6 #define CHROME_RENDERER_PRERENDER_PRERENDER_HELPER_H_
8 #include "base/compiler_specific.h"
9 #include "base/time/time.h"
10 #include "content/public/renderer/render_frame_observer.h"
11 #include "content/public/renderer/render_frame_observer_tracker.h"
15 // Helper class to track whether its RenderFrame is currently being prerendered.
16 // Created when prerendering starts and deleted as soon as it stops.
18 : public content::RenderFrameObserver
,
19 public content::RenderFrameObserverTracker
<PrerenderHelper
> {
21 explicit PrerenderHelper(content::RenderFrame
* render_frame
);
22 ~PrerenderHelper() override
;
24 // Returns true if |render_view| is currently prerendering.
25 static bool IsPrerendering(const content::RenderFrame
* render_frame
);
28 // RenderViewObserver implementation
29 bool OnMessageReceived(const IPC::Message
& message
) override
;
31 void OnSetIsPrerendering(bool is_prerendering
);
33 DISALLOW_COPY_AND_ASSIGN(PrerenderHelper
);
36 } // namespace prerender
38 #endif // CHROME_RENDERER_PRERENDER_PRERENDER_HELPER_H_