Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial import

from BrowserAdapter:qtwebkit:3c513131981e25e295f582720f1abe3519925d40
  • Loading branch information...
commit 9d98abc50ae4ebd7f5ca4c72e46b74fe0f2c5b94 0 parents
Scott Shillcock authored
Showing with 14,951 additions and 0 deletions.
  1. +3 −0  .gitignore
  2. +6,418 −0 BrowserAdapter.cpp
  3. +5 −0 BrowserAdapter.exports
  4. +693 −0 BrowserAdapter.h
  5. +98 −0 BrowserAdapterManager.cpp
  6. +48 −0 BrowserAdapterManager.h
  7. +32 −0 BrowserCenteredZoom.h
  8. +2,125 −0 BrowserClientBase.cpp
  9. +162 −0 BrowserClientBase.h
  10. +42 −0 BrowserMetaViewport.h
  11. +244 −0 BrowserOffscreen.cpp
  12. +70 −0 BrowserOffscreen.h
  13. +54 −0 BrowserScrollableLayer.h
  14. +66 −0 Debug.h
  15. +387 −0 ElementInfo.cpp
  16. +78 −0 ElementInfo.h
  17. +363 −0 ImageInfo.cpp
  18. +79 −0 ImageInfo.h
  19. +264 −0 InteractiveInfo.cpp
  20. +73 −0 InteractiveInfo.h
  21. +235 −0 JsonNPObject.cpp
  22. +117 −0 JsonNPObject.h
  23. +576 −0 KineticScroller.cpp
  24. +124 −0 KineticScroller.h
  25. +24 −0 Makefile
  26. +36 −0 Makefile.Ubuntu
  27. +64 −0 Makefile.inc
  28. +232 −0 NPObjectEvent.cpp
  29. +79 −0 NPObjectEvent.h
  30. +290 −0 Rectangle.cpp
  31. +74 −0 Rectangle.h
  32. +285 −0 UrlInfo.cpp
  33. +75 −0 UrlInfo.h
  34. +387 −0 browsertest.html
  35. BIN  data/fl-win-shdw-bot-left-corner.png
  36. BIN  data/fl-win-shdw-bot-right-corner.png
  37. BIN  data/fl-win-shdw-bot.png
  38. BIN  data/fl-win-shdw-left.png
  39. BIN  data/fl-win-shdw-right.png
  40. BIN  data/fl-win-shdw-top-left-corner.png
  41. BIN  data/fl-win-shdw-top-right-corner.png
  42. BIN  data/fl-win-shdw-top.png
  43. BIN  data/launcher-bookmark-alpha.png
  44. BIN  data/launcher-bookmark-overlay.png
  45. BIN  data/shift-tap-reticle.png
  46. +125 −0 tests/Endurance_3x3.rb
  47. +21 −0 tests/LaunchBrowser.sh
  48. +73 −0 tests/test1/adapterOpenSsl.js
  49. +94 −0 tests/test1/adapterOpenUrl.js
  50. +121 −0 tests/test1/adapterRegress.js
  51. +67 −0 tests/test1/adapterstressBFR.js
  52. +53 −0 tests/test1/adapterstressKey.js
  53. +495 −0 tests/test1/browseradaptertest1.html
3  .gitignore
@@ -0,0 +1,3 @@
+# Ignore build directories
+release-i686/
+release-arm/
6,418 BrowserAdapter.cpp
6,418 additions, 0 deletions not shown
5 BrowserAdapter.exports
@@ -0,0 +1,5 @@
+/* version script for this plugin to only export public NPAPI symbols and main entry point */
+BrowserAdapter {
+ global: NP_*;
+ local: *;
+};
693 BrowserAdapter.h
@@ -0,0 +1,693 @@
+/* @@@LICENSE
+*
+* Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
+*
+* 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.
+*
+LICENSE@@@ */
+
+#ifndef BROWSERADAPTER_H
+#define BROWSERADAPTER_H
+
+#include "BrowserClientBase.h"
+#include "AdapterBase.h"
+#include "KineticScroller.h"
+
+#include <glib.h>
+#include <string>
+#include <list>
+#include <vector>
+#include <map>
+#include <PGContext.h>
+#include <PGSurface.h>
+#include <pbnjson.hpp>
+#include <semaphore.h>
+
+#include <BrowserRect.h>
+#include "BrowserScrollableLayer.h"
+
+struct PluginType;
+class BrowserOffscreen;
+struct BrowserAdapterData;
+class BrowserSyncReplyPipe;
+class BrowserAdapterData;
+class BrowserCenteredZoom;
+struct BrowserMetaViewport;
+
+/**
+ * This is the NPAPI browser plugin to our browser. This object communicates with
+ * the browser server which renders a browser page into this adapter.
+ *
+ * All js_* methods are the implementations of the exposed JavaScript routines
+ * callable by a JavaScript program.
+ *
+ * The msg* methods are unsolicited messages sent by the browser server when it
+ * needs to inform this adapter of something.
+ *
+ * The handle* methods are called by the browser via the AdapterBase::PrvNPP_HandleEvent
+ * NPAPI plugin callback event handler.
+ */
+class BrowserAdapter : public BrowserClientBase
+ , public AdapterBase
+ , public KineticScrollerListener
+{
+public:
+
+ BrowserAdapter(NPP instance, GMainContext *ctxt, int16_t argc, char* argn[], char* argv[]);
+ virtual ~BrowserAdapter();
+
+ void freeze();
+ void thaw();
+ bool isFrozen();
+
+ bool flashGestureLock() const { return mFlashGestureLock; }
+
+ // Methods exposed to JavaScript:
+ static const char* js_addUrlRedirect(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_clearHistory(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_clickAt(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_deleteImage(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_generateIconFromFile(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_getHistoryState(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_goBack(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_goForward(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_interrogateClicks(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_openURL(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_pageScaleAndScroll(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_reloadPage(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_resizeImage(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_saveViewToFile(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_selectPopupMenuItem(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_sendDialogResponse(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setMagnification(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setMinFontSize(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setPageIdentifier(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_smartZoom(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setViewportSize(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_stopLoad(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_gestureStart(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_gestureChange(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_gestureEnd(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_scrollStarting(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_scrollEnding(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setEnableJavaScript(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setBlockPopups(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setHeaderHeight(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setAcceptCookies(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setShowClickedLink(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_mouseEvent(AdapterBase* adapter, const NPVariant* args, uint32_t argCount, NPVariant* result);
+ static const char* js_addElementHighlight(AdapterBase* adapter, const NPVariant* args, uint32_t argCount, NPVariant* result);
+ static const char* js_removeElementHighlight(AdapterBase* adapter, const NPVariant* args, uint32_t argCount, NPVariant* result);
+ static const char* js_connectBrowserServer(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_disconnectBrowserServer(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_pageFocused(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_inspectUrlAtPoint(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_isEditing(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_insertStringAtCursor(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_enableSelectionMode(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_disableSelectionMode(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_clearSelection(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_saveImageAtPoint(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_getImageInfoAtPoint(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_selectAll(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_cut(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_copy(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_paste(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_interactiveAtPoint(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_getElementInfoAtPoint(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setMouseMode(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_startDeferWindowChange(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_stopDeferWindowChange(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+
+ static const char* js_setSpotlight(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_removeSpotlight(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setHTML(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_disableEnhancedViewport(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_ignoreMetaTags(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setNetworkInterface(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_enableFastScaling(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setDefaultLayoutWidth(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_printFrame(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_skipPaintHack(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_findInPage(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char *js_mouseHoldAt(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_handleFlick(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setVisibleSize(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const char* js_setDNSServers(AdapterBase *adapter, const NPVariant *args, uint32_t argCount, NPVariant *result);
+ static const int kRecordBufferEmptyError = -10;
+
+ static const int kExceptionMessageLength = 128;
+
+protected:
+
+ // AdapterBase overrides:
+ virtual bool handlePenDown(NpPalmPenEvent *event);
+ virtual bool handlePenUp(NpPalmPenEvent *event);
+ virtual bool handlePenMove(NpPalmPenEvent *event);
+ virtual bool handlePenClick(NpPalmPenEvent *event);
+ virtual bool handlePenDoubleClick(NpPalmPenEvent *event);
+
+ virtual bool handleKeyDown(NpPalmKeyEvent *event);
+ virtual bool handleKeyUp(NpPalmKeyEvent *event);
+
+ virtual bool handleTouchStart(NpPalmTouchEvent *event);
+ virtual bool handleTouchEnd(NpPalmTouchEvent *event);
+ virtual bool handleTouchMove(NpPalmTouchEvent *event);
+ virtual bool handleTouchCancelled(NpPalmTouchEvent *event);
+
+ virtual bool handleGesture(NpPalmGestureEvent *event);
+
+ virtual void handlePaint(NpPalmDrawEvent* event);
+ virtual void handleWindowChange(NPWindow* window);
+
+ virtual bool handleFocus(bool val);
+
+ // KineticScrollerListener overrides:
+ virtual void scrollTo(int x, int y);
+ virtual void startedAnimating();
+ virtual void stoppedAnimating();
+
+ // BrowserClientBase overrides:
+ virtual void serverConnected();
+ virtual void serverDisconnected();
+
+ // Async message handlers inherited from BrowserClientBase:
+ virtual void msgPainted(int32_t sharedBufferKey);
+ virtual void msgReportError(const char* url, int32_t code, const char* msg);
+ virtual void msgContentsSizeChanged(int32_t width, int32_t height);
+ virtual void msgScrolledTo(int32_t contentsX, int32_t contentsY);
+ virtual void msgLoadStarted();
+ virtual void msgLoadStopped();
+ virtual void msgLoadProgress(int32_t progress);
+ virtual void msgLocationChanged(const char* uri, bool canGoBack, bool canGoForward);
+ virtual void msgTitleChanged(const char* title);
+ virtual void msgTitleAndUrlChanged(const char* title, const char* url, bool canGoBack, bool canGoForward);
+ virtual void msgDialogAlert(const char* syncPipePath, const char* msg);
+ virtual void msgDialogConfirm(const char* syncPipePath, const char* msg);
+ virtual void msgDialogSSLConfirm(const char* syncPipePath, const char* host,int32_t code, const char* certFile);
+ virtual void msgDialogPrompt(const char* syncPipePath, const char* msg, const char* defaultValue);
+ virtual void msgDialogUserPassword(const char* syncPipePath, const char* msg);
+ virtual void msgActionData(const char* dataType, const char* data);
+ virtual void msgDownloadStart(const char* url);
+ virtual void msgDownloadProgress(const char* url, int32_t totalSizeSoFar, int32_t totalSize);
+ virtual void msgDownloadError(const char* url, const char* errorMsg);
+ virtual void msgDownloadFinished(const char* url, const char* mimeType, const char* tmpFilePath);
+ virtual void msgLinkClicked(const char* url);
+ virtual void msgMimeHandoffUrl(const char* mimeType, const char* url);
+ virtual void msgMimeNotSupported(const char* mimeType, const char* url);
+ virtual void msgCreatePage(int32_t identifier);
+ virtual void msgClickRejected(int32_t counter);
+ virtual void msgPopupMenuShow(const char* identifier, const char* menuDataFileName);
+ virtual void msgPopupMenuHide(const char* identifier);
+ virtual void msgSmartZoomCalculateResponseSimple(int32_t pointX, int32_t pointY, int32_t left, int32_t top, int32_t right, int32_t bottom, int fullscreenSpotlightHandle);
+ virtual void msgFailedLoad(const char* domain, int32_t errorCode, const char* failingURL, const char* localizedDescription);
+ virtual void msgSetMainDocumentError(const char* domain, int32_t errorCode, const char* failingURL, const char* localizedDescription);
+ virtual void msgEditorFocused(bool focused, int32_t fieldType, int32_t fieldActions);
+ virtual void msgDidFinishDocumentLoad();
+ virtual void msgUpdateGlobalHistory(const char* url, bool reload);
+ virtual void msgPurgePage();
+ virtual void msgInspectUrlAtPointResponse(int32_t queryNum, bool succeeded, const char* url, const char* desc, int32_t rectWidth, int32_t rectHeight, int32_t rectX, int32_t rectY);
+ virtual void msgGetHistoryStateResponse(int32_t queryNum, bool canGoBack, bool canGoForward);
+ virtual void msgIsEditing(int32_t queryNum, bool isEditing);
+ virtual void msgUrlRedirected(const char* url, const char* userData);
+ virtual void msgMetaViewportSet(double initialScale, double minimumScale, double maximumScale, int32_t width, int32_t height, bool userScalable);
+ virtual void msgHighlightRects(const char* rectsArrayJson);
+ virtual void msgSaveImageAtPointResponse(int32_t queryNum, bool succeeded, const char* filepath);
+ virtual void msgGetImageInfoAtPointResponse(int32_t queryNum, bool succeeded, const char* baseUri, const char* src,
+ const char* title, const char* altText, int32_t width, int32_t height, const char* mimeType);
+ virtual void msgGetElementInfoAtPointResponse(int32_t queryNum, bool succeeded, const char* element, const char* id,
+ const char* name, const char* cname, const char* type, int32_t left, int32_t top, int32_t right, int32_t bottom, bool isEditable);
+ virtual void msgMakePointVisible(int32_t x, int32_t y);
+ virtual void msgIsInteractiveAtPointResponse(int32_t queryNum, bool interactive);
+ virtual void msgCopiedToClipboard();
+ virtual void msgPastedFromClipboard();
+ virtual void msgRemoveSelectionReticle();
+ virtual void msgCopySuccessResponse(int32_t queryNum, bool success);
+ virtual void msgPluginFullscreenSpotlightCreate(int32_t spotlightHandle, int32_t rectX, int32_t rectY, int32_t rectWidth, int32_t rectHeight);
+ virtual void msgPluginFullscreenSpotlightRemove();
+ virtual void msgSpellingWidgetVisibleRectUpdate(int32_t rectX, int32_t rectY, int32_t rectWidth, int32_t rectHeight);
+ virtual void msgHitTestResponse(int32_t queryNum, const char *hitTestResultJson);
+ virtual void msgAddFlashRects(const char* rectsArrayJson);
+ virtual void msgRemoveFlashRects(const char* rectsArrayJson);
+ virtual void msgShowPrintDialog();
+ virtual void msgGetTextCaretBoundsResponse(int32_t queryNum, int32_t left, int32_t top, int32_t right, int32_t bottom);
+ virtual void msgUpdateScrollableLayers(const char* json);
+
+private:
+ /* TODO: We should get this from the webkit headers */
+ enum InteractiveRectType {
+ InteractiveRectDefault,
+ InteractiveRectPlugin //< Interactive rect is a plugin rect
+ };
+
+ struct Point {
+ Point(int x, int y) { this->x = x; this->y = y; }
+ Point(const Point& rhs) : x(rhs.x), y(rhs.y) {}
+ void set(int x, int y) { this->x = x; this->y = y; }
+ bool operator==(const Point& rhs) const {
+ return x == rhs.x && y == rhs.y;
+ }
+ Point& operator=(const Point& rhs) {
+ x = rhs.x;
+ y = rhs.y;
+ return *this;
+ }
+ int x;
+ int y;
+ };
+
+ struct BrowserServerCallArgs {
+ BrowserServerCallArgs(int queryNum) : m_queryNum(queryNum) {}
+ virtual ~BrowserServerCallArgs() {}
+ int m_queryNum; ///< The query number used to associate the reply with the correct call.
+ };
+
+ /**
+ * We save arguments to inspectUrlAtPoint in this object so that when we receive
+ * the response we can handle it properly.
+ */
+ struct InspectUrlAtPointArgs : public BrowserServerCallArgs {
+ int m_x; ///< The orginally supplied X coordinate.
+ int m_y; ///< The originally supplied Y coordinate.
+ NPObject* m_successCb; ///< The success callback function.
+
+ InspectUrlAtPointArgs(int x, int y, NPObject* cb, int queryNum);
+ virtual ~InspectUrlAtPointArgs ();
+ };
+
+ struct GetImageInfoAtPointArgs : public BrowserServerCallArgs {
+ int m_x; ///< The orginally supplied X coordinate.
+ int m_y; ///< The originally supplied Y coordinate.
+ NPObject* m_callback; ///< The success callback function.
+
+ GetImageInfoAtPointArgs(int x, int y, NPObject* cb, int queryNum);
+ virtual ~GetImageInfoAtPointArgs ();
+ };
+
+ struct IsInteractiveAtPointArgs : public BrowserServerCallArgs {
+ int m_x; ///< The orginally supplied X coordinate.
+ int m_y; ///< The originally supplied Y coordinate.
+ NPObject* m_callback; ///< The success callback function.
+
+ IsInteractiveAtPointArgs(int x, int y, NPObject* cb, int queryNum);
+ virtual ~IsInteractiveAtPointArgs ();
+ };
+
+ struct GetElementInfoAtPointArgs : public BrowserServerCallArgs {
+ int m_x; ///< The orginally supplied X coordinate.
+ int m_y; ///< The originally supplied Y coordinate.
+ NPObject* m_callback; ///< The success callback function.
+
+ GetElementInfoAtPointArgs(int x, int y, NPObject* cb, int queryNum);
+ virtual ~GetElementInfoAtPointArgs ();
+ };
+
+ struct GetHistoryStateArgs : public BrowserServerCallArgs {
+ NPObject* m_successCb; ///< The success callback function.
+
+ GetHistoryStateArgs(NPObject* cb, int queryNum);
+ virtual ~GetHistoryStateArgs ();
+ };
+
+ struct IsEditingArgs : public BrowserServerCallArgs {
+ NPObject* m_callback; ///< js callback fired when reply is ready
+
+ IsEditingArgs(NPObject* callback, int queryNum);
+ virtual ~IsEditingArgs();
+ };
+
+ struct CopySuccessCallbackArgs : public BrowserServerCallArgs {
+ NPObject* m_callback; ///< js callback fired when reply is ready
+
+ CopySuccessCallbackArgs(NPObject* callback, int queryNum);
+ virtual ~CopySuccessCallbackArgs();
+ };
+
+ struct SaveImageAtPointArgs : public BrowserServerCallArgs {
+ int m_x; ///< The orginally supplied X coordinate.
+ int m_y; ///< The originally supplied Y coordinate.
+ NPObject* m_callback; ///< js callback fired when reply is ready
+
+ SaveImageAtPointArgs(int x, int y, NPObject* cb, int queryNum);
+ virtual ~SaveImageAtPointArgs();
+ };
+
+ struct HitTestArgs : public BrowserServerCallArgs {
+ const char *m_type;
+ Point m_pt;
+ int m_modifiers;
+
+ HitTestArgs(const char *type, const Point& pt, int modifiers, int queryNum);
+ virtual ~HitTestArgs();
+ };
+
+ struct GetTextCaretArgs : public BrowserServerCallArgs {
+ NPObject *m_callback;
+
+ GetTextCaretArgs(NPObject *cb, int queryNum);
+ virtual ~GetTextCaretArgs();
+ };
+
+ struct UrlRedirectInfo {
+ std::string re;
+ bool redir;
+ std::string udata;
+ int type;
+
+ UrlRedirectInfo( const char* urlRe, bool redirect, const char* userData, int redirectType ) :
+ re(urlRe), redir(redirect), udata(userData), type(redirectType) {}
+ };
+
+ struct SelectionReticleInfo {
+ PGSurface* surface;
+ GSource* timeoutSource;
+ int x;
+ int y;
+ int centerOffsetX;
+ int centerOffsetY;
+ bool show;
+ };
+
+ /**
+ * A collection of arguments that have been used for a call into BrowserServer that we're waiting
+ * for a reply on.
+ */
+ template<typename T>
+ class ArgList
+ {
+ private:
+ typedef std::list<T*> myArgList;
+ public:
+ ~ArgList() {
+ typename myArgList::const_iterator i;
+ for (i = m_args.begin(); i != m_args.end(); ++i) {
+ delete *i;
+ }
+ }
+
+ /**
+ * Add an argument object to this list. We now own the pointer.
+ */
+ void add(T* arg) {
+ m_args.push_back(arg);
+ }
+
+ /**
+ * Find an argument object whose query number matches the one provided.
+ * <strong>The caller now owns the argument object.</strong>
+ */
+ T* get(int queryNum) {
+ typename myArgList::iterator i;
+ for (i = m_args.begin(); i != m_args.end(); ++i) {
+ T* args = *i;
+ if (args->m_queryNum == queryNum) {
+ m_args.erase(i); // Caller now owns this pointer
+ return args;
+ }
+ }
+ return NULL; // Not found
+ };
+
+ private:
+ myArgList m_args;
+ };
+
+ KineticScroller* mScroller;
+ PGSurface* mDirtyPattern;
+
+
+ Point m_pageOffset; // Position of top left corner relative to a Netscape page
+ Point m_touchPtDoc; // last touch press or touch move point in document coordinates
+
+
+ // viewport size
+ int mViewportWidth;
+ int mViewportHeight;
+
+ double mZoomLevel;
+ bool mZoomFit;
+ int mPageWidth;
+ int mPageHeight;
+ int mContentWidth;
+ int mContentHeight;
+ Point mScrollPos;
+ bool mInGestureChange;
+
+ BrowserMetaViewport* mMetaViewport;
+ BrowserCenteredZoom* mCenteredZoom;
+
+ BrowserOffscreen* mOffscreen0;
+ BrowserOffscreen* mOffscreen1;
+ BrowserOffscreen* mOffscreenCurrent;
+
+ PGSurface* mFrozenSurface;
+ bool mFrozen;
+ Point mFrozenRenderPos;
+ int mFrozenRenderWidth;
+ int mFrozenRenderHeight;
+ float mFrozenZoomFactor;
+
+ bool m_passInputEvents;
+ bool mFirstPaintComplete; ///< Set once the first non-empty paint has been completed.
+ bool mEnableJavaScript;
+ bool mBlockPopups;
+ bool mAcceptCookies;
+ bool mShowClickedLink;
+
+ int m_defaultLayoutWidth;
+
+ bool mBrowserServerConnected; ///< Is this adapter currently connected to the BrowserServer?
+ bool mNotifiedOfBrowserServerDisconnect; ///< Has our owner been notified of a BrowserServer disconnect?
+
+ bool mSendFinishDocumentLoadNotification; ///< True when load is complete but didFinishDocumentLoad not sent
+
+ std::list<UrlRedirectInfo*> m_urlRedirects; ///< an ordered list of URL's to redirect back to the app
+
+ int16_t mArgc; ///< Saved copy of argc when adapter is initialized
+ char** mArgn; ///< Saved copy of argn when adapter is initialized
+ char** mArgv; ///< Saved copy of argv when adapter is initialized
+ bool mPaintEnabled;
+ bool mInScroll;
+ bool bEditorFocused; ///< Is the current page focused.
+
+ bool m_useFastScaling;
+ double m_startingZoomLevel;
+
+ int32_t mPageIdentifier;
+
+ ArgList<InspectUrlAtPointArgs> m_inspectUrlArgs;
+ ArgList<GetHistoryStateArgs> m_historyStateArgs;
+ ArgList<IsEditingArgs> m_isEditingArgs;
+ ArgList<GetImageInfoAtPointArgs>m_getImageInfoAtPointArgs;
+ ArgList<IsInteractiveAtPointArgs>m_isInteractiveAtPointArgs;
+ ArgList<SaveImageAtPointArgs> m_saveImageAtPointArgs;
+ ArgList<GetElementInfoAtPointArgs> m_getElementInfoAtPointArgs;
+ ArgList<CopySuccessCallbackArgs> m_copySuccessCallbackArgs;
+ ArgList<HitTestArgs> m_hitTestArgs;
+ ArgList<GetTextCaretArgs> m_getTextCaretArgs;
+
+ int mBsQueryNum;
+ bool m_interrogateClicks;
+ int mMouseMode;
+ bool mLogAlertMessages;
+
+ bool mPageFocused; ///< Is the onwer of this adapter focused?
+ bool mServerConnectedInvoked; // has successfully invoked serverConnected
+ bool mServerConnectedInvoking; // in calling serverConnected
+
+ bool mShowHighlight;
+ std::vector<BrowserRect> mHighlightRects;
+
+ Point mLastPointSentToFlash;
+ bool mMouseInFlashRect;
+ bool mFlashGestureLock;
+ typedef std::map<uintptr_t, BrowserRect> RectMap;
+ typedef std::pair<uintptr_t, BrowserRect> RectMapItem;
+ RectMap mFlashRects;
+
+ bool mMouseInInteractiveRect;
+ RectMap mDefaultInteractiveRects;
+
+ BrowserScrollableLayerMap mScrollableLayers;
+ BrowserScrollableLayerScrollSession mScrollableLayerScrollSession;
+
+ SelectionReticleInfo mSelectionReticle;
+
+ static gboolean removeSelectionReticleCallback(gpointer arg);
+
+ // the highlight area (mouse, gesture are directly send to it)
+ int m_spotlightHandle;
+ int m_spotlightAlpha; // 0~ 255
+ BrowserRect m_spotlightRect;
+
+ pbnjson::JSchemaFile m_hitTestSchema;
+
+ bool init();
+ bool initializeIpcBuffer();
+ void setDefaultViewportSize();
+ void sendStateToServer();
+
+ // gesture handling
+ void doGestureStart(int cx, int cy, float scale, float rotate, int center_x, int center_y);
+ void doGestureChange(int cx, int cy, float scale, float rotate, int center_x, int center_y, bool isGestureEnd=false);
+ void doGestureEnd(int cx, int cy, float scale, float rotate, int center_x, int center_y);
+
+ void sendGestureStart(int cx, int cy, float scale, float rotate, int center_x, int center_y);
+ void sendGestureChange(int cx, int cy, float scale, float rotate, int center_x, int center_y);
+ void sendGestureEnd(int cx, int cy, float scale, float rotate, int center_x, int center_y);
+ void sendSingleTap(int cx, int cy, int modifiers);
+
+ // touch handling
+ bool doTouchEvent(int32_t type, NpPalmTouchEvent *event);
+
+ static BrowserAdapter* GetAndInitAdapter( AdapterBase* adapter );
+ static void addJsonProperty(struct json_value* root, const char* name, const char* value);
+ static void addJsonProperty(struct json_value* root, const char* name, int32_t value);
+ static void addJsonProperty(struct json_value* root, const char* name, bool value);
+ static int readPngFile(const char* pszFileName, uint32_t* &pPixelData, int &nImageWidth, int &nImageHeight);
+ static int readPngFile(const char* pszFileName, PContext2D& context, PPixmap* &pPixmap,
+ int &nImageWidth, int &nImageHeight);
+ static int preScaleImage(PPixmap* pPixmap, int nImageWidth, int nImageHeight);
+ static int writePngFile(const char* pszFileName, const uint32_t* pPixelData, int nImageWidth, int nImageHeight);
+ static bool isSafeDir(const char* pszFileName);
+ bool prvSmartZoom(const Point& pt);
+ void invalidate(void);
+ void handlePaintInFrozenState(NpPalmDrawEvent* event);
+
+ void scale(double zoom);
+ void scaleAndScrollTo(double zoom, int x, int y);
+ void fireScrolledToEvent(int x, int y);
+ bool isActivated();
+
+ void setPageIdentifier(int32_t identifier);
+
+ void enableFastScaling(bool enable);
+
+ int showHighlight(PGContext* gc);
+ void removeHighlight();
+ void invalidateHighlightRectsRegion();
+
+ void updateMouseInFlashStatus(bool inFlashRect);
+ void updateFlashGestureLockStatus(bool gestureLockEnabled);
+ bool flashRectContainsPoint(const Point& pt);
+ bool rectContainsPoint(RectMap &rectMap, const Point& pt);
+ void updateMouseInInteractiveStatus(bool inInteractiveRect);
+ bool interactiveRectContainsPoint(const Point& pt);
+ void jsonToRects(const char* rectsArrayJson);
+
+ bool detectScrollableLayerUnderMouseDown(const Point& pagePt, const Point& mousePt);
+ bool scrollLayerUnderMouse(const Point& currentMousePtDoc);
+ void resetScrollableLayerScrollSession();
+ void showActiveScrollableLayer(PGContext* gc);
+
+ // used to create a scrim around a plugin rectangle "spotlight"
+ int showSpotlight(PGContext* gc);
+
+ void initSelectionReticleSurface();
+ void showSelectionReticle(PGContext* gc);
+ void invalidateSelectionReticleRegion();
+
+ bool sendRequestOffscreenChange(bool sync, int asyncDelayMillis);
+
+ bool isPointInList(const Point &point, const NpPalmTouchList &list);
+
+ bool shouldPassInputEvents();
+ bool shouldPassTouchEvents();
+
+ struct timeval m_lastPassedEventTime;
+
+ unsigned long long m_ft;
+
+ void scrollCaretIntoViewAfterResize(int oldwidth, int oldheight, double oldZoomLevel);
+ BrowserRect m_textCaretRect;
+
+ Point m_clickPt; ///< Point where mouse clicked (minus header)
+ Point m_penDownDoc; ///< Mouse down location in scaled document coordinates
+
+ bool m_dragging;
+ bool m_didDrag;
+ bool m_didHold;
+ bool m_sentToBS;
+
+ GSource *m_clickTimerSource;
+ static gboolean clickTimeoutCb(gpointer data);
+ void startClickTimer();
+ void stopClickTimer();
+
+ GSource *m_mouseHoldTimerSource;
+ static gboolean mouseHoldTimeoutCb(gpointer data);
+ void startMouseHoldTimer();
+ void stopMouseHoldTimer();
+
+ struct SentMouseHoldEvent {
+ SentMouseHoldEvent() : pt(0,0), sent(false) {}
+ void reset() { sent = false; }
+ void set(int cx, int cy)
+ {
+ pt.set(cx, cy);
+ sent = true;
+ }
+
+ Point pt;
+ bool sent;
+ };
+ SentMouseHoldEvent m_sentMouseHoldEvent;
+
+ GSource *m_zoomTimerSource;
+ static gboolean zoomTimerTimeoutCb(gpointer data);
+ bool animateZoom();
+ void startZoomAnimation(double zoom, int x, int y);
+ void stopZoomAnimation();
+ Point m_zoomPt;
+ double m_zoomTarget;
+ int m_zoomXInterval;
+ int m_zoomYInterval;
+ double m_zoomLevelInterval;
+ int m_headerHeight; ///< Height (in pixels) of the header which is a space above the page we don't draw.
+
+ void showScrollbar();
+ void startFadeScrollbar();
+ void stopFadeScrollbar();
+ static gboolean scrollbarFadeoutCb(gpointer data);
+
+ int mScrollbarOpacity;
+ GSource* mScrollbarFadeSource;
+
+ struct RecordedGestureEntry {
+ RecordedGestureEntry(float s, float r, int cX, int cY)
+ : scale(s)
+ , rotate(r)
+ , centerX(cX)
+ , centerY(cY) {
+ }
+
+ float scale;
+ float rotate;
+ int centerX;
+ int centerY;
+ };
+
+ std::list<RecordedGestureEntry> m_recordedGestures;
+
+ void recordGesture(float s, float r, int cX, int cY);
+ RecordedGestureEntry getAveragedGesture() const;
+ bool destroyBufferLock();
+ bool createBufferLock();
+ sem_t* m_bufferLock;
+ char* m_bufferLockName;
+
+ friend class BrowserAdapterData;
+};
+
+
+#endif /* BROWSERADAPTER_H */
98 BrowserAdapterManager.cpp
@@ -0,0 +1,98 @@
+/* @@@LICENSE
+*
+* Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
+*
+* 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.
+*
+LICENSE@@@ */
+
+#include "BrowserAdapterManager.h"
+
+#include "BrowserAdapter.h"
+
+BrowserAdapterManager* BrowserAdapterManager::instance()
+{
+ static BrowserAdapterManager* s_instance = 0;
+ if (G_UNLIKELY(s_instance == 0)) {
+
+ s_instance = new BrowserAdapterManager;
+ }
+
+ return s_instance;
+}
+
+BrowserAdapterManager::BrowserAdapterManager()
+ : m_adapterList(0)
+{
+}
+
+BrowserAdapterManager::~BrowserAdapterManager()
+{
+ g_list_free(m_adapterList);
+}
+
+void BrowserAdapterManager::registerAdapter(BrowserAdapter* adapter)
+{
+ m_adapterList = g_list_prepend(m_adapterList, adapter);
+}
+
+void BrowserAdapterManager::unregisterAdapter(BrowserAdapter* adapter)
+{
+ m_adapterList = g_list_remove(m_adapterList, adapter);
+}
+
+void BrowserAdapterManager::adapterActivated(BrowserAdapter* adapter, bool activated)
+{
+ if (activated) {
+
+ GList* head = g_list_first(m_adapterList);
+ if (head && head->data != adapter) {
+
+ m_adapterList = g_list_remove(m_adapterList, adapter);
+ m_adapterList = g_list_prepend(m_adapterList, adapter);
+ }
+
+ // Freeze all the other adapters and thaw this one
+ for (GList* iter = g_list_first(m_adapterList); iter; iter = g_list_next(iter)) {
+
+ BrowserAdapter* a = (BrowserAdapter*) iter->data;
+ if (a == adapter)
+ continue;
+
+ a->freeze();
+ }
+
+ adapter->thaw();
+ }
+/*
+ // if we are really concerned about memory we should enable this
+ else {
+ adapter->freeze();
+ }
+*/
+}
+void BrowserAdapterManager::inactiveAdaptersActivate()
+{
+
+ for (GList* iter = g_list_first(m_adapterList); iter; iter = g_list_next(iter)) {
+
+ BrowserAdapter* a = (BrowserAdapter*) iter->data;
+ //thaw the first frozen adapter that is encountered
+ if(a->isFrozen()){
+
+ a->thaw();
+ break;
+ }
+
+ }
+}
48 BrowserAdapterManager.h
@@ -0,0 +1,48 @@
+/* @@@LICENSE
+*
+* Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
+*
+* 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.
+*
+LICENSE@@@ */
+
+#ifndef BROWSERADAPTERMANAGER_H
+#define BROWSERADAPTERMANAGER_H
+
+#include <glib.h>
+
+class BrowserAdapter;
+
+class BrowserAdapterManager
+{
+public:
+
+ static BrowserAdapterManager* instance();
+
+ void registerAdapter(BrowserAdapter* adapter);
+ void unregisterAdapter(BrowserAdapter* adapter);
+ void adapterActivated(BrowserAdapter* adapter, bool activated);
+ void inactiveAdaptersActivate();
+
+private:
+
+ BrowserAdapterManager();
+ ~BrowserAdapterManager();
+
+private:
+
+ GList* m_adapterList;
+};
+
+
+#endif /* BROWSERADAPTERMANAGER_H */
32 BrowserCenteredZoom.h
@@ -0,0 +1,32 @@
+/* @@@LICENSE
+*
+* Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
+*
+* 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.
+*
+LICENSE@@@ */
+
+#ifndef BROWSERCENTEREDZOOM_H
+#define BROWSERCENTEREDZOOM_H
+
+struct BrowserCenteredZoom
+{
+ double scale;
+ int centerX;
+ int centerY;
+ int scrollX;
+ int scrollY;
+ double zoomLevel;
+};
+
+#endif /* BROWSERCENTEREDZOOM_H */
2,125 BrowserClientBase.cpp
@@ -0,0 +1,2125 @@
+// This file is autogenerated from YapCodeGen. Do not Edit
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <glib.h>
+#include <BrowserClientBase.h>
+
+void BrowserClientBase::syncCmdRenderToFile(const char* filename, int32_t viewX, int32_t viewY, int32_t viewW, int32_t viewH, int32_t& result)
+{
+ YapPacket* cmd = packetCommand();
+ YapPacket* reply = packetReply();
+ (*cmd) << (int16_t) 0x0014; // RenderToFile
+ (*cmd) << filename;
+ (*cmd) << viewX;
+ (*cmd) << viewY;
+ (*cmd) << viewW;
+ (*cmd) << viewH;
+ sendSyncCommand();
+ (*reply) >> result;
+}
+
+void BrowserClientBase::asyncCmdConnect(int32_t pageWidth, int32_t pageHeight, int32_t sharedBufferKey1, int32_t sharedBufferKey2, int32_t sharedBufferSize, int32_t identifier)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1000; // Connect
+ (*_cmd) << pageWidth;
+ (*_cmd) << pageHeight;
+ (*_cmd) << sharedBufferKey1;
+ (*_cmd) << sharedBufferKey2;
+ (*_cmd) << sharedBufferSize;
+ (*_cmd) << identifier;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetWindowSize(int32_t width, int32_t height)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1001; // SetWindowSize
+ (*_cmd) << width;
+ (*_cmd) << height;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetUserAgent(const char* userAgent)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1003; // SetUserAgent
+ (*_cmd) << userAgent;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdOpenUrl(const char* url)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1004; // OpenUrl
+ (*_cmd) << url;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetHtml(const char* url, const char* body)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1005; // SetHtml
+ (*_cmd) << url;
+ (*_cmd) << body;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdClickAt(int32_t contentX, int32_t contentY, int32_t numClicks, int32_t counter)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1007; // ClickAt
+ (*_cmd) << contentX;
+ (*_cmd) << contentY;
+ (*_cmd) << numClicks;
+ (*_cmd) << counter;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdKeyDown(uint16_t key, uint16_t modifiers)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1008; // KeyDown
+ (*_cmd) << key;
+ (*_cmd) << modifiers;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdKeyUp(uint16_t key, uint16_t modifiers)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1009; // KeyUp
+ (*_cmd) << key;
+ (*_cmd) << modifiers;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdForward()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x100A; // Forward
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdBack()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x100B; // Back
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdReload()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x100C; // Reload
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdStop()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x100D; // Stop
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdPageFocused(bool focused)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1010; // PageFocused
+ (*_cmd) << focused;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdExit()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1011; // Exit
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdCancelDownload(const char* url)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1015; // CancelDownload
+ (*_cmd) << url;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdInterrogateClicks(bool enable)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1016; // InterrogateClicks
+ (*_cmd) << enable;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdZoomSmartCalculateRequest(int32_t pointX, int32_t pointY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1017; // ZoomSmartCalculateRequest
+ (*_cmd) << pointX;
+ (*_cmd) << pointY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdDragStart(int32_t contentX, int32_t contentY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x101A; // DragStart
+ (*_cmd) << contentX;
+ (*_cmd) << contentY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdDragProcess(int32_t deltaX, int32_t deltaY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x101B; // DragProcess
+ (*_cmd) << deltaX;
+ (*_cmd) << deltaY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdDragEnd(int32_t contentX, int32_t contentY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x101C; // DragEnd
+ (*_cmd) << contentX;
+ (*_cmd) << contentY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetMinFontSize(int32_t minFontSizePt)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1103; // SetMinFontSize
+ (*_cmd) << minFontSizePt;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdFindString(const char* str, bool fwd)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1104; // FindString
+ (*_cmd) << str;
+ (*_cmd) << fwd;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdClearSelection()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1105; // ClearSelection
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdClearCache()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1106; // ClearCache
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdClearCookies()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1107; // ClearCookies
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdPopupMenuSelect(const char* identifier, int32_t selectedIdx)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1108; // PopupMenuSelect
+ (*_cmd) << identifier;
+ (*_cmd) << selectedIdx;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetEnableJavaScript(bool enable)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1109; // SetEnableJavaScript
+ (*_cmd) << enable;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetBlockPopups(bool enable)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x110A; // SetBlockPopups
+ (*_cmd) << enable;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetAcceptCookies(bool enable)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x110B; // SetAcceptCookies
+ (*_cmd) << enable;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdMouseEvent(int32_t type, int32_t contentX, int32_t contentY, int32_t detail)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x110C; // MouseEvent
+ (*_cmd) << type;
+ (*_cmd) << contentX;
+ (*_cmd) << contentY;
+ (*_cmd) << detail;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdGestureEvent(int32_t type, int32_t contentX, int32_t contentY, double scale, double rotate, int32_t centerX, int32_t centerY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x110D; // GestureEvent
+ (*_cmd) << type;
+ (*_cmd) << contentX;
+ (*_cmd) << contentY;
+ (*_cmd) << scale;
+ (*_cmd) << rotate;
+ (*_cmd) << centerX;
+ (*_cmd) << centerY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdDisconnect()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x110E; // Disconnect
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdInspectUrlAtPoint(int32_t queryNum, int32_t pointX, int32_t pointY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x110F; // InspectUrlAtPoint
+ (*_cmd) << queryNum;
+ (*_cmd) << pointX;
+ (*_cmd) << pointY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdGetHistoryState(int32_t queryNum)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1111; // GetHistoryState
+ (*_cmd) << queryNum;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdClearHistory()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1112; // ClearHistory
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetAppIdentifier(const char* identifier)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1113; // SetAppIdentifier
+ (*_cmd) << identifier;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdAddUrlRedirect(const char* urlRe, int32_t type, bool redirect, const char* userData)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1114; // AddUrlRedirect
+ (*_cmd) << urlRe;
+ (*_cmd) << type;
+ (*_cmd) << redirect;
+ (*_cmd) << userData;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetShowClickedLink(bool enable)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1115; // SetShowClickedLink
+ (*_cmd) << enable;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdGetInteractiveNodeRects(int32_t pointX, int32_t pointY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1116; // GetInteractiveNodeRects
+ (*_cmd) << pointX;
+ (*_cmd) << pointY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdIsEditing(int32_t queryNum)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1117; // IsEditing
+ (*_cmd) << queryNum;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdInsertStringAtCursor(const char* text)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1118; // InsertStringAtCursor
+ (*_cmd) << text;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdEnableSelection(int32_t pointX, int32_t pointY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1119; // EnableSelection
+ (*_cmd) << pointX;
+ (*_cmd) << pointY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdDisableSelection()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x111A; // DisableSelection
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSaveImageAtPoint(int32_t queryNum, int32_t pointX, int32_t pointY, const char* dstDir)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x111B; // SaveImageAtPoint
+ (*_cmd) << queryNum;
+ (*_cmd) << pointX;
+ (*_cmd) << pointY;
+ (*_cmd) << dstDir;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdGetImageInfoAtPoint(int32_t queryNum, int32_t pointX, int32_t pointY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x111C; // GetImageInfoAtPoint
+ (*_cmd) << queryNum;
+ (*_cmd) << pointX;
+ (*_cmd) << pointY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdIsInteractiveAtPoint(int32_t queryNum, int32_t pointX, int32_t pointY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x111D; // IsInteractiveAtPoint
+ (*_cmd) << queryNum;
+ (*_cmd) << pointX;
+ (*_cmd) << pointY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdGetElementInfoAtPoint(int32_t queryNum, int32_t pointX, int32_t pointY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x111E; // GetElementInfoAtPoint
+ (*_cmd) << queryNum;
+ (*_cmd) << pointX;
+ (*_cmd) << pointY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSelectAll()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x111F; // SelectAll
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdCopy(int32_t queryNum)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1120; // Copy
+ (*_cmd) << queryNum;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdPaste()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1121; // Paste
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdCut()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1122; // Cut
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetMouseMode(int32_t mode)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1123; // SetMouseMode
+ (*_cmd) << mode;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdDisableEnhancedViewport(bool disable)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1124; // DisableEnhancedViewport
+ (*_cmd) << disable;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdIgnoreMetaTags(bool ignore)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1125; // IgnoreMetaTags
+ (*_cmd) << ignore;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetScrollPosition(int32_t cx, int32_t cy, int32_t cw, int32_t ch)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1500; // SetScrollPosition
+ (*_cmd) << cx;
+ (*_cmd) << cy;
+ (*_cmd) << cw;
+ (*_cmd) << ch;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdPluginSpotlightStart(int32_t cx, int32_t cy, int32_t cw, int32_t ch)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1501; // PluginSpotlightStart
+ (*_cmd) << cx;
+ (*_cmd) << cy;
+ (*_cmd) << cw;
+ (*_cmd) << ch;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdPluginSpotlightEnd()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1502; // PluginSpotlightEnd
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdHideSpellingWidget()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1503; // HideSpellingWidget
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetNetworkInterface(const char* interfaceName)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1504; // SetNetworkInterface
+ (*_cmd) << interfaceName;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdHitTest(int32_t queryNum, int32_t cx, int32_t cy)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1505; // HitTest
+ (*_cmd) << queryNum;
+ (*_cmd) << cx;
+ (*_cmd) << cy;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetVirtualWindowSize(int32_t width, int32_t height)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1506; // SetVirtualWindowSize
+ (*_cmd) << width;
+ (*_cmd) << height;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdPrintFrame(const char* frameName, int32_t lpsJobId, int32_t width, int32_t height, int32_t dpi, bool landscape, bool reverseOrder)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1507; // PrintFrame
+ (*_cmd) << frameName;
+ (*_cmd) << lpsJobId;
+ (*_cmd) << width;
+ (*_cmd) << height;
+ (*_cmd) << dpi;
+ (*_cmd) << landscape;
+ (*_cmd) << reverseOrder;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdTouchEvent(int32_t type, int32_t touchCount, int32_t modifiers, const char* touchesJson)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1508; // TouchEvent
+ (*_cmd) << type;
+ (*_cmd) << touchCount;
+ (*_cmd) << modifiers;
+ (*_cmd) << touchesJson;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdHoldAt(int32_t contentX, int32_t contentY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1509; // HoldAt
+ (*_cmd) << contentX;
+ (*_cmd) << contentY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdGetTextCaretBounds(int32_t queryNum)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x150a; // GetTextCaretBounds
+ (*_cmd) << queryNum;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdFreeze()
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x150b; // Freeze
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdThaw(int32_t sharedBufferKey1, int32_t sharedBufferKey2, int32_t sharedBufferSize)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x150c; // Thaw
+ (*_cmd) << sharedBufferKey1;
+ (*_cmd) << sharedBufferKey2;
+ (*_cmd) << sharedBufferSize;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdReturnBuffer(int32_t sharedBufferKey)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x150d; // ReturnBuffer
+ (*_cmd) << sharedBufferKey;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetZoomAndScroll(double zoom, int32_t cx, int32_t cy)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x150e; // SetZoomAndScroll
+ (*_cmd) << zoom;
+ (*_cmd) << cx;
+ (*_cmd) << cy;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdScrollLayer(int32_t id, int32_t deltaX, int32_t deltaY)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x150f; // ScrollLayer
+ (*_cmd) << id;
+ (*_cmd) << deltaX;
+ (*_cmd) << deltaY;
+ sendAsyncCommand();
+}
+
+void BrowserClientBase::asyncCmdSetDNSServers(const char* servers)
+{
+ YapPacket* _cmd = packetCommand();
+ (*_cmd) << (int16_t) 0x1510; // SetDNSServers
+ (*_cmd) << servers;
+ sendAsyncCommand();
+}
+
+bool BrowserClientBase::sendRawCmd(const char* rawCmd)
+{
+ gchar** strSplit = g_strsplit(rawCmd, " ", 0);
+
+ int argCount = 0;
+ while (strSplit[argCount] != 0) argCount++;
+ if (argCount == 0) return false;
+
+ bool matched = false;
+
+ if (!matched && (strcmp(strSplit[0], "Connect") == 0)) {
+ if ((argCount - 1) < 6) return false;
+ matched = true;
+
+ int32_t pageWidth = atol(strSplit[1]);
+ int32_t pageHeight = atol(strSplit[2]);
+ int32_t sharedBufferKey1 = atol(strSplit[3]);
+ int32_t sharedBufferKey2 = atol(strSplit[4]);
+ int32_t sharedBufferSize = atol(strSplit[5]);
+ int32_t identifier = atol(strSplit[6]);
+
+ asyncCmdConnect(pageWidth, pageHeight, sharedBufferKey1, sharedBufferKey2, sharedBufferSize, identifier);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetWindowSize") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ int32_t width = atol(strSplit[1]);
+ int32_t height = atol(strSplit[2]);
+
+ asyncCmdSetWindowSize(width, height);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetUserAgent") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ char* userAgent = strSplit[1];
+
+ asyncCmdSetUserAgent(userAgent);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "OpenUrl") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ char* url = strSplit[1];
+
+ asyncCmdOpenUrl(url);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetHtml") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ char* url = strSplit[1];
+ char* body = strSplit[2];
+
+ asyncCmdSetHtml(url, body);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "ClickAt") == 0)) {
+ if ((argCount - 1) < 4) return false;
+ matched = true;
+
+ int32_t contentX = atol(strSplit[1]);
+ int32_t contentY = atol(strSplit[2]);
+ int32_t numClicks = atol(strSplit[3]);
+ int32_t counter = atol(strSplit[4]);
+
+ asyncCmdClickAt(contentX, contentY, numClicks, counter);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "KeyDown") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ uint16_t key = strtoul(strSplit[1], NULL, 0);
+ uint16_t modifiers = strtoul(strSplit[2], NULL, 0);
+
+ asyncCmdKeyDown(key, modifiers);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "KeyUp") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ uint16_t key = strtoul(strSplit[1], NULL, 0);
+ uint16_t modifiers = strtoul(strSplit[2], NULL, 0);
+
+ asyncCmdKeyUp(key, modifiers);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Forward") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdForward();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Back") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdBack();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Reload") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdReload();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Stop") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdStop();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "PageFocused") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ bool focused = (strcasecmp(strSplit[1], "true") == 0);
+
+ asyncCmdPageFocused(focused);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Exit") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdExit();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "CancelDownload") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ char* url = strSplit[1];
+
+ asyncCmdCancelDownload(url);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "InterrogateClicks") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ bool enable = (strcasecmp(strSplit[1], "true") == 0);
+
+ asyncCmdInterrogateClicks(enable);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "ZoomSmartCalculateRequest") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ int32_t pointX = atol(strSplit[1]);
+ int32_t pointY = atol(strSplit[2]);
+
+ asyncCmdZoomSmartCalculateRequest(pointX, pointY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "DragStart") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ int32_t contentX = atol(strSplit[1]);
+ int32_t contentY = atol(strSplit[2]);
+
+ asyncCmdDragStart(contentX, contentY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "DragProcess") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ int32_t deltaX = atol(strSplit[1]);
+ int32_t deltaY = atol(strSplit[2]);
+
+ asyncCmdDragProcess(deltaX, deltaY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "DragEnd") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ int32_t contentX = atol(strSplit[1]);
+ int32_t contentY = atol(strSplit[2]);
+
+ asyncCmdDragEnd(contentX, contentY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetMinFontSize") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ int32_t minFontSizePt = atol(strSplit[1]);
+
+ asyncCmdSetMinFontSize(minFontSizePt);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "FindString") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ char* str = strSplit[1];
+ bool fwd = (strcasecmp(strSplit[2], "true") == 0);
+
+ asyncCmdFindString(str, fwd);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "ClearSelection") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdClearSelection();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "ClearCache") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdClearCache();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "ClearCookies") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdClearCookies();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "PopupMenuSelect") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ char* identifier = strSplit[1];
+ int32_t selectedIdx = atol(strSplit[2]);
+
+ asyncCmdPopupMenuSelect(identifier, selectedIdx);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetEnableJavaScript") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ bool enable = (strcasecmp(strSplit[1], "true") == 0);
+
+ asyncCmdSetEnableJavaScript(enable);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetBlockPopups") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ bool enable = (strcasecmp(strSplit[1], "true") == 0);
+
+ asyncCmdSetBlockPopups(enable);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetAcceptCookies") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ bool enable = (strcasecmp(strSplit[1], "true") == 0);
+
+ asyncCmdSetAcceptCookies(enable);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "MouseEvent") == 0)) {
+ if ((argCount - 1) < 4) return false;
+ matched = true;
+
+ int32_t type = atol(strSplit[1]);
+ int32_t contentX = atol(strSplit[2]);
+ int32_t contentY = atol(strSplit[3]);
+ int32_t detail = atol(strSplit[4]);
+
+ asyncCmdMouseEvent(type, contentX, contentY, detail);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "GestureEvent") == 0)) {
+ if ((argCount - 1) < 7) return false;
+ matched = true;
+
+ int32_t type = atol(strSplit[1]);
+ int32_t contentX = atol(strSplit[2]);
+ int32_t contentY = atol(strSplit[3]);
+ double scale = strtod(strSplit[4], NULL);
+ double rotate = strtod(strSplit[5], NULL);
+ int32_t centerX = atol(strSplit[6]);
+ int32_t centerY = atol(strSplit[7]);
+
+ asyncCmdGestureEvent(type, contentX, contentY, scale, rotate, centerX, centerY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Disconnect") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdDisconnect();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "InspectUrlAtPoint") == 0)) {
+ if ((argCount - 1) < 3) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+ int32_t pointX = atol(strSplit[2]);
+ int32_t pointY = atol(strSplit[3]);
+
+ asyncCmdInspectUrlAtPoint(queryNum, pointX, pointY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "GetHistoryState") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+
+ asyncCmdGetHistoryState(queryNum);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "ClearHistory") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdClearHistory();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetAppIdentifier") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ char* identifier = strSplit[1];
+
+ asyncCmdSetAppIdentifier(identifier);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "AddUrlRedirect") == 0)) {
+ if ((argCount - 1) < 4) return false;
+ matched = true;
+
+ char* urlRe = strSplit[1];
+ int32_t type = atol(strSplit[2]);
+ bool redirect = (strcasecmp(strSplit[3], "true") == 0);
+ char* userData = strSplit[4];
+
+ asyncCmdAddUrlRedirect(urlRe, type, redirect, userData);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetShowClickedLink") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ bool enable = (strcasecmp(strSplit[1], "true") == 0);
+
+ asyncCmdSetShowClickedLink(enable);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "GetInteractiveNodeRects") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ int32_t pointX = atol(strSplit[1]);
+ int32_t pointY = atol(strSplit[2]);
+
+ asyncCmdGetInteractiveNodeRects(pointX, pointY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "IsEditing") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+
+ asyncCmdIsEditing(queryNum);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "InsertStringAtCursor") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ char* text = strSplit[1];
+
+ asyncCmdInsertStringAtCursor(text);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "EnableSelection") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ int32_t pointX = atol(strSplit[1]);
+ int32_t pointY = atol(strSplit[2]);
+
+ asyncCmdEnableSelection(pointX, pointY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "DisableSelection") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdDisableSelection();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SaveImageAtPoint") == 0)) {
+ if ((argCount - 1) < 4) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+ int32_t pointX = atol(strSplit[2]);
+ int32_t pointY = atol(strSplit[3]);
+ char* dstDir = strSplit[4];
+
+ asyncCmdSaveImageAtPoint(queryNum, pointX, pointY, dstDir);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "GetImageInfoAtPoint") == 0)) {
+ if ((argCount - 1) < 3) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+ int32_t pointX = atol(strSplit[2]);
+ int32_t pointY = atol(strSplit[3]);
+
+ asyncCmdGetImageInfoAtPoint(queryNum, pointX, pointY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "IsInteractiveAtPoint") == 0)) {
+ if ((argCount - 1) < 3) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+ int32_t pointX = atol(strSplit[2]);
+ int32_t pointY = atol(strSplit[3]);
+
+ asyncCmdIsInteractiveAtPoint(queryNum, pointX, pointY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "GetElementInfoAtPoint") == 0)) {
+ if ((argCount - 1) < 3) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+ int32_t pointX = atol(strSplit[2]);
+ int32_t pointY = atol(strSplit[3]);
+
+ asyncCmdGetElementInfoAtPoint(queryNum, pointX, pointY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SelectAll") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdSelectAll();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Copy") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+
+ asyncCmdCopy(queryNum);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Paste") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdPaste();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Cut") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdCut();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetMouseMode") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ int32_t mode = atol(strSplit[1]);
+
+ asyncCmdSetMouseMode(mode);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "DisableEnhancedViewport") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ bool disable = (strcasecmp(strSplit[1], "true") == 0);
+
+ asyncCmdDisableEnhancedViewport(disable);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "IgnoreMetaTags") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ bool ignore = (strcasecmp(strSplit[1], "true") == 0);
+
+ asyncCmdIgnoreMetaTags(ignore);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetScrollPosition") == 0)) {
+ if ((argCount - 1) < 4) return false;
+ matched = true;
+
+ int32_t cx = atol(strSplit[1]);
+ int32_t cy = atol(strSplit[2]);
+ int32_t cw = atol(strSplit[3]);
+ int32_t ch = atol(strSplit[4]);
+
+ asyncCmdSetScrollPosition(cx, cy, cw, ch);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "PluginSpotlightStart") == 0)) {
+ if ((argCount - 1) < 4) return false;
+ matched = true;
+
+ int32_t cx = atol(strSplit[1]);
+ int32_t cy = atol(strSplit[2]);
+ int32_t cw = atol(strSplit[3]);
+ int32_t ch = atol(strSplit[4]);
+
+ asyncCmdPluginSpotlightStart(cx, cy, cw, ch);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "PluginSpotlightEnd") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdPluginSpotlightEnd();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "HideSpellingWidget") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdHideSpellingWidget();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetNetworkInterface") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ char* interfaceName = strSplit[1];
+
+ asyncCmdSetNetworkInterface(interfaceName);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "HitTest") == 0)) {
+ if ((argCount - 1) < 3) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+ int32_t cx = atol(strSplit[2]);
+ int32_t cy = atol(strSplit[3]);
+
+ asyncCmdHitTest(queryNum, cx, cy);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetVirtualWindowSize") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ int32_t width = atol(strSplit[1]);
+ int32_t height = atol(strSplit[2]);
+
+ asyncCmdSetVirtualWindowSize(width, height);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "PrintFrame") == 0)) {
+ if ((argCount - 1) < 7) return false;
+ matched = true;
+
+ char* frameName = strSplit[1];
+ int32_t lpsJobId = atol(strSplit[2]);
+ int32_t width = atol(strSplit[3]);
+ int32_t height = atol(strSplit[4]);
+ int32_t dpi = atol(strSplit[5]);
+ bool landscape = (strcasecmp(strSplit[6], "true") == 0);
+ bool reverseOrder = (strcasecmp(strSplit[7], "true") == 0);
+
+ asyncCmdPrintFrame(frameName, lpsJobId, width, height, dpi, landscape, reverseOrder);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "TouchEvent") == 0)) {
+ if ((argCount - 1) < 4) return false;
+ matched = true;
+
+ int32_t type = atol(strSplit[1]);
+ int32_t touchCount = atol(strSplit[2]);
+ int32_t modifiers = atol(strSplit[3]);
+ char* touchesJson = strSplit[4];
+
+ asyncCmdTouchEvent(type, touchCount, modifiers, touchesJson);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "HoldAt") == 0)) {
+ if ((argCount - 1) < 2) return false;
+ matched = true;
+
+ int32_t contentX = atol(strSplit[1]);
+ int32_t contentY = atol(strSplit[2]);
+
+ asyncCmdHoldAt(contentX, contentY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "GetTextCaretBounds") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ int32_t queryNum = atol(strSplit[1]);
+
+ asyncCmdGetTextCaretBounds(queryNum);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Freeze") == 0)) {
+ if ((argCount - 1) < 0) return false;
+ matched = true;
+
+
+ asyncCmdFreeze();
+ }
+
+ if (!matched && (strcmp(strSplit[0], "Thaw") == 0)) {
+ if ((argCount - 1) < 3) return false;
+ matched = true;
+
+ int32_t sharedBufferKey1 = atol(strSplit[1]);
+ int32_t sharedBufferKey2 = atol(strSplit[2]);
+ int32_t sharedBufferSize = atol(strSplit[3]);
+
+ asyncCmdThaw(sharedBufferKey1, sharedBufferKey2, sharedBufferSize);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "ReturnBuffer") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ int32_t sharedBufferKey = atol(strSplit[1]);
+
+ asyncCmdReturnBuffer(sharedBufferKey);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetZoomAndScroll") == 0)) {
+ if ((argCount - 1) < 3) return false;
+ matched = true;
+
+ double zoom = strtod(strSplit[1], NULL);
+ int32_t cx = atol(strSplit[2]);
+ int32_t cy = atol(strSplit[3]);
+
+ asyncCmdSetZoomAndScroll(zoom, cx, cy);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "ScrollLayer") == 0)) {
+ if ((argCount - 1) < 3) return false;
+ matched = true;
+
+ int32_t id = atol(strSplit[1]);
+ int32_t deltaX = atol(strSplit[2]);
+ int32_t deltaY = atol(strSplit[3]);
+
+ asyncCmdScrollLayer(id, deltaX, deltaY);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "SetDNSServers") == 0)) {
+ if ((argCount - 1) < 1) return false;
+ matched = true;
+
+ char* servers = strSplit[1];
+
+ asyncCmdSetDNSServers(servers);
+ }
+
+ if (!matched && (strcmp(strSplit[0], "RenderToFile") == 0)) {
+ if ((argCount - 1) < 5) return false;
+ matched = true;
+
+ char* filename = strSplit[1];
+ int32_t viewX = atol(strSplit[2]);
+ int32_t viewY = atol(strSplit[3]);
+ int32_t viewW = atol(strSplit[4]);
+ int32_t viewH = atol(strSplit[5]);
+
+ int32_t result = 0;
+
+ syncCmdRenderToFile(filename, viewX, viewY, viewW, viewH, result);
+ }
+
+ g_strfreev(strSplit);
+ return matched;
+}
+
+void BrowserClientBase::handleAsyncMessage(YapPacket* _msg)
+{
+ int16_t msgValue;
+
+ (*_msg) >> msgValue;
+
+ switch (msgValue) {
+ case 0x2000: { // Painted
+
+ int32_t sharedBufferKey = 0;
+
+ (*_msg) >> sharedBufferKey;
+
+ msgPainted(sharedBufferKey);
+ break;
+ }
+ case 0x2001: { // ReportError
+
+ char* url = 0;
+ int32_t code = 0;
+ char* msg = 0;
+
+ (*_msg) >> url;
+ (*_msg) >> code;
+ (*_msg) >> msg;
+
+ msgReportError(url, code, msg);
+ free(url);
+ free(msg);
+ break;
+ }
+ case 0x2002: { // ContentsSizeChanged
+
+ int32_t width = 0;
+ int32_t height = 0;
+
+ (*_msg) >> width;
+ (*_msg) >> height;
+
+ msgContentsSizeChanged(width, height);
+ break;
+ }
+ case 0x2004: { // ScrolledTo
+
+ int32_t contentsX = 0;
+ int32_t contentsY = 0;
+
+ (*_msg) >> contentsX;
+ (*_msg) >> contentsY;
+
+ msgScrolledTo(contentsX, contentsY);
+ break;
+ }
+ case 0x2005: { // LoadStarted
+
+
+
+ msgLoadStarted();
+ break;
+ }
+ case 0x2006: { // LoadStopped
+
+
+
+ msgLoadStopped();
+ break;
+ }
+ case 0x2007: { // LoadProgress
+
+ int32_t progress = 0;
+
+ (*_msg) >> progress;
+
+ msgLoadProgress(progress);
+ break;
+ }
+ case 0x2008: { // LocationChanged
+
+ char* uri = 0;
+ bool canGoBack = 0;
+ bool canGoForward = 0;
+
+ (*_msg) >> uri;
+ (*_msg) >> canGoBack;
+ (*_msg) >> canGoForward;
+
+ msgLocationChanged(uri, canGoBack, canGoForward);
+ free(uri);
+ break;
+ }
+ case 0x2009: { // TitleChanged
+
+ char* title = 0;
+
+ (*_msg) >> title;
+
+ msgTitleChanged(title);
+ free(title);
+ break;
+ }
+ case 0x200A: { // TitleAndUrlChanged
+
+ char* title = 0;
+ char* url = 0;
+ bool canGoBack = 0;
+ bool canGoForward = 0;
+
+ (*_msg) >> title;
+ (*_msg) >> url;
+ (*_msg) >> canGoBack;
+ (*_msg) >> canGoForward;
+
+ msgTitleAndUrlChanged(title, url, canGoBack, canGoForward);
+ free(title);
+ free(url);
+ break;
+ }
+ case 0x200B: { // DialogAlert
+
+ char* syncPipePath = 0;
+ char* msg = 0;
+
+ (*_msg) >> syncPipePath;
+ (*_msg) >> msg;
+
+ msgDialogAlert(syncPipePath, msg);
+ free(syncPipePath);
+ free(msg);
+ break;
+ }
+ case 0x200C: { // DialogConfirm
+
+ char* syncPipePath = 0;
+ char* msg = 0;
+
+ (*_msg) >> syncPipePath;
+ (*_msg) >> msg;
+
+ msgDialogConfirm(syncPipePath, msg);
+ free(syncPipePath);
+ free(msg);
+ break;
+ }
+ case 0x200D: { // DialogPrompt
+
+ char* syncPipePath = 0;
+ char* msg = 0;
+ char* defaultValue = 0;
+
+ (*_msg) >> syncPipePath;
+ (*_msg) >> msg;
+ (*_msg) >> defaultValue;
+
+ msgDialogPrompt(syncPipePath, msg, defaultValue);
+ free(syncPipePath);
+ free(msg);
+ free(defaultValue);
+ break;
+ }
+ case 0x200E: { // DialogUserPassword
+
+ char* syncPipePath = 0;
+ char* msg = 0;
+
+ (*_msg) >> syncPipePath;
+ (*_msg) >> msg;
+
+ msgDialogUserPassword(syncPipePath, msg);
+ free(syncPipePath);
+ free(msg);
+ break;
+ }
+ case 0x200F: { // ActionData
+
+ char* dataType = 0;
+ char* data = 0;
+
+ (*_msg) >> dataType;
+ (*_msg) >> data;
+
+ msgActionData(dataType, data);
+ free(dataType);
+ free(data);
+ break;
+ }
+ case 0x2010: { // DownloadStart
+
+ char* url = 0;
+
+ (*_msg) >> url;
+
+ msgDownloadStart(url);
+ free(url);
+ break;
+ }
+ case 0x2011: { // DownloadProgress
+
+ char* url = 0;
+ int32_t totalSizeSoFar = 0;
+ int32_t totalSize = 0;
+
+ (*_msg) >> url;
+ (*_msg) >> totalSizeSoFar;
+ (*_msg) >> totalSize;
+
+ msgDownloadProgress(url, totalSizeSoFar, totalSize);
+ free(url);
+ break;
+ }
+ case 0x2012: { // DownloadError
+
+ char* url = 0;
+ char* errorMsg = 0;
+
+ (*_msg) >> url;
+ (*_msg) >> errorMsg;
+
+ msgDownloadError(url, errorMsg);
+ free(url);
+ free(errorMsg);
+ break;
+ }
+ case 0x2013: { // DownloadFinished
+
+ char* url = 0;
+ char* mimeType = 0;
+ char* tmpFilePath = 0;
+
+ (*_msg) >> url;
+ (*_msg) >> mimeType;
+ (*_msg) >> tmpFilePath;
+
+ msgDownloadFinished(url, mimeType, tmpFilePath);
+ free(url);
+ free(mimeType);
+ free(tmpFilePath);
+ break;
+ }
+ case 0x2014: { // LinkClicked
+
+ char* url = 0;
+
+ (*_msg) >> url;
+
+ msgLinkClicked(url);
+ free(url);
+ break;
+ }
+ case 0x2015: { // MimeHandoffUrl
+
+ char* mimeType = 0;
+ char* url = 0;
+
+ (*_msg) >> mimeType;
+ (*_msg) >> url;
+
+ msgMimeHandoffUrl(mimeType, url);
+ free(mimeType);
+ free(url);
+ break;
+ }
+ case 0x2016: { // MimeNotSupported
+
+ char* mimeType = 0;
+ char* url = 0;
+
+ (*_msg) >> mimeType;
+ (*_msg) >> url;
+
+ msgMimeNotSupported(mimeType, url);
+ free(mimeType);
+ free(url);
+ break;
+ }
+ case 0x2017: { // CreatePage
+
+ int32_t identifier = 0;
+
+ (*_msg) >> identifier;
+
+ msgCreatePage(identifier);
+ break;
+ }
+ case 0x2018: { // ClickRejected
+
+ int32_t counter = 0;
+
+ (*_msg) >> counter;
+
+ msgClickRejected(counter);
+ break;
+ }
+ case 0x2019: { // PopupMenuShow
+
+ char* identifier = 0;
+ char* menuDataFileName = 0;
+
+ (*_msg) >> identifier;
+ (*_msg) >> menuDataFileName;
+
+ msgPopupMenuShow(identifier, menuDataFileName);
+ free(identifier);
+ free(menuDataFileName);
+ break;
+ }
+ case 0x201A: { // PopupMenuHide
+
+ char* identifier = 0;
+
+ (*_msg) >> identifier;
+
+ msgPopupMenuHide(identifier);
+ free(identifier);
+ break;
+ }
+ case 0x201F: { // SmartZoomCalculateResponseSimple
+
+ int32_t pointX = 0;
+ int32_t pointY = 0;
+ int32_t left = 0;
+ int32_t top = 0;
+ int32_t right = 0;
+ int32_t bottom = 0;
+ int32_t fullscreenSpotlightHandle = 0;
+
+ (*_msg) >> pointX;
+ (*_msg) >> pointY;
+ (*_msg) >> left;
+ (*_msg) >> top;
+ (*_msg) >> right;
+ (*_msg) >> bottom;
+ (*_msg) >> fullscreenSpotlightHandle;
+
+ msgSmartZoomCalculateResponseSimple(pointX, pointY, left, top, right, bottom, fullscreenSpotlightHandle);
+ break;
+ }
+ case 0x201C: { // FailedLoad
+
+ char* domain = 0;
+ int32_t errorCode = 0;
+ char* failingURL = 0;
+ char* localizedDescription = 0;
+
+ (*_msg) >> domain;
+ (*_msg) >> errorCode;
+ (*_msg) >> failingURL;
+ (*_msg) >> localizedDescription;
+
+ msgFailedLoad(domain, errorCode, failingURL, localizedDescription);
+ free(domain);
+ free(failingURL);
+ free(localizedDescription);
+ break;
+ }
+ case 0x201D: { // EditorFocused
+
+ bool focused = 0;
+ int32_t fieldType = 0;
+ int32_t fieldActions = 0;
+
+ (*_msg) >> focused;
+ (*_msg) >> fieldType;
+ (*_msg) >> fieldActions;
+
+ msgEditorFocused(focused, fieldType, fieldActions);
+ break;
+ }
+ case 0x201E: { // DidFinishDocumentLoad
+
+
+
+ msgDidFinishDocumentLoad();
+ break;
+ }
+ case 0x2020: { // UpdateGlobalHistory
+
+ char* url = 0;
+ bool reload = 0;
+
+ (*_msg) >> url;
+ (*_msg) >> reload;
+
+ msgUpdateGlobalHistory(url, reload);
+ free(url);
+ break;
+ }
+ case 0x2021: { // SetMainDocumentError
+
+ char* domain = 0;
+ int32_t errorCode = 0;
+ char* failingURL = 0;
+ char* localizedDescription = 0;