[cleanup] Remove Fuchsia minibrowser

It is no longer used and depends on input APIs that are going away.

Testing: build with --args use_prebuilt_webkit=false and logged in with Google.

Change-Id: Idf255c71c4f025c0970c25a046fa6abb2aa045d0
diff --git a/Tools/CMakeLists.txt b/Tools/CMakeLists.txt
index 3e00ce9..4b2edb8 100644
--- a/Tools/CMakeLists.txt
+++ b/Tools/CMakeLists.txt
@@ -35,8 +35,6 @@
     if (ENABLE_API_TESTS)
         add_subdirectory(TestWebKitAPI)
     endif ()
-elseif ("${PORT}" STREQUAL "Fuchsia")
-    add_subdirectory(MiniBrowser/fuchsia)
 endif ()
 
 if (WIN32)
diff --git a/Tools/MiniBrowser/fuchsia/CMakeLists.txt b/Tools/MiniBrowser/fuchsia/CMakeLists.txt
deleted file mode 100644
index 640ff34..0000000
--- a/Tools/MiniBrowser/fuchsia/CMakeLists.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-set(MINIBROWSER_DIR "${TOOLS_DIR}/MiniBrowser/fuchsia")
-
-FIND_LIBRARY(PIXMAN pixman-1)
-FIND_LIBRARY(EXPAT expat)
-FIND_LIBRARY(CURL curl)
-FIND_LIBRARY(CRYPTO crypto)
-FIND_LIBRARY(SSL ssl)
-FIND_LIBRARY(XML xml2)
-FIND_LIBRARY(ZLIB libz.so.1)
-
-set(MiniBrowser_SOURCES
-    ${MINIBROWSER_DIR}/main.cpp
-    ${MINIBROWSER_DIR}/FuchsiaCursor.cpp
-    ${MINIBROWSER_DIR}/FuchsiaInputHandler.cpp
-)
-
-set(MiniBrowser_INCLUDE_DIRECTORIES
-    ${CMAKE_BINARY_DIR}
-    ${CMAKE_SOURCE_DIR}/Source
-    "${WEBCORE_DIR}/platform/graphics/freetype"
-    "${WEBCORE_DIR}/platform/graphics/harfbuzz"
-    "${WEBCORE_DIR}/platform/graphics/opentype"
-    ${DERIVED_SOURCES_DIR}
-    ${DERIVED_SOURCES_DIR}/WebCore
-    ${DERIVED_SOURCES_DIR}/ForwardingHeaders
-    ${DERIVED_SOURCES_DIR}/ForwardingHeaders/JavaScriptCore
-    ${DERIVED_SOURCES_DIR}/ForwardingHeaders/WebCore
-    ${DERIVED_SOURCES_DIR}/ForwardingHeaders/WebKit
-    ${WTF_DIR}
-    ${WEBCORE_DIR}
-    ${JAVASCRIPTCORE_DIR}
-    ${FORWARDING_HEADERS_DIR}
-    ${MINIBROWSER_DIR}
-    ${CAIRO_INCLUDE_DIRS}
-    ${FREETYPE2_HEADER_DIR}
-    ${HARFBUZZ_INCLUDE_DIRS}
-)
-
-link_directories("lib")
-
-set(MiniBrowser_LIBRARIES
-    JavaScriptCore
-    WebCore
-    hid
-    ${CMAKE_BINARY_DIR}/lib/libWebKitLegacy.a
-    ${PIXMAN}
-    ${CAIRO_LIBRARIES}
-    ${ENCHANT_LIBRARIES}
-    ${FREETYPE2_LIBRARIES}
-    ${HARFBUZZ_LIBRARIES}
-    ${LIBXML2_LIBRARIES}
-    ${SQLITE_LIBRARIES}
-    ${ZLIB_LIBRARIES}
-    ${CURL}
-    ${EXPAT}
-)
-
-set(EXECUTABLE_NAME MiniBrowser)
-set(PRODUCT_NAME MiniBrowser)
-
-include_directories(${MiniBrowser_INCLUDE_DIRECTORIES})
-add_executable(MiniBrowser ${MiniBrowser_SOURCES})
-target_link_libraries(MiniBrowser ${MiniBrowser_LIBRARIES})
diff --git a/Tools/MiniBrowser/fuchsia/FuchsiaCursor.cpp b/Tools/MiniBrowser/fuchsia/FuchsiaCursor.cpp
deleted file mode 100644
index d83373b..0000000
--- a/Tools/MiniBrowser/fuchsia/FuchsiaCursor.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2016 The Fuchsia Authors. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS 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 "FuchsiaCursor.h"
-
-#include "FuchsiaInputHandler.h"
-
-namespace Fuchsia {
-
-using namespace std;
-
-Cursor::Cursor()
-    : Cursor(1024, 768)
-{
-}
-
-Cursor::Cursor(int maxX, int maxY)
-    : fMaxX(maxX)
-    , fMaxY(maxY)
-    , fX(0)
-    , fY(0)
-    , fButtons(0)
-{
-}
-
-Cursor::ButtonActions Cursor::handleEvent(const MouseEvent& evt)
-{
-    ButtonActions actions;
-    fX += evt.fDeltaX;
-    fX = std::max(fX, 0);
-    fX = std::min(fX, fMaxX);
-    fY += evt.fDeltaY;
-    fY = std::max(fY, 0);
-    fY = std::min(fY, fMaxY);
-    bitset<8> newButtons(evt.fButtons);
-    for (int i = 0; i < kBitCount; ++i) {
-        if (newButtons[i] != fButtons[i]) {
-            if (newButtons[i]) {
-                actions[i] = ButtonAction::kDown;
-            } else {
-                actions[i] = ButtonAction::kUp;
-            }
-        } else {
-            actions[i] = ButtonAction::kNoChange;
-        }
-    }
-    fButtons = newButtons;
-    return actions;
-}
-}
diff --git a/Tools/MiniBrowser/fuchsia/FuchsiaCursor.h b/Tools/MiniBrowser/fuchsia/FuchsiaCursor.h
deleted file mode 100644
index 86bccd1..0000000
--- a/Tools/MiniBrowser/fuchsia/FuchsiaCursor.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2016 The Fuchsia Authors. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS 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.
- */
-
-#pragma once
-
-#include <bitset>
-#include <future>
-#include <map>
-#include <vector>
-
-#include <zircon/types.h>
-
-namespace Fuchsia {
-
-class MouseEvent;
-
-class Cursor {
-public:
-    enum ButtonAction { kNoChange,
-        kDown,
-        kUp };
-    typedef std::map<int, ButtonAction> ButtonActions;
-    Cursor();
-    Cursor(int maxX, int maxY);
-
-    ButtonActions handleEvent(const MouseEvent&);
-
-    int getX() const { return fX; }
-    int getY() const { return fY; }
-
-private:
-    int fMaxX;
-    int fMaxY;
-    int fX;
-    int fY;
-
-    constexpr static int kBitCount = 8;
-
-    std::bitset<kBitCount> fButtons;
-};
-}
diff --git a/Tools/MiniBrowser/fuchsia/FuchsiaInputHandler.cpp b/Tools/MiniBrowser/fuchsia/FuchsiaInputHandler.cpp
deleted file mode 100644
index 08c52ca..0000000
--- a/Tools/MiniBrowser/fuchsia/FuchsiaInputHandler.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright 2016 The Fuchsia Authors. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS 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 "FuchsiaInputHandler.h"
-
-#include <wtf/Assertions.h>
-
-#include <dirent.h>
-#include <fcntl.h>
-#include <hid/hid.h>
-#include <hid/usages.h>
-#include <zircon/device/device.h>
-#include <zircon/device/input.h>
-#include <zircon/syscalls.h>
-#include <zircon/types.h>
-#include <lib/fdio/io.h>
-#include <stdlib.h>
-
-#include <iostream>
-#include <sstream>
-#include <thread>
-
-const char* kDevInput = "/dev/class/input";
-
-namespace Fuchsia {
-
-using namespace std;
-
-#pragma mark - InputReportHandler
-
-InputReportHandler::InputReportHandler(int descriptor, const std::string& deviceName)
-    : fDescriptor(descriptor)
-    , fName(deviceName)
-{
-}
-
-InputReportHandler::~InputReportHandler()
-{
-}
-
-ssize_t InputReportHandler::openHandle()
-{
-    zx_handle_t handle;
-    ssize_t ret = fdio_ioctl(fDescriptor, IOCTL_DEVICE_GET_EVENT_HANDLE, nullptr, 0,
-        &handle, sizeof(handle));
-    if (ret >= 0) {
-        fHandle = handle;
-    }
-    return ret;
-}
-
-void InputReportHandler::checkForEvents(EventList& events)
-{
-    size_t max_report_len = 0;
-    int rc = fdio_ioctl(fDescriptor, IOCTL_INPUT_GET_MAX_REPORTSIZE, NULL, 0, &max_report_len, sizeof(max_report_len));
-    if (rc < 0) {
-        WTFLogAlways("hid: could not get max report size from %d: %d", fDescriptor, rc);
-    }
-
-    vector<char> buffer(max_report_len);
-
-    int r = read(fDescriptor, &buffer[0], max_report_len);
-    handleReport(r, &buffer[0], events);
-}
-
-#pragma mark - MouseReportHandler
-
-MouseReportHandler::MouseReportHandler(int descriptor, const std::string& deviceName)
-    : InputReportHandler(descriptor, deviceName)
-{
-}
-
-void MouseReportHandler::handleReport(size_t byteLength, const char* reportData, EventList& events)
-{
-    const boot_mouse_report_t* mouseReport = reinterpret_cast<const boot_mouse_report_t*>(reportData);
-    while (byteLength > 0) {
-        EventPtr eventP(new MouseEvent(fDescriptor, mouseReport->rel_x, mouseReport->rel_y, mouseReport->buttons));
-        events.push_back(eventP);
-        byteLength -= 3;
-        mouseReport += 1;
-    }
-}
-
-#pragma mark - KeyboardReportHandler
-
-KeyboardReportHandler::KeyboardReportHandler(int descriptor, const std::string& deviceName)
-    : InputReportHandler(descriptor, deviceName)
-{
-}
-
-void KeyboardReportHandler::handleReport(size_t byteLength, const char* reportData, EventList& events)
-{
-    const uint8_t* keyboardReport = reinterpret_cast<const uint8_t*>(reportData);
-    uint8_t* keyboardReportWriteableSigh = const_cast<uint8_t*>(keyboardReport);
-    uint8_t keycode;
-    hid_keys_t newKeyState;
-    hid_keys_t keyDelta;
-    hid_kbd_parse_report(keyboardReportWriteableSigh, &newKeyState);
-    hid_kbd_pressed_keys(&fKeyState, &newKeyState, &keyDelta);
-    hid_for_every_key(&keyDelta, keycode) {
-        EventPtr eventP(new KeyEvent(fDescriptor, keycode, true));
-        events.push_back(eventP);
-    }
-    hid_kbd_released_keys(&fKeyState, &newKeyState, &keyDelta);
-    hid_for_every_key(&keyDelta, keycode) {
-        EventPtr eventP(new KeyEvent(fDescriptor, keycode, false));
-        events.push_back(eventP);
-    }
-    fKeyState = newKeyState;
-}
-
-#pragma mark - InputHandler
-
-InputHandler::InputHandler()
-{
-}
-
-static int get_hid_protocol(int fd, const char* name)
-{
-    int proto = 0;
-    int rc = fdio_ioctl(fd, IOCTL_INPUT_GET_PROTOCOL, NULL, 0, &proto, sizeof(proto));
-    if (rc < 0) {
-        WTFLogAlways("hid: could not get protocol from %s (status=%d)\n", name, rc);
-    } else {
-        WTFLogAlways("hid: %s proto=%d\n", name, proto);
-    }
-    return proto;
-}
-
-static void checkForEvents(int fd, EventList& events)
-{
-    size_t max_report_len = 0;
-    int rc = fdio_ioctl(fd, IOCTL_INPUT_GET_MAX_REPORTSIZE, NULL, 0, &max_report_len, sizeof(max_report_len));
-    if (rc < 0) {
-        WTFLogAlways("hid: could not get max report size from %d: %d", fd, rc);
-        return;
-    }
-
-    vector<char> buffer(max_report_len);
-
-    int proto = 0;
-    rc = fdio_ioctl(fd, IOCTL_INPUT_GET_PROTOCOL, NULL, 0, &proto, sizeof(proto));
-    if (rc < 0) {
-        WTFLogAlways("hid: could not get protocol (status=%d)", rc);
-        return;
-    }
-
-    int r = read(fd, &buffer[0], max_report_len);
-
-    if (proto == INPUT_PROTO_MOUSE) {
-        boot_mouse_report_t* mouseReport = reinterpret_cast<boot_mouse_report_t*>(&buffer[0]);
-        while (r > 0) {
-            EventPtr eventP(new MouseEvent(fd, mouseReport->rel_x, mouseReport->rel_y, mouseReport->buttons));
-            events.push_back(eventP);
-            r -= 3;
-            mouseReport += 1;
-        }
-    } else if (proto == INPUT_PROTO_KBD) {
-        boot_kbd_report* kbdReport = reinterpret_cast<boot_kbd_report*>(&buffer[0]);
-        while (r > 0) {
-            WTFLogAlways("keyboard action");
-            r -= sizeof(boot_kbd_report);
-            kbdReport += 1;
-        }
-    }
-}
-
-static EventList waitForEvents(vector<InputReportHandlerPtr> reportHandlers)
-{
-    EventList events;
-    vector<zx_wait_item_t> items;
-    for (const auto& oneReportHandler : reportHandlers) {
-        zx_wait_item_t item = { oneReportHandler->handle(), DEVICE_SIGNAL_READABLE, 0 };
-        items.push_back(item);
-    }
-    zx_status_t result = zx_object_wait_many(&items[0], items.size(),
-        ZX_TIME_INFINITE);
-    if (result == ZX_OK) {
-        int index = 0;
-        for (const auto& oneItem : items) {
-            if (oneItem.pending & DEVICE_SIGNAL_READABLE) {
-                auto& oneReportHandler(reportHandlers[index]);
-                oneReportHandler->checkForEvents(events);
-            }
-            index += 1;
-        }
-    }
-    return events;
-}
-
-void InputHandler::openDevices()
-{
-    struct dirent* de;
-    DIR* dir = opendir(kDevInput);
-    if (!dir) {
-        WTFLogAlways("hid: error opening %s", kDevInput);
-        return;
-    }
-
-    while ((de = readdir(dir)) != NULL) {
-        ostringstream oss;
-        oss << kDevInput << "/" << de->d_name;
-        string dname(oss.str());
-        int fd = open(dname.c_str(), O_RDONLY);
-        if (fd >= 0) {
-            int proto = get_hid_protocol(fd, dname.c_str());
-            InputReportHandlerPtr p;
-            if (proto == INPUT_PROTO_MOUSE) {
-                p.reset(new MouseReportHandler(fd, dname));
-            } else if (proto == INPUT_PROTO_KBD) {
-                p.reset(new KeyboardReportHandler(fd, dname));
-            } else {
-                close(fd);
-            }
-
-            if (p) {
-                if (p->openHandle() >= 0) {
-                    fReportHandlers.push_back(p);
-                }
-            }
-        }
-    }
-
-    startReaderThread();
-}
-
-bool InputHandler::hasEvents()
-{
-    std::lock_guard<std::mutex> lock(fEventsMutex);
-    bool v = !fEvents.empty();
-    return v;
-}
-
-EventList InputHandler::getPendingEvents()
-{
-    std::lock_guard<std::mutex> lock(fEventsMutex);
-    EventList pending(fEvents);
-    fEvents.clear();
-    return pending;
-}
-
-void InputHandler::addEvents(const EventList& newEvents)
-{
-    std::lock_guard<std::mutex> lock(fEventsMutex);
-    fEvents.insert(std::end(fEvents), std::begin(newEvents), std::end(newEvents));
-}
-
-void InputHandler::readEvents()
-{
-    while(1) {
-        EventList newEvents = waitForEvents(fReportHandlers);
-        addEvents(newEvents);
-    }
-}
-
-void InputHandler::startReaderThread()
-{
-    fEventReaderThread = std::thread(&InputHandler::readEvents,this);
-}
-
-}
diff --git a/Tools/MiniBrowser/fuchsia/FuchsiaInputHandler.h b/Tools/MiniBrowser/fuchsia/FuchsiaInputHandler.h
deleted file mode 100644
index 7003148..0000000
--- a/Tools/MiniBrowser/fuchsia/FuchsiaInputHandler.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright 2016 The Fuchsia Authors. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS 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.
- */
-
-#pragma once
-
-#include <wtf/Noncopyable.h>
-
-#include <hid/hid.h>
-
-#include <future>
-#include <map>
-#include <string>
-#include <vector>
-
-#include <zircon/types.h>
-
-namespace Fuchsia {
-
-#pragma mark - Event
-
-class Event {
-public:
-    enum Type {
-        kMouse,
-        kKey
-    };
-
-    Type type() const { return fType; }
-    int eventSource() const { return fEventSource; }
-
-protected:
-    Event(Type type, int eventSource)
-        : fType(type)
-        , fEventSource(eventSource)
-    {
-    }
-
-    virtual ~Event() {}
-
-private:
-    Type fType;
-    int fEventSource;
-};
-
-typedef std::shared_ptr<Event> EventPtr;
-typedef std::vector<EventPtr> EventList;
-
-#pragma mark - MouseEvent
-
-class MouseEvent : public Event {
-public:
-    MouseEvent(int fd, int x, int y, int buttons)
-        : Event(kMouse, fd)
-        , fDeltaX(x)
-        , fDeltaY(y)
-        , fButtons(buttons)
-    {
-    }
-
-    int fDeltaX;
-    int fDeltaY;
-    int fButtons;
-};
-
-#pragma mark - KeyEvent
-
-class KeyEvent : public Event {
-public:
-    KeyEvent(int fd, uint8_t keyCode, bool pressed)
-        : Event(kKey, fd)
-        , fKeyCode(keyCode)
-        , fPressed(pressed)
-    {
-    }
-
-    uint8_t keycode() const { return fKeyCode; }
-    bool pressed() const { return fPressed; }
-
-private:
-    uint8_t fKeyCode;
-    bool fPressed;
-};
-
-#pragma mark - InputReportHandler
-
-
-class InputReportHandler {
-public:
-    ssize_t openHandle();
-
-    void checkForEvents(EventList&);
-
-    int descriptor() const { return fDescriptor; }
-    zx_handle_t handle() const { return fHandle; }
-
-protected:
-    InputReportHandler(int descriptor, const std::string& deviceName);
-    virtual ~InputReportHandler();
-
-    virtual void handleReport(size_t byteLength, const char* reportData, EventList& events) = 0;
-
-    int fDescriptor;
-    std::string fName;
-    zx_handle_t fHandle = { ZX_HANDLE_INVALID };
-};
-
-typedef std::shared_ptr<InputReportHandler> InputReportHandlerPtr;
-
-class MouseReportHandler : public InputReportHandler {
-public:
-    MouseReportHandler(int descriptor, const std::string& deviceName);
-    void handleReport(size_t byteLength, const char* reportData, EventList& events) override;
-};
-
-class KeyboardReportHandler : public InputReportHandler {
-public:
-    KeyboardReportHandler(int descriptor, const std::string& deviceName);
-    void handleReport(size_t byteLength, const char* reportData, EventList& events) override;
-
-private:
-    hid_keys_t fKeyState = {};
-};
-
-class InputHandler {
-    WTF_MAKE_NONCOPYABLE(InputHandler);
-
-public:
-    InputHandler();
-
-    void openDevices();
-
-    bool hasEvents();
-    EventList getPendingEvents();
-    void addEvents(const EventList& newEvents);
-
-private:
-    void startReaderThread();
-    void readEvents();
-
-    std::vector<InputReportHandlerPtr> fReportHandlers;
-    EventList fEvents;
-    std::mutex fEventsMutex;
-    std::thread fEventReaderThread;
-};
-
-}
diff --git a/Tools/MiniBrowser/fuchsia/main.cpp b/Tools/MiniBrowser/fuchsia/main.cpp
deleted file mode 100644
index ac52649..0000000
--- a/Tools/MiniBrowser/fuchsia/main.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright 2016 The Fuchsia Authors. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS 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 "cmakeconfig.h"
-
-#include <algorithm>
-#include <chrono>
-#include <iostream>
-#include <map>
-
-#include <cairo/cairo.h>
-
-#include <fcntl.h>
-#include <math.h>
-
-#include <assert.h>
-#include <dirent.h>
-#include <hid/hid.h>
-#include <hid/usages.h>
-#include <zircon/device/console.h>
-#include <zircon/device/display.h>
-#include <zircon/pixelformat.h>
-#include <zircon/process.h>
-#include <zircon/syscalls.h>
-#include <zircon/types.h>
-#include <lib/fdio/io.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#include <WebKit/fuchsia/WebView.h>
-
-#include "FuchsiaCursor.h"
-#include "FuchsiaInputHandler.h"
-
-using namespace WebCore;
-
-using std::endl;
-using std::cout;
-using std::cerr;
-
-using Fuchsia::Event;
-using Fuchsia::MouseEvent;
-using Fuchsia::KeyEvent;
-
-#define USE_INPUT 1
-
-constexpr float kMinimumZoomMultiplier = 0.5f;
-constexpr float kMaximumZoomMultiplier = 3.0f;
-constexpr float kZoomMultiplierRatio = 1.2f;
-
-// TODO: replace the hard coded device 000 with some method of getting
-//       the first device.
-constexpr char kVirtualConsole[] = "/dev/class/framebuffer/000";
-
-int main(int argc, char** argv)
-{
-    std::string urlToOpen = "file:///system/docs/input.html";
-
-    if (argc > 1) {
-        urlToOpen = argv[1];
-        if (urlToOpen[0] == '/') {
-            urlToOpen = "file://" + urlToOpen;
-        }
-    }
-
-    cout << "Welcome to MiniBrowser" << endl;
-
-    int fd = open(kVirtualConsole, O_RDWR);
-    if (fd < 0) {
-        cout << "Failed to open frame buffer:" << errno << endl;
-        return -1;
-    }
-
-    ssize_t result = fdio_ioctl(fd, IOCTL_CONSOLE_SET_ACTIVE_VC, NULL, 0, NULL, 0);
-    if (result < 0) {
-        cout << "could not set active console: " << result << endl;
-        cout << "press f1/f2 to switch consoles" << endl;
-    }
-
-    ioctl_display_get_fb_t frameBuffer;
-    result = fdio_ioctl(fd, IOCTL_DISPLAY_GET_FB, nullptr, 0, &frameBuffer,
-        sizeof(frameBuffer));
-
-    if (result < 0) {
-        cout << "DISPLAY_OP_GET_FB failed.";
-        close(fd);
-        return -1;
-    }
-
-#if 1
-    uint32_t beFull = 1;
-    ssize_t resultFs = fdio_ioctl(fd, IOCTL_DISPLAY_SET_FULLSCREEN, &beFull, sizeof(beFull), NULL, 0);
-    if (resultFs < 0) {
-        cout << "could not set full screen: " << resultFs << endl;
-    }
-#endif
-
-    size_t rowbytes = frameBuffer.info.stride * frameBuffer.info.pixelsize;
-    size_t size = rowbytes * frameBuffer.info.height;
-
-    uintptr_t buffer = 0;
-
-    zx_status_t status = zx_vmar_map(zx_vmar_root_self(),
-        ZX_VM_PERM_READ | ZX_VM_PERM_WRITE, 0, frameBuffer.vmo, 0, size, &buffer);
-
-    if (status < 0) {
-        cout << "Cannot map frame buffer " << status << endl;
-        return -1;
-    }
-
-    auto cursorSurface = cairo_image_surface_create_from_png("/system/docs/cursor32.png");
-    int w = cairo_image_surface_get_width(cursorSurface);
-    int h = cairo_image_surface_get_height(cursorSurface);
-    cout << "cursor size is " << w << ", " << h << endl;
-
-    cairo_format_t format = CAIRO_FORMAT_INVALID;
-    switch (frameBuffer.info.format) {
-    case ZX_PIXEL_FORMAT_RGB_565:
-        format = CAIRO_FORMAT_RGB16_565;
-        break;
-    case ZX_PIXEL_FORMAT_RGB_x888:
-        format = CAIRO_FORMAT_RGB24;
-        break;
-    case ZX_PIXEL_FORMAT_ARGB_8888:
-        format = CAIRO_FORMAT_ARGB32;
-        break;
-    case ZX_PIXEL_FORMAT_MONO_8:
-        format = CAIRO_FORMAT_A8;
-        break;
-    default:
-        cout << "Unsupported pixel format " << frameBuffer.info.format << endl;
-        return -1;
-    }
-
-#if USE_INPUT
-    Fuchsia::InputHandler inputHandler;
-    inputHandler.openDevices();
-    std::map<int, Fuchsia::Cursor> cursors;
-#endif
-
-    mkdir("/data/web_view", 0777);
-
-    WebView webView;
-    webView.setup(reinterpret_cast<unsigned char*>(buffer), frameBuffer.info.format, frameBuffer.info.width, frameBuffer.info.height, rowbytes);
-    webView.setURL(urlToOpen);
-
-    webView.setFocused(true);
-    webView.setVisible(true);
-    bool shiftDown = false;
-    bool controlDown = false;
-    float webScale = 1.0;
-
-    while (true) {
-#if USE_INPUT
-        if (inputHandler.hasEvents()) {
-            auto events = inputHandler.getPendingEvents();
-            for (const auto& oneEvent : events) {
-                if (oneEvent->type() == Event::kMouse) {
-                    MouseEvent* mouseEvent = static_cast<MouseEvent*>(oneEvent.get());
-                    auto cursorP = cursors.find(mouseEvent->eventSource());
-                    if (cursorP == cursors.end()) {
-                        auto insertResult = cursors.insert(std::make_pair(mouseEvent->eventSource(),
-                            Fuchsia::Cursor(frameBuffer.info.width, frameBuffer.info.height)));
-                        cursorP = insertResult.first;
-                    }
-                    auto actions = cursorP->second.handleEvent(*mouseEvent);
-                    for (const auto& actionPair : actions) {
-                        if (actionPair.first == 0) {
-                            if (actionPair.second == Fuchsia::Cursor::ButtonAction::kDown) {
-                                webView.handleMouseEvent(cursorP->second.getX(), cursorP->second.getY(), WebView::kMouseDown);
-                            } else if (actionPair.second == Fuchsia::Cursor::ButtonAction::kUp) {
-                                webView.handleMouseEvent(cursorP->second.getX(), cursorP->second.getY(), WebView::kMouseUp);
-                            } else {
-                                webView.handleMouseEvent(cursorP->second.getX(), cursorP->second.getY(), WebView::kMouseMoved);
-                            }
-                        }
-                    }
-                } else if (oneEvent->type() == Event::kKey) {
-                    KeyEvent* keyEvent = static_cast<KeyEvent*>(oneEvent.get());
-                    uint8_t keycode = keyEvent->keycode();
-                    bool pressed = keyEvent->pressed();
-                    if (keycode == HID_USAGE_KEY_LEFT_SHIFT || keycode == HID_USAGE_KEY_RIGHT_SHIFT) {
-                        shiftDown = pressed;
-                    } else if (keycode == HID_USAGE_KEY_LEFT_CTRL || keycode == HID_USAGE_KEY_RIGHT_CTRL) {
-                        controlDown = pressed;
-                    }
-                    if (controlDown && keycode == HID_USAGE_KEY_C) {
-                        cout << "Exit requested." << endl;
-                        exit(0);
-                    }
-                    uint8_t ch = hid_map_key(keycode, shiftDown, qwerty_map);
-                    if (pressed && controlDown && ch == '+') {
-                        float newScale = webScale * kZoomMultiplierRatio;
-                        if (newScale < kMaximumZoomMultiplier) {
-                            webScale = newScale;
-                            webView.setPageAndTextZoomFactors(webScale, 1);
-                        }
-                    } else if (pressed && controlDown && ch == '-') {
-                        float newScale = webScale / kZoomMultiplierRatio;
-                        if (newScale > kMinimumZoomMultiplier) {
-                            webScale = newScale;
-                            webView.setPageAndTextZoomFactors(webScale, 1);
-                        }
-                    } else if (pressed && controlDown && keycode == HID_USAGE_KEY_LEFTBRACE) {
-                        webView.goBack();
-                    } else if (pressed && controlDown && keycode == HID_USAGE_KEY_RIGHTBRACE) {
-                        webView.goForward();
-                    } else if (pressed && controlDown && keycode == HID_USAGE_KEY_R) {
-                        webView.reload();
-                    } else if (pressed && controlDown && keycode == HID_USAGE_KEY_D) {
-                        webView.deleteAllCookies();
-                    } else {
-                        bool handled = webView.handleKeyEvent(keycode, ch, pressed, false);
-                        if (!handled) {
-                            if (keycode == HID_USAGE_KEY_DOWN) {
-                                webView.scrollDownOneLine();
-                            } else if (keycode == HID_USAGE_KEY_UP) {
-                                webView.scrollUpOneLine();
-                            }
-                        }
-                    }
-                }
-            }
-        }
-#endif
-        webView.iterateEventLoop();
-        webView.layoutAndPaint();
-#if USE_INPUT
-        for (const auto& cursor : cursors) {
-            cairo_set_source_surface(webView.cairoContext(), cursorSurface, cursor.second.getX(), cursor.second.getY());
-            cairo_paint(webView.cairoContext());
-        }
-#endif
-        result = fdio_ioctl(fd, IOCTL_DISPLAY_FLUSH_FB, nullptr, 0, nullptr, 0);
-        if (result < 0) {
-            cout << "IOCTL_DISPLAY_FLUSH_FB failed.";
-            close(fd);
-            return -1;
-        }
-    }
-    return 0;
-}