2 * Copyright 2006, The Android Open Source Project
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // TODO: change name to WebFrame.h
31 #include "FrameLoaderClient.h"
32 #include "PlatformString.h"
33 #include "WebCoreRefObject.h"
42 class ResourceRequest;
47 class WebCoreResourceLoader;
50 // one instance of WebFrame per Page for calling into Java's BrowserFrame
51 class WebFrame : public WebCoreRefObject {
53 // these ids need to be in sync with the constants in BrowserFrame.java
58 WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page* page);
62 static WebFrame* getWebFrame(const WebCore::Frame* frame);
64 virtual WebCoreResourceLoader* startLoadingResource(WebCore::ResourceHandle*,
65 const WebCore::ResourceRequest& request,
68 void reportError(int errorCode, const WebCore::String& description,
69 const WebCore::String& failingUrl);
71 void loadStarted(WebCore::Frame* frame);
73 void transitionToCommitted(WebCore::Frame* frame);
75 void didFinishLoad(WebCore::Frame* frame);
77 void addHistoryItem(WebCore::HistoryItem* item);
79 void removeHistoryItem(int index);
81 void updateHistoryIndex(int newIndex);
83 void setTitle(const WebCore::String& title);
85 void windowObjectCleared(WebCore::Frame* frame);
87 void setProgress(float newProgress);
89 const WebCore::String userAgentForURL(const WebCore::KURL* url);
91 void didReceiveIcon(WebCore::Image* icon);
93 void updateVisitedHistory(const WebCore::KURL& url, bool reload);
95 virtual bool canHandleRequest(const WebCore::ResourceRequest& request);
97 WebCore::Frame* createWindow(bool dialog, bool userGesture);
99 void requestFocus() const;
101 void closeWindow(WebViewCore* webViewCore);
103 void decidePolicyForFormResubmission(WebCore::FramePolicyFunction func);
105 void setUserAgent(WebCore::String userAgent) { mUserAgent = userAgent; }
107 WebCore::String getRawResourceFilename(RAW_RES_ID) const;
110 * When the user initiates a click (via trackball, enter-press, or touch),
111 * we set mUserInitiatedClick to true. If a load happens due to this click,
112 * then we ask the application if it wants to override
113 * the load. Otherwise, we attempt to load the resource internally.
114 * We also check it to determine whether or not to allow webkit to request
115 * a scroll. If it was user initated, the scroll is allowed.
117 void setUserInitiatedClick(bool userInitiatedClick) { mUserInitiatedClick = userInitiatedClick; }
119 bool userInitiatedClick() { return mUserInitiatedClick; }
121 WebCore::Page* page() const { return mPage; }
124 struct JavaBrowserFrame;
125 JavaBrowserFrame* mJavaFrame;
126 WebCore::Page* mPage;
127 WebCore::String mUserAgent;
128 bool mUserInitiatedClick;
131 } // namespace android