diff options
Diffstat (limited to 'WebKit/android/jni/WebViewCore.h')
| -rw-r--r-- | WebKit/android/jni/WebViewCore.h | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 5d12158..3f00f3c 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -13,7 +13,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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 @@ -27,6 +27,7 @@ #define WEBVIEWCORE_H #include "android_npapi.h" +#include "FileChooser.h" #include "CacheBuilder.h" #include "CachedHistory.h" #include "PictureSet.h" @@ -45,6 +46,7 @@ namespace WebCore { class AtomicString; class Color; class FrameView; + class HTMLAnchorElement; class HTMLSelectElement; class RenderPart; class RenderText; @@ -62,14 +64,8 @@ class SkIRect; namespace android { - enum PluginState { - kGainFocus_PluginState = 0, - kLoseFocus_PluginState = 1, - }; - class CachedRoot; class ListBoxReply; - class SurfaceCallback; class WebCoreReply : public WebCoreRefObject { public: @@ -242,7 +238,9 @@ namespace android { // Followings support calls from Java to native WebCore // + WebCore::String retrieveHref(WebCore::Frame* frame, WebCore::Node* node); + WebCore::String retrieveAnchorText(WebCore::Frame* frame, WebCore::Node* node); WebCore::String getSelection(SkRegion* ); @@ -252,6 +250,7 @@ namespace android { // Create a set of pictures to represent the drawn DOM, driven by // the invalidated region and the time required to draw (used to draw) void recordPictureSet(PictureSet* master); + void moveFocus(WebCore::Frame* frame, WebCore::Node* node); void moveMouse(WebCore::Frame* frame, int x, int y); void moveMouseIfLatest(int moveGeneration, WebCore::Frame* frame, int x, int y); @@ -279,7 +278,7 @@ namespace android { /** * Handle touch event */ - bool handleTouchEvent(int action, int x, int y); + int handleTouchEvent(int action, int x, int y); /** * Handle motionUp event from the UI thread (called touchUp in the @@ -348,6 +347,8 @@ namespace android { */ void addPlugin(PluginWidgetAndroid*); void removePlugin(PluginWidgetAndroid*); + // returns true if the pluginwidgit is in our active list + bool isPlugin(PluginWidgetAndroid*) const; void invalPlugin(PluginWidgetAndroid*); void drawPlugins(); @@ -363,31 +364,44 @@ namespace android { // send this event to all of the plugins who have the given flag set void sendPluginEvent(const ANPEvent& evt, ANPEventFlag flag); + // lookup the plugin widget struct given an NPP + PluginWidgetAndroid* getPluginWidget(NPP npp); + // return the cursorNode if it is a plugin Node* cursorNodeIsPlugin(); - // notify the plugin of an update in state - void updatePluginState(Frame* frame, Node* node, PluginState state); - // Notify the Java side whether it needs to pass down the touch events void needTouchEvents(bool); // Notify the Java side that webkit is requesting a keyboard void requestKeyboard(bool); - // Creates a full screen surface (i.e. View on an Activity) for a plugin - void startFullScreenPluginActivity(const char* libName, - const char* className, NPP npp); + // Generates a class loader that contains classes from the plugin's apk + jclass getPluginClass(const WebCore::String& libName, const char* className); + + // Creates a new instance of the plugin's java component + jobject createPluginJavaInstance(const WebCore::String& libName, NPP npp); + + // Creates a full screen surface for a plugin + void showFullScreenPlugin(jobject webkitPlugin, NPP npp); + + // Instructs the UI thread to discard the plugin's full-screen surface + void hideFullScreenPlugin(); // Creates a Surface (i.e. View) for a plugin - jobject createSurface(const char* libName, const char* className, - NPP npp, int x, int y, int width, int height); + jobject createSurface(jobject webkitPlugin, int x, int y, int width, int height); + + // Updates a Surface coordinates and dimensions for a plugin + void updateSurface(jobject childView, int x, int y, int width, int height); // Destroys a SurfaceView for a plugin void destroySurface(jobject childView); // other public functions public: + // Open a file chooser for selecting a file to upload + void openFileChooser(PassRefPtr<WebCore::FileChooser> ); + // reset the picture set to empty void clearContent(); @@ -396,6 +410,7 @@ namespace android { // draw the picture set with the specified background color bool drawContent(SkCanvas* , SkColor ); + bool focusBoundsChanged(); bool pictureReady(); // record the inval area, and the picture size @@ -413,7 +428,6 @@ namespace android { static Mutex gFrameCacheMutex; CachedRoot* m_frameCacheKit; // nav data being built by webcore SkPicture* m_navPictureKit; - int m_generation; // copy of the number bumped by WebViewNative int m_moveGeneration; // copy of state in WebViewNative triggered by move int m_touchGeneration; // copy of state in WebViewNative triggered by touch int m_lastGeneration; // last action using up to date cache @@ -456,7 +470,6 @@ namespace android { WebCore::IntRect m_lastFocusedBounds; int m_lastFocusedSelStart; int m_lastFocusedSelEnd; - int m_lastMoveGeneration; static Mutex m_contentMutex; // protects ui/core thread pictureset access PictureSet m_content; // the set of pictures to draw (accessed by UI too) SkRegion m_addInval; // the accumulated inval region (not yet drawn) @@ -464,6 +477,7 @@ namespace android { // Used in passToJS to avoid updating the UI text field until after the // key event has been processed. bool m_blockTextfieldUpdates; + bool m_focusBoundsChanged; bool m_skipContentDraw; // Passed in with key events to know when they were generated. Store it // with the cache so that we can ignore stale text changes. @@ -499,9 +513,21 @@ namespace android { void rebuildPictureSet(PictureSet* ); void sendNotifyProgressFinished(); bool handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* nodePtr); + WebCore::HTMLAnchorElement* retrieveAnchorElement(WebCore::Frame* frame, WebCore::Node* node); + #if DEBUG_NAV_UI uint32_t m_now; #endif + + private: + // called from constructor, to add this to a global list + static void addInstance(WebViewCore*); + // called from destructor, to remove this from a global list + static void removeInstance(WebViewCore*); + public: + // call only from webkit thread (like add/remove), return true if inst + // is still alive + static bool isInstance(WebViewCore*); }; } // namespace android |
