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. 4 5 #include "chrome/renderer/prerender/prerenderer_client.h" 6 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" 11 12 namespace { 13 static int s_last_prerender_id = 0; 14 } 15 16 namespace prerender { 17 18 PrerendererClient::PrerendererClient(content::RenderView* render_view) 19 : content::RenderViewObserver(render_view) { 20 DCHECK(render_view); 21 DVLOG(5) << "PrerendererClient::PrerendererClient()"; 22 render_view->GetWebView()->setPrerendererClient(this); 23 } 24 25 PrerendererClient::~PrerendererClient() { 26 } 27 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, 33 routing_id(), 34 render_view()->GetSize())); 35 } 36 37 } // namespace prerender 38 39