Added documentation to web_view.js/web_view_experimental.js regarding the webview...
[chromium-blink-merge.git] / chrome / renderer / chrome_render_frame_observer.cc
blob09375b3190bce359bb2f0c7ade76ea48117aa652
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/chrome_render_frame_observer.h"
7 #include "chrome/common/prerender_messages.h"
8 #include "chrome/renderer/prerender/prerender_helper.h"
10 ChromeRenderFrameObserver::ChromeRenderFrameObserver(
11 content::RenderFrame* render_frame)
12 : content::RenderFrameObserver(render_frame) {
15 ChromeRenderFrameObserver::~ChromeRenderFrameObserver() {
18 bool ChromeRenderFrameObserver::OnMessageReceived(const IPC::Message& message) {
19 // Filter only.
20 IPC_BEGIN_MESSAGE_MAP(ChromeRenderFrameObserver, message)
21 IPC_MESSAGE_HANDLER(PrerenderMsg_SetIsPrerendering, OnSetIsPrerendering);
22 IPC_END_MESSAGE_MAP()
24 return false;
27 void ChromeRenderFrameObserver::OnSetIsPrerendering(bool is_prerendering) {
28 if (is_prerendering) {
29 // If the PrerenderHelper for this frame already exists, don't create it. It
30 // can already be created for subframes during handling of
31 // RenderFrameCreated, if the parent frame was prerendering at time of
32 // subframe creation.
33 if (prerender::PrerenderHelper::Get(render_frame()))
34 return;
36 // The PrerenderHelper will destroy itself either after recording histograms
37 // or on destruction of the RenderView.
38 new prerender::PrerenderHelper(render_frame());