Update CrOS OOBE throbber to MD throbber; delete old asset
[chromium-blink-merge.git] / chrome / renderer / prerender / prerender_dispatcher.h
blob52038f10844e402991e809cf24e40a2a0aa5f613
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 #ifndef CHROME_RENDERER_PRERENDER_PRERENDER_DISPATCHER_H_
6 #define CHROME_RENDERER_PRERENDER_PRERENDER_DISPATCHER_H_
8 #include <map>
9 #include <set>
10 #include <vector>
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "content/public/renderer/render_process_observer.h"
15 #include "third_party/WebKit/public/platform/WebPrerender.h"
16 #include "third_party/WebKit/public/platform/WebPrerenderingSupport.h"
18 class GURL;
20 namespace prerender {
22 // There is one PrerenderDispatcher per render process. It keeps track of which
23 // prerenders were launched from this renderer, and ensures prerender navigation
24 // is triggered on navigation to those. It implements the prerendering interface
25 // supplied to WebKit.
26 class PrerenderDispatcher : public content::RenderProcessObserver,
27 public blink::WebPrerenderingSupport {
28 public:
29 PrerenderDispatcher();
30 ~PrerenderDispatcher() override;
32 bool IsPrerenderURL(const GURL& url) const;
34 private:
35 friend class PrerenderDispatcherTest;
37 // Message handlers for messages from the browser process.
38 void OnPrerenderStart(int prerender_id);
39 void OnPrerenderStopLoading(int prerender_id);
40 void OnPrerenderDomContentLoaded(int prerender_id);
41 void OnPrerenderAddAlias(const GURL& alias);
42 void OnPrerenderRemoveAliases(const std::vector<GURL>& aliases);
43 void OnPrerenderStop(int prerender_id);
45 // From RenderProcessObserver:
46 bool OnControlMessageReceived(const IPC::Message& message) override;
48 // From WebPrerenderingSupport:
49 void add(const blink::WebPrerender& prerender) override;
50 void cancel(const blink::WebPrerender& prerender) override;
51 void abandon(const blink::WebPrerender& prerender) override;
53 // From WebKit, prerender elements launched by renderers in our process.
54 std::map<int, blink::WebPrerender> prerenders_;
56 // From the browser process, which prerenders are running, indexed by URL.
57 // Updated by the browser processes as aliases are discovered.
58 std::multiset<GURL> running_prerender_urls_;
61 } // namespace prerender
63 #endif // CHROME_RENDERER_PRERENDER_PRERENDER_DISPATCHER_H_