diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 9364f22aed35e1a1e9d07c121510f80be3ab0502 (patch) | |
tree | d49911209b132da58d838efa852daf28d516df21 /WebCore/page/android | |
parent | 87eb0cb35bad8784770ebc807e6c982432e47107 (diff) | |
download | external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.zip external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.gz external_webkit-9364f22aed35e1a1e9d07c121510f80be3ab0502.tar.bz2 |
Initial Contribution
Diffstat (limited to 'WebCore/page/android')
-rw-r--r-- | WebCore/page/android/DragControllerAndroid.cpp | 60 | ||||
-rw-r--r-- | WebCore/page/android/EventHandlerAndroid.cpp | 137 | ||||
-rw-r--r-- | WebCore/page/android/FrameAndroid.cpp | 301 | ||||
-rw-r--r-- | WebCore/page/android/FrameAndroid.h | 120 | ||||
-rw-r--r-- | WebCore/page/android/InspectorControllerAndroid.cpp | 77 |
5 files changed, 695 insertions, 0 deletions
diff --git a/WebCore/page/android/DragControllerAndroid.cpp b/WebCore/page/android/DragControllerAndroid.cpp new file mode 100644 index 0000000..a56411d --- /dev/null +++ b/WebCore/page/android/DragControllerAndroid.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2007 Apple 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR + * 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. + */ + +#include "config.h" +#include "DragController.h" + +#include "DragData.h" +#include "Frame.h" +#include "FrameView.h" +#include "Page.h" + +namespace WebCore { + +bool DragController::isCopyKeyDown() +{ + return false; +} + +DragOperation DragController::dragOperation(DragData* dragData) +{ + //FIXME: This logic is incomplete + ASSERT(0); + if (dragData->containsURL()) + return DragOperationCopy; + + return DragOperationNone; +} + +// functions new to Jun-07 tip of tree merge: +const float DragController::DragImageAlpha = 1.0f; +static IntSize dummy; +const IntSize& DragController::maxDragImageSize() { return dummy; } +const int DragController::DragIconRightInset = 0; +const int DragController::DragIconBottomInset = 0; +const int DragController::LinkDragBorderInset = 0; +const int DragController::MaxOriginalImageArea = 0; + +} diff --git a/WebCore/page/android/EventHandlerAndroid.cpp b/WebCore/page/android/EventHandlerAndroid.cpp new file mode 100644 index 0000000..ca74a79 --- /dev/null +++ b/WebCore/page/android/EventHandlerAndroid.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR + * 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. + */ + +#include "config.h" +#include "EventHandler.h" + +#include "EventNames.h" +#include "FloatPoint.h" +#include "FocusController.h" +#include "Frame.h" +#include "FrameView.h" +#include "KeyboardEvent.h" +#include "MouseEventWithHitTestResults.h" +#include "Page.h" +#include "PlatformScrollBar.h" +#include "PlatformWheelEvent.h" +#include "RenderWidget.h" + +#define LOG_TAG "WebCore" +#undef LOG +#include <utils/Log.h> + +namespace WebCore { + +using namespace EventNames; + +#define notImplemented() { LOGV("%s: Not Implemented", __FUNCTION__); } + +bool EventHandler::tabsToAllControls(KeyboardEvent* ) const +{ + return true; +} + +void EventHandler::focusDocumentView() +{ + if (Page* page = m_frame->page()) + page->focusController()->setFocusedFrame(m_frame); +} + +bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event) +{ + // Figure out which view to send the event to. + RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : 0; + if (!target || !target->isWidget()) + return false; + + return passMouseDownEventToWidget(static_cast<RenderWidget*>(target)->widget()); +} + +bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget) +{ + return passMouseDownEventToWidget(renderWidget->widget()); +} + +// This function is used to route the mouse down event to the native widgets, it seems like a +// work around for the Mac platform which does not support double clicks, but browsers do. +bool EventHandler::passMouseDownEventToWidget(Widget* widget) +{ + notImplemented(); + return false; +} + +bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const +{ + notImplemented(); + return false; +} + +// This function is called for mouse events by FrameView::handleMousePressEvent() +// It is used to ensure that events are sync. correctly between frames, for example +// if the user presses down in one frame and up in another frame, this function will +// return true if that is the case, and pass the event to the correct frame +bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& event, + Frame* subframe, HitTestResult* hoveredNode) +{ + notImplemented(); + return false; +} + +// This is called to route Wheel Events to child widgets when they are a RenderWidget +// as the parent usually gets Wheel Event. Don't have a mouse with a wheel to confirm +// the operation of this function. +bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& , Widget* widget) +{ + notImplemented(); + return false; +} + +bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) +{ + return passSubframeEventToSubframe(mev, subframe); +} + +bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, + Frame* subframe, HitTestResult* hoveredNode) +{ + return passSubframeEventToSubframe(mev, subframe); +} + +bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) +{ + return passSubframeEventToSubframe(mev, subframe); +} + +bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults&, PlatformScrollbar* scrollbar) +{ + notImplemented(); + return false; +} + +// functions new to Jun-07 tip of tree merge: +Clipboard* EventHandler::createDraggingClipboard() const { return NULL; } + + +} diff --git a/WebCore/page/android/FrameAndroid.cpp b/WebCore/page/android/FrameAndroid.cpp new file mode 100644 index 0000000..ca86bb5 --- /dev/null +++ b/WebCore/page/android/FrameAndroid.cpp @@ -0,0 +1,301 @@ +/* +** +** Copyright 2007, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +#include "config.h" +#include "FrameAndroid.h" + +#include <JavaScriptCore/bindings/runtime_root.h> +#include <JavaScriptCore/bindings/runtime_object.h> +#include <JavaScriptCore/bindings/jni/jni_utility.h> +#include "jni.h" +#include "kjs_proxy.h" +#include "kjs_window.h" + +#include "CacheBuilder.h" +#include "CachedImage.h" +#include "Document.h" +#include "EventNames.h" +#include "FrameLoader.h" +#include "FramePrivate.h" +#include "FrameView.h" +#include "HTMLAreaElement.h" +#include "HTMLImageElement.h" +#include "HTMLNames.h" +#include "Image.h" +#include "Page.h" +#include "PlatformKeyboardEvent.h" +#include "PlatformString.h" +#ifdef ANDROID_PLUGINS +#include "Plugin.h" +#include "PluginViewAndroid.h" +#endif +#include "RenderImage.h" +#include "RenderTable.h" +#include "RenderTextControl.h" +#include "RenderTheme.h" +#include "RenderView.h" +#include "RenderWidget.h" +#include "SelectionController.h" +#include "Settings.h" +#include "SkScalar.h" +#include "Text.h" +#include "WebCoreFrameBridge.h" +#include "WebCoreViewBridge.h" + +#define LOG_TAG "WebCore" +#undef LOG +#include <utils/Log.h> + +#ifdef ANDROID_INSTRUMENT +#include "CString.h" +#include "Cache.h" +#endif + +using KJS::JSLock; +using KJS::JSValue; + +namespace WebCore { + +#ifdef ANDROID_INSTRUMENT +// The following code should be inside Frame.cpp. But android LOG is conflict +// with webcore LOG +void Frame::resetTimeCounter() { + KJS::JSGlobalObject::resetTimeCounter(); + resetLayoutTimeCounter(); + resetPaintTimeCounter(); + resetCSSTimeCounter(); + resetParsingTimeCounter(); + resetCalculateStyleTimeCounter(); + resetFramebridgeTimeCounter(); + resetSharedTimerTimeCounter(); + resetResourceLoadTimeCounter(); + resetWebViewCoreTimeCounter(); + LOG(LOG_DEBUG, "WebCore", "*-* Start browser instrument\n"); +} + +void Frame::reportTimeCounter(String url, int total, int totalThreadTime) +{ + LOG(LOG_DEBUG, "WebCore", + "*-* Total load time: %d ms, thread time: %d ms for %s\n", + total, totalThreadTime, url.utf8().data()); + KJS::JSGlobalObject::reportTimeCounter(); + reportLayoutTimeCounter(); + reportPaintTimeCounter(); + reportCSSTimeCounter(); + reportParsingTimeCounter(); + reportCalculateStyleTimeCounter(); + reportFramebridgeTimeCounter(); + reportSharedTimerTimeCounter(); + reportResourceLoadTimeCounter(); + reportWebViewCoreTimeCounter(); + LOG(LOG_DEBUG, "WebCore", "Current cache has %d bytes live and %d bytes dead", cache()->getLiveSize(), cache()->getDeadSize()); +} +#endif + +#ifdef ANDROID_PLUGINS +KJS::Bindings::Instance* Frame::createScriptInstanceForWidget(Widget* widget) +{ + if (widget->isFrameView()) + return 0; + + return static_cast<PluginViewAndroid*>(widget)->bindingInstance(); +} +#endif + +FrameAndroid::FrameAndroid(Page* page, HTMLFrameOwnerElement* element, FrameLoaderClient* client) + : Frame(page, element, client), + m_bindingRoot(NULL), m_bridge(NULL) +{ +} + +FrameAndroid::~FrameAndroid() +{ + if (view() != NULL) + view()->getWebCoreViewBridge()->removeFrameGeneration(this); + Release(m_bridge); + setView(0); + loader()->clearRecordedFormValues(); +} + +void FrameAndroid::select(int selectionStart, int selectionEnd) +{ + if (selectionStart > selectionEnd) { + int temp = selectionStart; + selectionStart = selectionEnd; + selectionEnd = temp; + } + Document* doc = document(); + if (!doc) + return; + Node* focus = doc->focusedNode(); + if (!focus) + return; + RenderObject* renderer = focus->renderer(); + if (renderer && (renderer->isTextField() || renderer->isTextArea())) { + RenderTextControl* rtc = static_cast<RenderTextControl*>(renderer); + rtc->setSelectionRange(selectionStart, selectionEnd); + Frame::revealSelection(); + } +} + +void FrameAndroid::cleanupForFullLayout(RenderObject* obj) +{ + recursiveCleanupForFullLayout(obj); +} + +void FrameAndroid::recursiveCleanupForFullLayout(RenderObject* obj) +{ + obj->setNeedsLayout(true, false); +#ifdef ANDROID_LAYOUT + if (obj->isTable()) + (static_cast<RenderTable *>(obj))->clearSingleColumn(); +#endif + for (RenderObject* n = obj->firstChild(); n; n = n->nextSibling()) + recursiveCleanupForFullLayout(n); +} + +KJS::Bindings::RootObject* FrameAndroid::bindingRootObject() +{ + if (!m_bindingRoot) + m_bindingRoot = KJS::Bindings::RootObject::create(0, scriptProxy()->globalObject()); // The root gets deleted by JavaScriptCore. + ASSERT(settings()->isJavaScriptEnabled()); + // The root gets deleted by JavaScriptCore. + m_bindingRoot = KJS::Bindings::RootObject::create(0, scriptProxy()->globalObject()); + return m_bindingRoot.get(); +} + +/* +* This function provides the ability to add a Java class to Javascript and +* expose it through the Window object. +* The code to access the object would look something like: window.<objectName>.<class method> +*/ +void FrameAndroid::addJavascriptInterface(void *javaVM, void* objectInstance, const char* objectNameStr) +{ + // Obtain the window object from KJS + KJS::Bindings::RootObject *root = bindingRootObject(); + KJS::JSObject *rootObject = root->globalObject(); + KJS::ExecState *exec = root->globalObject()->globalExec(); + KJS::JSObject *window = rootObject->get(exec, KJS::Identifier("window"))->getObject(); + if (!window) { + LOGE("Warning: couldn't get window object"); + return; + } + + KJS::Bindings::setJavaVM((JavaVM*)javaVM); + + // Add the binding to JS environment + KJS::JSObject *addedObject = + KJS::Bindings::Instance::createRuntimeObject(KJS::Bindings::Instance::JavaLanguage, + (jobject)objectInstance, root); + + // Add the binding name to the window's table of child objects. + window->put(exec, KJS::Identifier(objectNameStr), addedObject); +} + +/* +* This function executes the provided javascript string in the context of +* the frame's document. The code is based on the implementation of the same +* function in WebCoreFrameBridge.mm +*/ +String FrameAndroid::stringByEvaluatingJavaScriptFromString(const char* script) +{ + ASSERT(document()); + JSValue* result = loader()->executeScript(String(script), true); + if (!result) + return String(); + JSLock lock; + // note: result->getString() returns a UString. + return String(result->isString() ? result->getString() : + result->toString(scriptProxy()->globalObject()->globalExec())); +} + +#if 0 // disabled for now by <reed> +// experimental function to allow portable code to query our bg-ness +bool android_should_draw_background(RenderObject* obj) +{ + Document* doc = obj->document(); + if (doc) { + Frame* frame = doc->frame(); + if (frame) { + Page* page = frame->page(); + if (page) { + frame = page->mainFrame(); + if (frame) { + return AsAndroidFrame(frame)->shouldDrawBackgroundPhase(); + } + } + } + } + return false; +} +#endif + +///////////////!!!!!!!!!!!! MUST COMPLETE THESE + +#define verifiedOk() { } // not a problem that it's not implemented + +// These two functions are called by JavaScript Window.focus() and Window.blur() methods. If +// a window has the window focus method called on it, it should be moved to the top of the +// browser window stack. If blur is called, it is moved to the bottom of the stack. +void FrameAndroid::focusWindow() { verifiedOk(); notImplemented(); } +void FrameAndroid::unfocusWindow() { verifiedOk(); notImplemented(); } + +// This function is called by JavaScript when window.print() is called. It would normally map +// straight to the menu print item. +// It is ok that we don't support this at this time. +void FrameAndroid::print() { verifiedOk(); } + +// These functions are used to interact with the platform's clipboard. It is ok that we don't +// support these at this time as we currently don't support sites that would use this +// functionality. +void FrameAndroid::issueCutCommand() { verifiedOk(); } +void FrameAndroid::issueCopyCommand() { verifiedOk(); } +void FrameAndroid::issuePasteCommand() { verifiedOk(); } +void FrameAndroid::issuePasteAndMatchStyleCommand() { verifiedOk(); } + +// This function seems to switch the two characters around the cursor. +// See WebHTMLView.mm:transpose. +// We are currently not implementing it. +void FrameAndroid::issueTransposeCommand() { verifiedOk(); } + +// These functions are called when JavaScript tries to access the script interface for +// these objects. For Object and Embed, the interface expected from the 'plugin' is +// well defined here: +// http://www.mozilla.org/projects/plugins/npruntime.html +KJS::Bindings::Instance* FrameAndroid::getObjectInstanceForWidget(Widget *) { ASSERT(0); notImplemented(); return 0; } +KJS::Bindings::Instance* FrameAndroid::getEmbedInstanceForWidget(Widget *) { ASSERT(0); notImplemented(); return 0; } +KJS::Bindings::Instance* FrameAndroid::getAppletInstanceForWidget(Widget*) { ASSERT(0); notImplemented(); return 0; } + +// These two functions are used to handle spell checking and context menus on selected text. +// It seems that if the text is selected, and the user tries to change the selection, the +// shouldChange function indicates if it is allowed or not. The second function is used for +// spell checking - check FrameMac.mm implementation for details. +bool FrameAndroid::shouldChangeSelection(Selection const&,Selection const&,EAffinity,bool) const { notImplemented(); return true; } +void FrameAndroid::respondToChangedSelection(Selection const&,bool) { notImplemented(); } + +// This function is called when an textbox needs to find out if it's contents +// is marked. It is used in conjunction with the set method which uses +// NSArray, a Mac specific type. The set method is called whenever text is +// added (not removed) via a single key press (paste does not count) +Range* FrameAndroid::markedTextRange() const { return 0; } + +// This function is called when determining the correct mimetype for a file that is going +// to be POSTed. That is when the form element <input type="file"> is used, and the file is +// being sent the server, the client should set the mimetype of the file. +String FrameAndroid::mimeTypeForFileName(String const&) const { ASSERT(0); notImplemented(); return String(); } + +}; /* WebCore namespace */ diff --git a/WebCore/page/android/FrameAndroid.h b/WebCore/page/android/FrameAndroid.h new file mode 100644 index 0000000..c0948df --- /dev/null +++ b/WebCore/page/android/FrameAndroid.h @@ -0,0 +1,120 @@ +/* +** +** Copyright 2007, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +#ifndef FrameAndroid_H +#define FrameAndroid_H + +#include "CacheBuilder.h" +#include "Frame.h" +#include "FrameLoaderTypes.h" +#include "PlatformGraphicsContext.h" +#include "Plugin.h" +#include "StringHash.h" +#include "WebCoreFrameBridge.h" + +class WebCoreResourceHandleClientBridge; + +namespace KJS { + namespace Bindings { + class RootObject; + } +} + +namespace WebCore { + +class EditCommand; +class MouseEventWithHitTestResults; +class Node; +class ResourceHandle; +class ResourceRequest; +struct LinkArray; +struct LinkArray; + +enum KWQSelectionDirection { + KWQSelectingNext, + KWQSelectingPrevious +}; + +class FrameAndroid : public Frame +{ +public: + FrameAndroid(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*); + virtual ~FrameAndroid(); + + /* WebCoreFrameBridge setter and getter */ + inline void setBridge(android::WebCoreFrameBridge* bridge) + { + Release(m_bridge); + m_bridge = bridge; + Retain(m_bridge); + } + inline android::WebCoreFrameBridge* bridge() const { return m_bridge; } + + virtual void focusWindow(); + virtual void unfocusWindow(); + + virtual Range* markedTextRange() const; + + virtual String mimeTypeForFileName(const String&) const; + + virtual KJS::Bindings::Instance* getEmbedInstanceForWidget(Widget*); + virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*); + virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*); + virtual KJS::Bindings::RootObject* bindingRootObject(); + + virtual void issueCutCommand(); + virtual void issueCopyCommand(); + virtual void issuePasteCommand(); + virtual void issuePasteAndMatchStyleCommand(); + virtual void issueTransposeCommand(); + virtual void respondToChangedSelection(const Selection& oldSelection, bool closeTyping); + virtual bool shouldChangeSelection(const Selection& oldSelection, + const Selection& newSelection, + EAffinity affinity, + bool stillSelecting) const; + + virtual void print(); + + void addJavascriptInterface(void* javaVM, void* objectInstance, const char* objectNameStr); + String stringByEvaluatingJavaScriptFromString(const char* script); + + /* FrameAndroid specific */ + CacheBuilder& getCacheBuilder() { return m_cacheBuilder; } + void select(int, int); + + void cleanupForFullLayout(RenderObject *); + +private: + static void recursiveCleanupForFullLayout(RenderObject *); + + RefPtr<KJS::Bindings::RootObject> m_bindingRoot; // The root object used for objects + // bound outside the context of a plugin. + /* End FrameAndroid specific */ + + android::WebCoreFrameBridge* m_bridge; + CacheBuilder m_cacheBuilder; + friend class CacheBuilder; +}; + +inline FrameAndroid* Android(Frame* frame) { return static_cast<FrameAndroid*>(frame); } +inline const FrameAndroid* Android(const Frame* frame) { return static_cast<const FrameAndroid*>(frame); } + +inline FrameAndroid* AsAndroidFrame(Frame* frame) { return static_cast<FrameAndroid*>(frame); } + +} + +#endif diff --git a/WebCore/page/android/InspectorControllerAndroid.cpp b/WebCore/page/android/InspectorControllerAndroid.cpp new file mode 100644 index 0000000..b39d32b --- /dev/null +++ b/WebCore/page/android/InspectorControllerAndroid.cpp @@ -0,0 +1,77 @@ +/* +** +** Copyright 2007, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +#include "config.h" +#include "InspectorController.h" +#include "Frame.h" +#include "Node.h" + +/* +// This stub file was created to avoid building and linking in all the +// Inspector codebase. If you would like to enable the Inspector, do the +// following steps: +// 1. Replace this file in WebCore/Makefile.android with the common +// implementation, ie page/InsepctorController.cpp +// 2. Add the JS API files to JavaScriptCore/Makefile.android: +// ? API/JSBase.cpp \ +// API/JSCallbackConstructor.cpp \ +// API/JSCallbackFunction.cpp \ +// API/JSCallbackObject.cpp \ +// API/JSClassRef.cpp \ +// API/JSContextRef.cpp \ +// API/JSObjectRef.cpp \ +// API/JSStringRef.cpp \ +// API/JSValueRef.cpp +// 3. Add the following LOCAL_C_INCLUDES to JavaScriptCore/Makefile.android: +// ?$(LOCAL_PATH)/API \ +// $(LOCAL_PATH)/ForwardingHeaders \ +// $(LOCAL_PATH)/../../WebKit \ +// 4. Rebuild WebKit +// +// Note, for a functional Inspector, you must implement InspectorClientAndroid +*/ + +namespace WebCore { + +struct InspectorResource : public RefCounted<InspectorResource> { +}; + +struct InspectorDatabaseResource : public RefCounted<InspectorDatabaseResource> { +}; + +InspectorController::InspectorController(Page*, InspectorClient*) {} +InspectorController::~InspectorController() {} + +void InspectorController::windowScriptObjectAvailable() {} +void InspectorController::didCommitLoad(DocumentLoader*) {} +void InspectorController::identifierForInitialRequest(unsigned long, DocumentLoader*, ResourceRequest const&) {} +void InspectorController::willSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, ResourceResponse const&) {} +void InspectorController::didReceiveResponse(DocumentLoader*, unsigned long, ResourceResponse const&) {} +void InspectorController::didReceiveContentLength(DocumentLoader*, unsigned long, int) {} +void InspectorController::didFinishLoading(DocumentLoader*, unsigned long) {} +void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader*, ResourceRequest const&, ResourceResponse const&, int) {} +void InspectorController::frameDetachedFromParent(Frame*) {} + +void InspectorController::addMessageToConsole(MessageSource, MessageLevel, String const&, unsigned int, String const&) {} +#if ENABLE(DATABASE) +void InspectorController::didOpenDatabase(Database*, String const&, String const&, String const&) {} +#endif +bool InspectorController::enabled() const { return false; } +void InspectorController::inspect(Node*) {} +bool InspectorController::windowVisible() { return false; } + +} |