18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 2231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Copyright (C) 2009 Apple Inc. All Rights Reserved. 38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met: 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1. Redistributions of source code must retain the above copyright 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer. 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer in the 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * documentation and/or other materials provided with the distribution. 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 13231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * 258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 27231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef BeforeLoadEvent_h 28231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#define BeforeLoadEvent_h 29231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 30231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "Event.h" 3165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch#include "EventNames.h" 32231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 33231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blocknamespace WebCore { 34231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 35231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockclass BeforeLoadEvent : public Event { 36231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockpublic: 37cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block virtual bool isBeforeLoadEvent() const { return true; } 38cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 39231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block static PassRefPtr<BeforeLoadEvent> create(const String& url) 40231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { 41231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return adoptRef(new BeforeLoadEvent(url)); 42231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 43231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 44231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block void initBeforeLoadEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& url) 45231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { 46231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (dispatched()) 47231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return; 48231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 49231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block initEvent(type, canBubble, cancelable); 50231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 51231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block m_url = url; 52231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 53231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 54231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const String& url() const { return m_url; } 55231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 56231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockprivate: 57231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block BeforeLoadEvent(const String& url) 58231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block : Event(eventNames().beforeloadEvent, false, true) 59231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_url(url) 60231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block {} 61231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 62231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block String m_url; 63231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block}; 648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 65231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} // namespace WebCore 668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 67231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif // BeforeLoadEvent_h 68