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
59 WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page* page);
63 static WebFrame* getWebFrame(const WebCore::Frame* frame);
65 virtual WebCoreResourceLoader* startLoadingResource(WebCore::ResourceHandle*,
66 const WebCore::ResourceRequest& request,
69 void reportError(int errorCode, const WebCore::String& description,
70 const WebCore::String& failingUrl);
72 void loadStarted(WebCore::Frame* frame);
74 void transitionToCommitted(WebCore::Frame* frame);
76 void didFinishLoad(WebCore::Frame* frame);
78 void addHistoryItem(WebCore::HistoryItem* item);
80 void removeHistoryItem(int index);
82 void updateHistoryIndex(int newIndex);
84 void setTitle(const WebCore::String& title);
86 void windowObjectCleared(WebCore::Frame* frame);
88 void setProgress(float newProgress);
90 const WebCore::String userAgentForURL(const WebCore::KURL* url);
92 void didReceiveIcon(WebCore::Image* icon);
94 void didReceiveTouchIconURL(const WebCore::String& url);
96 void updateVisitedHistory(const WebCore::KURL& url, bool reload);
98 virtual bool canHandleRequest(const WebCore::ResourceRequest& request);
100 WebCore::Frame* createWindow(bool dialog, bool userGesture);
102 void requestFocus() const;
104 void closeWindow(WebViewCore* webViewCore);
106 void decidePolicyForFormResubmission(WebCore::FramePolicyFunction func);
108 void setUserAgent(WebCore::String userAgent) { mUserAgent = userAgent; }
110 WebCore::String getRawResourceFilename(RAW_RES_ID) const;
113 * When the user initiates a click (via trackball, enter-press, or touch),
114 * we set mUserInitiatedClick to true. If a load happens due to this click,
115 * then we ask the application if it wants to override
116 * the load. Otherwise, we attempt to load the resource internally.
117 * We also check it to determine whether or not to allow webkit to request
118 * a scroll. If it was user initated, the scroll is allowed.
120 void setUserInitiatedClick(bool userInitiatedClick) { mUserInitiatedClick = userInitiatedClick; }
122 bool userInitiatedClick() { return mUserInitiatedClick; }
124 WebCore::Page* page() const { return mPage; }
127 struct JavaBrowserFrame;
128 JavaBrowserFrame* mJavaFrame;
129 WebCore::Page* mPage;
130 WebCore::String mUserAgent;
131 bool mUserInitiatedClick;
134 } // namespace android