Unregister from GCM when the only GCM app is removed
[chromium-blink-merge.git] / chrome / renderer / prefetch_helper.h
blobec44b7a7c0b6b9d77b95a579745cb8358cb45ad9
1 // Copyright (c) 2014 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 #ifndef CHROME_RENDERER_PREFETCH_HELPER_H_
6 #define CHROME_RENDERER_PREFETCH_HELPER_H_
8 #include <set>
10 #include "content/public/renderer/render_frame_observer.h"
11 #include "third_party/WebKit/public/platform/WebURLLoader.h"
12 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
13 #include "url/gurl.h"
15 namespace prefetch {
17 // Helper class initiating prefetches on behalf of a RenderFrame.
18 class PrefetchHelper : public content::RenderFrameObserver,
19 public blink::WebURLLoaderClient {
20 public:
21 explicit PrefetchHelper(content::RenderFrame* render_frame);
22 virtual ~PrefetchHelper();
24 // blink::WebURLLoaderClient implementation
25 virtual void didFinishLoading(blink::WebURLLoader* loader,
26 double finishTime,
27 int64_t totalEncodedDataLength) override;
28 virtual void didFail(blink::WebURLLoader* loader,
29 const blink::WebURLError& error) override;
31 private:
32 // RenderViewObserver implementation
33 bool OnMessageReceived(const IPC::Message& message) override;
35 void OnPrefetch(const GURL& url);
37 std::set<blink::WebURLLoader*> loader_set_;
39 DISALLOW_COPY_AND_ASSIGN(PrefetchHelper);
42 } // namespace prefetch
44 #endif // CHROME_RENDERER_PREFETCH_HELPER_H_