2 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include "platform/Prerender.h"
35 #include "platform/PrerenderClient.h"
36 #include "public/platform/WebPrerender.h"
37 #include "public/platform/WebPrerenderingSupport.h"
41 PassRefPtr
<Prerender
> Prerender::create(PrerenderClient
* client
, const KURL
& url
, unsigned relTypes
, const Referrer
& referrer
)
43 return adoptRef(new Prerender(client
, url
, relTypes
, referrer
));
46 Prerender::Prerender(PrerenderClient
* client
, const KURL
& url
, const unsigned relTypes
, const Referrer
& referrer
)
49 , m_relTypes(relTypes
)
50 , m_referrer(referrer
)
54 Prerender::~Prerender()
58 void Prerender::removeClient()
65 if (WebPrerenderingSupport
* platform
= WebPrerenderingSupport::current())
66 platform
->add(WebPrerender(this));
69 void Prerender::cancel()
71 if (WebPrerenderingSupport
* platform
= WebPrerenderingSupport::current())
72 platform
->cancel(WebPrerender(this));
75 void Prerender::abandon()
77 if (WebPrerenderingSupport
* platform
= WebPrerenderingSupport::current())
78 platform
->abandon(WebPrerender(this));
81 void Prerender::didStartPrerender()
84 m_client
->didStartPrerender();
87 void Prerender::didStopPrerender()
90 m_client
->didStopPrerender();
93 void Prerender::didSendLoadForPrerender()
96 m_client
->didSendLoadForPrerender();
99 void Prerender::didSendDOMContentLoadedForPrerender()
102 m_client
->didSendDOMContentLoadedForPrerender();