1 // Copyright (c) 2012 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/prerenderer_client.h"
7 #include "base/logging.h"
8 #include "chrome/renderer/prerender/prerender_extra_data.h"
9 #include "content/public/renderer/render_view.h"
10 #include "third_party/WebKit/public/web/WebView.h"
13 static int s_last_prerender_id
= 0;
18 PrerendererClient::PrerendererClient(content::RenderView
* render_view
)
19 : content::RenderViewObserver(render_view
) {
21 DVLOG(5) << "PrerendererClient::PrerendererClient()";
22 render_view
->GetWebView()->setPrerendererClient(this);
25 PrerendererClient::~PrerendererClient() {
28 void PrerendererClient::willAddPrerender(
29 blink::WebPrerender
* prerender
) {
30 DVLOG(3) << "PrerendererClient::willAddPrerender url = "
31 << prerender
->url().spec().data();
32 prerender
->setExtraData(new PrerenderExtraData(++s_last_prerender_id
,
34 render_view()->GetSize()));
37 } // namespace prerender