106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen/* 206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * Copyright (C) 2010 Google Inc. All rights reserved. 306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * 406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * Redistribution and use in source and binary forms, with or without 506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * modification, are permitted provided that the following conditions 606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * are met: 706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * 806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * 1. Redistributions of source code must retain the above copyright 906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * notice, this list of conditions and the following disclaimer. 1006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * 2. Redistributions in binary form must reproduce the above copyright 1106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * notice, this list of conditions and the following disclaimer in the 1206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * documentation and/or other materials provided with the distribution. 1306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * 3. Neither the name of Google, Inc. nor the names of 1406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * its contributors may be used to endorse or promote products derived 1506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * from this software without specific prior written permission. 1606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * 1706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 1806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 1906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 2006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 2106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 2206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 2306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 2406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen */ 2806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 2906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen#ifndef FrameLoaderStateMachine_h 3006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen#define FrameLoaderStateMachine_h 3106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 3206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen#include <wtf/Noncopyable.h> 3306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 3406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsennamespace WebCore { 3506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 3606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen// Encapsulates a state machine for FrameLoader. Note that this is different from FrameState, 3706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen// which stores the state of the current load that FrameLoader is executing. 38ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdochclass FrameLoaderStateMachine { 39ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch WTF_MAKE_NONCOPYABLE(FrameLoaderStateMachine); 4006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsenpublic: 4106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen FrameLoaderStateMachine(); 4206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 4306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen // Once a load has been committed, the state may 4406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen // alternate between CommittedFirstRealLoad and FirstLayoutDone. 4506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen // Otherwise, the states only go down the list. 4606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen enum State { 4706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen Uninitialized, 4806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen CreatingInitialEmptyDocument, 4906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen DisplayingInitialEmptyDocument, 5006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen DisplayingInitialEmptyDocumentPostCommit, 5106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen CommittedFirstRealLoad, 5206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen FirstLayoutDone 5306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen }; 5406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 5506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen bool committingFirstRealLoad() const; 5606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen bool committedFirstRealDocumentLoad() const; 5706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen bool creatingInitialEmptyDocument() const; 5806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen bool isDisplayingInitialEmptyDocument() const; 5906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen bool firstLayoutDone() const; 6006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen void advanceTo(State); 6106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 6206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsenprivate: 6306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen State m_state; 6406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen}; 6506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 6606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen} // namespace WebCore 6706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 6806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen#endif // FrameLoaderStateMachine_h 69