Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / exported / WebPrerender.cpp
blob0bb18a554627921c92294596dbcdd622aa515007
1 /*
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
6 * met:
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
13 * distribution.
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.
31 #include "config.h"
32 #include "public/platform/WebPrerender.h"
34 #include "platform/Prerender.h"
35 #include "wtf/PassRefPtr.h"
37 namespace blink {
39 namespace {
41 class ExtraDataContainer : public Prerender::ExtraData {
42 public:
43 static PassRefPtr<ExtraDataContainer> create(WebPrerender::ExtraData* extraData) { return adoptRef(new ExtraDataContainer(extraData)); }
45 ~ExtraDataContainer() override {}
47 WebPrerender::ExtraData* extraData() const { return m_extraData.get(); }
49 private:
50 explicit ExtraDataContainer(WebPrerender::ExtraData* extraData)
51 : m_extraData(adoptPtr(extraData))
55 OwnPtr<WebPrerender::ExtraData> m_extraData;
58 } // anon namespace
60 WebPrerender::WebPrerender(PassRefPtr<Prerender> prerender)
61 : m_private(prerender)
65 const Prerender* WebPrerender::toPrerender() const
67 return m_private.get();
70 void WebPrerender::reset()
72 m_private.reset();
75 void WebPrerender::assign(const WebPrerender& other)
77 m_private = other.m_private;
80 bool WebPrerender::isNull() const
82 return m_private.isNull();
85 WebURL WebPrerender::url() const
87 return WebURL(m_private->url());
90 unsigned WebPrerender::relTypes() const
92 return m_private->relTypes();
95 WebString WebPrerender::referrer() const
97 return m_private->referrer();
100 WebReferrerPolicy WebPrerender::referrerPolicy() const
102 return static_cast<WebReferrerPolicy>(m_private->referrerPolicy());
105 void WebPrerender::setExtraData(WebPrerender::ExtraData* extraData)
107 m_private->setExtraData(ExtraDataContainer::create(extraData));
110 const WebPrerender::ExtraData* WebPrerender::extraData() const
112 RefPtr<Prerender::ExtraData> webcoreExtraData = m_private->extraData();
113 if (!webcoreExtraData)
114 return 0;
115 return static_cast<ExtraDataContainer*>(webcoreExtraData.get())->extraData();
118 void WebPrerender::didStartPrerender()
120 m_private->didStartPrerender();
123 void WebPrerender::didStopPrerender()
125 m_private->didStopPrerender();
128 void WebPrerender::didSendLoadForPrerender()
130 m_private->didSendLoadForPrerender();
133 void WebPrerender::didSendDOMContentLoadedForPrerender()
135 m_private->didSendDOMContentLoadedForPrerender();
138 } // namespace blink