Index: chrome/renderer/prerender/prerenderer_client.cc |
diff --git a/chrome/renderer/prerender/prerenderer_client.cc b/chrome/renderer/prerender/prerenderer_client.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f0b958f7b84435acf8e359d8ea870c84716900b0 |
--- /dev/null |
+++ b/chrome/renderer/prerender/prerenderer_client.cc |
@@ -0,0 +1,38 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/renderer/prerender/prerenderer_client.h" |
+ |
+#include "chrome/renderer/prerender/prerender_extra_data.h" |
+#include "content/public/renderer/render_view.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
+ |
+namespace { |
+ |
+int getNextPrerenderId() { |
+ static int nextPrerenderId = 1; |
+ return nextPrerenderId++; |
+} |
+ |
+} |
+ |
+namespace prerender { |
+ |
+PrerendererClient::PrerendererClient(content::RenderView* render_view) |
+ : content::RenderViewObserver(render_view) { |
+ DVLOG(5) << "PrerendererClient::PrerendererClient()"; |
+ if (render_view) // NULL in unit tests. |
+ render_view->GetWebView()->setPrerendererClient(this); |
+} |
+ |
+void PrerendererClient::willAddPrerender( |
+ WebKit::WebPrerender* prerender) { |
+ DVLOG(3) << "PrerendererClient::willAddPrerender url = " |
+ << prerender->url().spec().data(); |
+ prerender->setExtraData(new PrerenderExtraData(getNextPrerenderId(), |
+ routing_id(), |
+ render_view()->GetSize())); |
+} |
+ |
+} |