/*
 * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer. 
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution. 
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 *     its contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission. 
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

@class DumpRenderTreeDraggingInfo;
@class NavigationController;
@class WebFrame;
@class WebScriptObject;
@class WebView;

extern BOOL windowIsKey;
extern WebFrame *mainFrame;
extern DumpRenderTreeDraggingInfo *draggingInfo;
extern volatile BOOL done;
extern BOOL shouldDumpResourceLoadCallbacks;
extern BOOL shouldDumpFrameLoadCallbacks;
extern BOOL dumpTitleChanges;
extern NSMutableSet *disallowedURLs;
extern BOOL waitToDump;
extern BOOL canOpenWindows;
extern BOOL closeWebViews;
extern BOOL addFileToPasteboardOnDrag;
extern NSMutableArray *workQueue;
extern WebFrame *topLoadingFrame;
extern BOOL workQueueFrozen;
extern NavigationController *navigationController;

WebView *createWebView();
void dump(void);

@interface LayoutTestController : NSObject
{
    WebScriptObject *storedWebScriptObject;
}
- (void)dealloc;
@end

