Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3395)

Unified Diff: chrome/renderer/prefetch_helper.h

Issue 334483004: Enable resource prefetch from the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test per jochen's request Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/prefetch_helper.h
diff --git a/chrome/renderer/prefetch_helper.h b/chrome/renderer/prefetch_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..c2566348a4837dca57df882d5cf8177a5f36d013
--- /dev/null
+++ b/chrome/renderer/prefetch_helper.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_RENDERER_PREFETCH_HELPER_H_
+#define CHROME_RENDERER_PREFETCH_HELPER_H_
+
+#include <set>
+
+#include "content/public/renderer/render_frame_observer.h"
+#include "third_party/WebKit/public/platform/WebURLLoader.h"
+#include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
+#include "url/gurl.h"
+
+namespace prefetch {
+
+// Helper class initiating prefetches on behalf of a RenderFrame.
+class PrefetchHelper : public content::RenderFrameObserver,
+ public blink::WebURLLoaderClient {
+ public:
+ explicit PrefetchHelper(content::RenderFrame* render_frame);
+ virtual ~PrefetchHelper();
+
+ // blink::WebURLLoaderClient implementation
+ virtual void didFinishLoading(blink::WebURLLoader* loader,
+ double finishTime,
+ int64_t totalEncodedDataLength) OVERRIDE;
+ virtual void didFail(blink::WebURLLoader* loader,
+ const blink::WebURLError& error) OVERRIDE;
+
+ private:
+ // RenderViewObserver implementation
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ void OnPrefetch(const GURL& url);
+
+ std::set<blink::WebURLLoader*> loader_set_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrefetchHelper);
+};
+
+} // namespace prefetch
+
+#endif // CHROME_RENDERER_PREFETCH_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698