diff --git a/plugin.xml b/plugin.xml
index a630d66..e656ee7 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -30,6 +30,7 @@
+<<<<<<< HEAD
@@ -43,6 +44,13 @@
+
+
+
+
+
+
+
diff --git a/src/ubuntu/InAppBrowser.qml b/src/ubuntu/InAppBrowser.qml
new file mode 100644
index 0000000..03448f6
--- /dev/null
+++ b/src/ubuntu/InAppBrowser.qml
@@ -0,0 +1,69 @@
+/*
+ *
+ * Copyright 2013 Canonical Ltd.
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+*/
+import QtQuick 2.0
+import QtWebKit 3.0
+import Ubuntu.Components.Popups 0.1
+import Ubuntu.Components 0.1
+
+Rectangle {
+ anchors.fill: parent
+ id: inappbrowser
+ property string url1
+ Rectangle {
+ border.color: "black"
+ width: parent.width
+ height: urlEntry.height
+ color: "gray"
+ TextInput {
+ id: urlEntry
+ width: parent.width - closeButton.width
+ text: url1
+ activeFocusOnPress: false
+ }
+ Image {
+ id: closeButton
+ width: height
+ x: parent.width - width
+ height: parent.height
+ source: "close.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ root.exec("InAppBrowser", "close", [0, 0])
+ }
+ }
+ }
+ }
+
+ WebView {
+ width: parent.width
+ y: urlEntry.height
+ height: parent.height - y
+ url: url1
+ onLoadingChanged: {
+ if (loadRequest.status) {
+ root.exec("InAppBrowser", "loadFinished", [loadRequest.status])
+ }
+ }
+ }
+}
diff --git a/src/ubuntu/close.png b/src/ubuntu/close.png
new file mode 100644
index 0000000..56373d1
Binary files /dev/null and b/src/ubuntu/close.png differ
diff --git a/src/ubuntu/inappbrowser.cpp b/src/ubuntu/inappbrowser.cpp
new file mode 100644
index 0000000..d172bab
--- /dev/null
+++ b/src/ubuntu/inappbrowser.cpp
@@ -0,0 +1,106 @@
+/*
+ *
+ * Copyright 2013 Canonical Ltd.
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+#include
+#include
+
+#include "inappbrowser.h"
+#include
+
+Inappbrowser::Inappbrowser(Cordova *cordova): CPlugin(cordova), _eventCb(0) {
+}
+
+const char code[] = "\
+var component, object; \
+function createObject() { \
+ component = Qt.createComponent(%1); \
+ if (component.status == Component.Ready) \
+ finishCreation(); \
+ else \
+ component.statusChanged.connect(finishCreation); \
+} \
+function finishCreation() { \
+ CordovaWrapper.object = component.createObject(root, \
+ {root: root, cordova: cordova, url1: %2}); \
+} \
+createObject()";
+
+const char EXIT_EVENT[] = "'exit'";
+const char LOADSTART_EVENT[] = "'loadstart'";
+const char LOADSTOP_EVENT[] = "'loadstop'";
+const char LOADERROR_EVENT[] = "'loaderror'";
+
+void Inappbrowser::open(int cb, int, const QString &url, const QString &windowName, const QString &windowFeatures) {
+ assert(_eventCb == 0);
+
+ _eventCb = cb;
+
+ QString path = m_cordova->get_app_dir() + "/../qml/InAppBrowser.qml";
+
+ // TODO: relative url
+ QString qml = QString(code)
+ .arg(CordovaInternal::format(path)).arg(CordovaInternal::format(url));
+ m_cordova->execQML(qml);
+}
+
+void Inappbrowser::show(int, int) {
+ m_cordova->execQML("CordovaWrapper.object.visible = true");
+}
+
+void Inappbrowser::close(int, int) {
+ m_cordova->execQML("CordovaWrapper.object.destroy()");
+ this->callbackWithoutRemove(_eventCb, EXIT_EVENT);
+ _eventCb = 0;
+}
+
+void Inappbrowser::injectStyleFile(int cb, int, const QString&, bool) {
+ // TODO:
+ qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
+}
+
+void Inappbrowser::injectStyleCode(int cb, int, const QString&, bool) {
+ // TODO:
+ qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
+}
+
+void Inappbrowser::injectScriptFile(int cb, int, const QString&, bool) {
+ // TODO:
+ qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
+}
+
+void Inappbrowser::injectScriptCode(int cb, int, const QString&, bool) {
+ // TODO:
+ qCritical() << "unimplemented " << __PRETTY_FUNCTION__;
+}
+
+void Inappbrowser::loadFinished(int status) {
+ if (status == 2) {
+ this->callbackWithoutRemove(_eventCb, LOADERROR_EVENT);
+ }
+ if (status == 0) {
+ this->callbackWithoutRemove(_eventCb, LOADSTART_EVENT);
+ }
+ if (status == 3) {
+ this->callbackWithoutRemove(_eventCb, LOADSTOP_EVENT);
+ }
+}
diff --git a/src/ubuntu/inappbrowser.h b/src/ubuntu/inappbrowser.h
new file mode 100644
index 0000000..7a4a68a
--- /dev/null
+++ b/src/ubuntu/inappbrowser.h
@@ -0,0 +1,61 @@
+/*
+ *
+ * Copyright 2013 Canonical Ltd.
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+#ifndef INAPPBROWSER_H
+#define INAPPBROWSER_H
+
+#include
+#include
+
+class Inappbrowser: public CPlugin {
+ Q_OBJECT
+public:
+ Inappbrowser(Cordova *cordova);
+
+ virtual const QString fullName() override {
+ return Inappbrowser::fullID();
+ }
+
+ virtual const QString shortName() override {
+ return "InAppBrowser";
+ }
+
+ static const QString fullID() {
+ return "InAppBrowser";
+ }
+
+public slots:
+ void open(int cb, int, const QString &url, const QString &windowName, const QString &windowFeatures);
+ void show(int, int);
+ void close(int, int);
+ void injectStyleFile(int cb, int, const QString&, bool);
+ void injectStyleCode(int cb, int, const QString&, bool);
+ void injectScriptFile(int cb, int, const QString&, bool);
+ void injectScriptCode(int cb, int, const QString&, bool);
+
+ void loadFinished(int status);
+
+private:
+ int _eventCb;
+};
+
+#endif