Merge lp:~ted/url-dispatcher/devel into lp:url-dispatcher/16.10

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 107
Merged at revision: 94
Proposed branch: lp:~ted/url-dispatcher/devel
Merge into: lp:url-dispatcher/16.10
Diff against target: 2187 lines (+1247/-130)
50 files modified
CMakeLists.txt (+12/-4)
data/CMakeLists.txt (+10/-0)
data/bad-url.qml (+42/-0)
data/url-dispatcher-update-user.conf.in (+1/-1)
data/url-dispatcher.conf.in (+4/-0)
debian/apparmor/url-dispatcher-bad-url-helper (+15/-0)
debian/changelog (+25/-2)
debian/control (+24/-5)
debian/rules (+4/-0)
debian/url-dispatcher-tools-gui.install (+2/-0)
debian/url-dispatcher.install (+3/-0)
gui/CMakeLists.txt (+13/-0)
gui/url-dispatcher-gui.desktop.in (+6/-0)
gui/url-dispatcher-gui.qml (+59/-0)
gui/url-dispatcher-gui.svg (+129/-0)
po/CMakeLists.txt (+39/-0)
po/POTFILES.in (+1/-0)
po/genpotfiles.sh (+6/-0)
service/CMakeLists.txt (+11/-13)
service/bad-url/CMakeLists.txt (+14/-0)
service/bad-url/exec-tool.c (+42/-0)
service/dispatcher.c (+141/-6)
service/dispatcher.h (+2/-1)
service/overlay-tracker-iface.h (+1/-0)
service/overlay-tracker-mir.cpp (+70/-39)
service/overlay-tracker-mir.h (+22/-8)
service/overlay-tracker.cpp (+9/-0)
service/overlay-tracker.h (+1/-0)
service/scope-checker-facade.h (+27/-0)
service/scope-checker.cpp (+114/-0)
service/scope-checker.h (+29/-0)
service/service.c (+9/-1)
service/url-overlay/CMakeLists.txt (+14/-0)
tests/CMakeLists.txt (+3/-0)
tests/app-id-test.cc (+27/-29)
tests/apparmor-mock.c (+36/-0)
tests/apparmor-mock.h (+20/-0)
tests/click-data/manifests/com.test.good.manifest (+1/-1)
tests/click-data/manifests/com.test.multiple.manifest (+3/-3)
tests/dispatcher-test.cc (+84/-1)
tests/overlay-tracker-mock.h (+6/-0)
tests/overlay-tracker-test.cpp (+41/-12)
tests/scope-mock.h (+95/-0)
tests/service-test.cc (+8/-3)
tests/test-config.h.in (+1/-1)
tests/ual-link-farm/com.test.good_app1_1.2.3.desktop (+1/-0)
tests/ual-link-farm/com.test.multiple_app-first_1.2.3.desktop (+1/-0)
tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications/org.canonical.app1.desktop (+4/-0)
tests/xdg-data/applications/foo-bar.desktop (+1/-0)
tests/xdg-data/libertine/ContainersConfig.json (+14/-0)
To merge this branch: bzr merge lp:~ted/url-dispatcher/devel
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration Needs Fixing
Unity API Team Pending
Review via email: mp+306286@code.launchpad.net

This proposal supersedes a proposal from 2016-09-20.

Commit message

Pull all the branches together for merge conflicts

Description of the change

The merge conflicts were too difficult to make easy sense of, so pulled everything into a single branch that we can then land. This is the combination of a whole host of branches.

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~ted/url-dispatcher/devel updated
105. By Ted Gould

Merge issues from trunk

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~ted/url-dispatcher/devel updated
106. By Ted Gould

Forgot the container config

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:106
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/21/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/703/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/709
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/517/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/517/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/517/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/21/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:106
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/22/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/704/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/710
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/518/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/518/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/518/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/518
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/518/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/518
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/518/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/518
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/518/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/518/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/518
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/518/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/518/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/22/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:106
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/23/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/713/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/719
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/527/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/527/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/527/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/527/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/527/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/527/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/527/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/527/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/527/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/23/rebuild

review: Needs Fixing (continuous-integration)
lp:~ted/url-dispatcher/devel updated
107. By Ted Gould

Fixes from review

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:107
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/27/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/989/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/996
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/793/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/793/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/793/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/27/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ted Gould (ted) wrote :

Marking as approved as the subbranches are and this is just an integration branch.

lp:~ted/url-dispatcher/devel updated
108. By Ted Gould

Be more specific so that the packages don't conflict

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2015-06-11 21:38:13 +0000
+++ CMakeLists.txt 2016-11-07 16:32:23 +0000
@@ -3,7 +3,7 @@
33
4string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not.4string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not.
55
6if (${cmake_build_type_lower} STREQUAL debug)6if ("${cmake_build_type_lower}" STREQUAL "debug")
7 option (werror "Treat warnings as errors." FALSE)7 option (werror "Treat warnings as errors." FALSE)
8else()8else()
9 option (werror "Treat warnings as errors." TRUE)9 option (werror "Treat warnings as errors." TRUE)
@@ -30,7 +30,7 @@
30include(UseConstantBuilder)30include(UseConstantBuilder)
3131
32# Workaround for libexecdir on debian32# Workaround for libexecdir on debian
33if (EXISTS "/etc/debian_version") 33if (EXISTS "/etc/debian_version")
34 set(CMAKE_INSTALL_LIBEXECDIR ${CMAKE_INSTALL_LIBDIR})34 set(CMAKE_INSTALL_LIBEXECDIR ${CMAKE_INSTALL_LIBDIR})
35 set(CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}")35 set(CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}")
36endif()36endif()
@@ -42,7 +42,7 @@
42# Since gdbus-codegen does not produce warning-free code42# Since gdbus-codegen does not produce warning-free code
43# and we use -Werror, only enable these warnings for debug43# and we use -Werror, only enable these warnings for debug
44# builds. Drop this once the issue has been fixed and landed.44# builds. Drop this once the issue has been fixed and landed.
45if (${cmake_build_type_lower} STREQUAL debug)45if ("${cmake_build_type_lower}" STREQUAL debug)
46 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic")# -Wextra")46 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic")# -Wextra")
47 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wextra")47 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wextra")
48endif()48endif()
@@ -50,7 +50,7 @@
50if (${werror})50if (${werror})
51 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")51 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
52 set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Werror")52 set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
53endif() 53endif()
5454
55pkg_check_modules(UBUNTU_APP_LAUNCH REQUIRED ubuntu-app-launch-2>=0.5)55pkg_check_modules(UBUNTU_APP_LAUNCH REQUIRED ubuntu-app-launch-2>=0.5)
56include_directories(${UBUNTU_APP_LAUNCH_INCLUDE_DIRS})56include_directories(${UBUNTU_APP_LAUNCH_INCLUDE_DIRS})
@@ -79,6 +79,12 @@
79pkg_check_modules(CLICK REQUIRED click-0.4)79pkg_check_modules(CLICK REQUIRED click-0.4)
80include_directories(${CLICK_INCLUDE_DIRS})80include_directories(${CLICK_INCLUDE_DIRS})
8181
82pkg_check_modules(SCOPES REQUIRED libunity-scopes)
83include_directories(${SCOPES_INCLUDE_DIRS})
84
85pkg_check_modules(APPARMOR REQUIRED libapparmor)
86include_directories(${APPARMOR_INCLUDE_DIRS})
87
82if(${LOCAL_INSTALL})88if(${LOCAL_INSTALL})
83 set(DBUSSERVICEDIR "${CMAKE_INSTALL_DATADIR}/dbus-1/services/")89 set(DBUSSERVICEDIR "${CMAKE_INSTALL_DATADIR}/dbus-1/services/")
84else()90else()
@@ -103,6 +109,7 @@
103add_subdirectory(service)109add_subdirectory(service)
104add_subdirectory(liburl-dispatcher)110add_subdirectory(liburl-dispatcher)
105add_subdirectory(tools)111add_subdirectory(tools)
112add_subdirectory(gui)
106113
107# testing & coverage114# testing & coverage
108if (${enable_tests})115if (${enable_tests})
@@ -116,3 +123,4 @@
116 add_subdirectory(tests)123 add_subdirectory(tests)
117endif ()124endif ()
118125
126add_subdirectory(po)
119127
=== modified file 'data/CMakeLists.txt'
--- data/CMakeLists.txt 2015-11-06 22:59:11 +0000
+++ data/CMakeLists.txt 2016-11-07 16:32:23 +0000
@@ -102,3 +102,13 @@
102 @ONLY102 @ONLY
103)103)
104104
105###########################
106# QML
107###########################
108
109install(
110FILES
111bad-url.qml
112DESTINATION ${datadir}/url-dispatcher
113)
114
105115
=== added file 'data/bad-url.qml'
--- data/bad-url.qml 1970-01-01 00:00:00 +0000
+++ data/bad-url.qml 2016-11-07 16:32:23 +0000
@@ -0,0 +1,42 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 1.0
19import Ubuntu.Components.Popups 1.0
20
21MainView {
22 applicationName: "com.canonical.url-dispatcher.bad-url-prompt"
23 automaticOrientation: true
24 backgroundColor: "transparent"
25 anchors.fill: parent
26
27 Component {
28 id: dialog
29 Dialog {
30 title: i18n.tr("Unrecognized Address")
31 text: i18n.tr("Ubuntu can't open addresses of type “%1”.").arg(Qt.application.arguments[2].split(':')[0])
32
33 Button {
34 text: i18n.tr("OK")
35 color: UbuntuColors.orange
36 onClicked: Qt.quit()
37 }
38 }
39 }
40
41 Component.onCompleted: PopupUtils.open(dialog)
42}
043
=== modified file 'data/url-dispatcher-update-user.conf.in'
--- data/url-dispatcher-update-user.conf.in 2015-09-04 19:53:45 +0000
+++ data/url-dispatcher-update-user.conf.in 2016-11-07 16:32:23 +0000
@@ -13,4 +13,4 @@
13 fi13 fi
14end script14end script
1515
16exec @pkglibexecdir@/update-directory "~/.config/url-dispatcher/urls/*.url-dispatcher"16exec @pkglibexecdir@/update-directory "${HOME}/.config/url-dispatcher/urls/"
1717
=== modified file 'data/url-dispatcher.conf.in'
--- data/url-dispatcher.conf.in 2015-11-06 23:05:12 +0000
+++ data/url-dispatcher.conf.in 2016-11-07 16:32:23 +0000
@@ -7,6 +7,7 @@
7respawn7respawn
88
9emits application-start9emits application-start
10emits untrusted-helper-type-end
1011
11script12script
12 @pkglibexecdir@/url-dispatcher13 @pkglibexecdir@/url-dispatcher
@@ -18,3 +19,6 @@
18 fi19 fi
19end script20end script
2021
22post-stop script
23 initctl emit untrusted-helper-type-end HELPER_TYPE=url-overlay
24end script
2125
=== added directory 'debian/apparmor'
=== added file 'debian/apparmor/url-dispatcher-bad-url-helper'
--- debian/apparmor/url-dispatcher-bad-url-helper 1970-01-01 00:00:00 +0000
+++ debian/apparmor/url-dispatcher-bad-url-helper 2016-11-07 16:32:23 +0000
@@ -0,0 +1,15 @@
1# vim:syntax=apparmor
2#include <tunables/global>
3
4# Mostly unconfined. Don't allow capability or any mount rules. Also ensure that
5# exec inherits from this profile
6profile url-dispatcher-bad-url-helper (attach_disconnected) {
7 network,
8 / rwkl,
9 /** rwlkm,
10 /** pix,
11 dbus,
12 signal,
13 ptrace,
14 unix,
15}
016
=== modified file 'debian/changelog'
--- debian/changelog 2016-08-16 15:20:27 +0000
+++ debian/changelog 2016-11-07 16:32:23 +0000
@@ -1,3 +1,26 @@
1url-dispatcher (0.1+16.04.20151110-0ubuntu2) UNRELEASED; urgency=medium
2
3 [ Florian Boucault ]
4 * Crossbuilding Fixes
5
6 [ Larry Price ]
7 * App ID should allow package names with dots. (LP: #1591342) (LP: #1606498)
8
9 [ Ted Gould ]
10 * Check versions of appid:// urls to reduce the number of invalid appids
11 we send to UAL (LP: #1352656)
12 * Scope testing for the scope:// URL and overlays that should be over
13 the dash
14 * Protect the dash from getting NULL urls (LP: #1476257)
15 * Make sure URL Overlays are shutdown on exit
16 * Remove the wildcard that is confusing the update script (LP: #1461496)
17 * Not using a message that isn't set properly (LP: #1608009)
18 * Fixing tests to adjust for UAL changes
19 * Add a small GUI helper tool for testing
20 * Show error dialog over apps that use Bad URLs (LP: #1370008)
21
22 -- Ted Gould <ted@ubuntu.com> Tue, 20 Sep 2016 16:17:26 -0500
23
1url-dispatcher (0.1+16.10.20160816.1-0ubuntu1) yakkety; urgency=medium24url-dispatcher (0.1+16.10.20160816.1-0ubuntu1) yakkety; urgency=medium
225
3 * No chnage rebuild for UAL migration26 * No chnage rebuild for UAL migration
@@ -5,9 +28,9 @@
5 -- Ted Gould <ted@gould.cx> Tue, 16 Aug 2016 15:20:27 +000028 -- Ted Gould <ted@gould.cx> Tue, 16 Aug 2016 15:20:27 +0000
629
7url-dispatcher (0.1+16.04.20151110-0ubuntu2) xenial; urgency=high30url-dispatcher (0.1+16.04.20151110-0ubuntu2) xenial; urgency=high
8 31
9 * No change rebuild for s390x.32 * No change rebuild for s390x.
10 33
11 -- Dimitri John Ledkov <xnox@ubuntu.com> Fri, 11 Dec 2015 01:30:51 +000034 -- Dimitri John Ledkov <xnox@ubuntu.com> Fri, 11 Dec 2015 01:30:51 +0000
1235
13url-dispatcher (0.1+16.04.20151110-0ubuntu1) xenial; urgency=medium36url-dispatcher (0.1+16.04.20151110-0ubuntu1) xenial; urgency=medium
1437
=== modified file 'debian/control'
--- debian/control 2015-06-08 15:27:58 +0000
+++ debian/control 2016-11-07 16:32:23 +0000
@@ -7,8 +7,10 @@
7 dbus-test-runner,7 dbus-test-runner,
8 debhelper (>= 9),8 debhelper (>= 9),
9 dh-autoreconf,9 dh-autoreconf,
10 dh-apparmor,
10 gtester2xunit,11 gtester2xunit,
11 intltool,12 intltool,
13 libapparmor-dev,
12 libclick-0.4-dev,14 libclick-0.4-dev,
13 libdbus-1-dev,15 libdbus-1-dev,
14 libdbustest1-dev (>= 14.04.0),16 libdbustest1-dev (>= 14.04.0),
@@ -17,11 +19,12 @@
17 libgtest-dev,19 libgtest-dev,
18 libsqlite3-dev,20 libsqlite3-dev,
19 libubuntu-app-launch2-dev (>= 0.5),21 libubuntu-app-launch2-dev (>= 0.5),
20 python3,22 libunity-scopes-dev,
21 python3-dbusmock,23 python3:any,
22 python3-fixtures,24 python3-dbusmock <!cross>,
23 python3-nose,25 python3-fixtures <!cross>,
24 python3-testtools,26 python3-nose <!cross>,
27 python3-testtools <!cross>,
25 sqlite3,28 sqlite3,
26 upstart,29 upstart,
27Standards-Version: 3.9.430Standards-Version: 3.9.4
@@ -38,6 +41,9 @@
38Pre-Depends: ${misc:Pre-Depends},41Pre-Depends: ${misc:Pre-Depends},
39Depends: ${misc:Depends},42Depends: ${misc:Depends},
40 ${shlibs:Depends},43 ${shlibs:Depends},
44# For the bad URL dialog
45 qtchooser,
46 qtdeclarative5-ubuntu-ui-toolkit-plugin,
41Description: service to allow sending of URLs and get handlers started47Description: service to allow sending of URLs and get handlers started
42 Allows applications to request a URL to be opened and handled by another48 Allows applications to request a URL to be opened and handled by another
43 process without seeing the list of other applications on the system or49 process without seeing the list of other applications on the system or
@@ -57,6 +63,19 @@
57 .63 .
58 This package provides tools for working with the URL Dispatcher.64 This package provides tools for working with the URL Dispatcher.
5965
66Package: url-dispatcher-tools-gui
67Architecture: any
68Depends: url-dispatcher (= ${binary:Version}),
69 ${misc:Depends},
70 ${shlibs:Depends},
71 qtchooser,
72Description: GUI tools for working with the URL Dispatcher.
73 Allows applications to request a URL to be opened and handled by another
74 process without seeing the list of other applications on the system or
75 starting them inside its own Application Confinement.
76 .
77 This package provides GUI tools for working with the URL Dispatcher.
78
60Package: liburl-dispatcher179Package: liburl-dispatcher1
61Section: libs80Section: libs
62Architecture: any81Architecture: any
6382
=== modified file 'debian/rules'
--- debian/rules 2015-05-20 16:22:44 +0000
+++ debian/rules 2016-11-07 16:32:23 +0000
@@ -3,6 +3,9 @@
3export DPKG_GENSYMBOLS_CHECK_LEVEL = 43export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
4export G_MESSAGES_DEBUG=all4export G_MESSAGES_DEBUG=all
5export URL_DISPATCHER_DISABLE_RECOVERABLE_ERROR=15export URL_DISPATCHER_DISABLE_RECOVERABLE_ERROR=1
6ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
7export DEB_BUILD_PROFILES := cross
8endif
69
7%:10%:
8 dh $@ --fail-missing --with click11 dh $@ --fail-missing --with click
@@ -12,6 +15,7 @@
12 install -m 644 debian/source_url-dispatcher.py debian/url-dispatcher/usr/share/apport/package-hooks/15 install -m 644 debian/source_url-dispatcher.py debian/url-dispatcher/usr/share/apport/package-hooks/
13 mkdir -p debian/url-dispatcher/etc/apport/crashdb.conf.d/16 mkdir -p debian/url-dispatcher/etc/apport/crashdb.conf.d/
14 install -m 644 debian/url-dispatcher-crashdb.conf debian/url-dispatcher/etc/apport/crashdb.conf.d/17 install -m 644 debian/url-dispatcher-crashdb.conf debian/url-dispatcher/etc/apport/crashdb.conf.d/
18 dh_apparmor --profile-name=url-dispatcher-bad-url-helper -p url-dispatcher
15 dh_install --fail-missing19 dh_install --fail-missing
1620
17override_dh_click:21override_dh_click:
1822
=== added file 'debian/url-dispatcher-tools-gui.install'
--- debian/url-dispatcher-tools-gui.install 1970-01-01 00:00:00 +0000
+++ debian/url-dispatcher-tools-gui.install 2016-11-07 16:32:23 +0000
@@ -0,0 +1,2 @@
1/usr/share/applications/
2/usr/share/url-dispatcher/gui/
03
=== modified file 'debian/url-dispatcher.install'
--- debian/url-dispatcher.install 2015-06-12 16:00:37 +0000
+++ debian/url-dispatcher.install 2016-11-07 16:32:23 +0000
@@ -1,5 +1,8 @@
1usr/lib/*/url-dispatcher1usr/lib/*/url-dispatcher
2usr/lib/*/ubuntu-app-launch/url-overlay/exec-tool2usr/lib/*/ubuntu-app-launch/url-overlay/exec-tool
3usr/lib/*/ubuntu-app-launch/bad-url/exec-tool
3usr/share/dbus-14usr/share/dbus-1
4usr/share/upstart/sessions5usr/share/upstart/sessions
6usr/share/url-dispatcher/bad-url.qml
5usr/bin/url-dispatcher-dump7usr/bin/url-dispatcher-dump
8debian/apparmor/url-dispatcher-bad-url-helper etc/apparmor.d
69
=== added directory 'gui'
=== added file 'gui/CMakeLists.txt'
--- gui/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ gui/CMakeLists.txt 2016-11-07 16:32:23 +0000
@@ -0,0 +1,13 @@
1
2install(FILES
3 url-dispatcher-gui.qml
4 url-dispatcher-gui.svg
5 DESTINATION "${CMAKE_INSTALL_DATADIR}/url-dispatcher/gui/")
6install(FILES
7 ${CMAKE_CURRENT_BINARY_DIR}/url-dispatcher-gui.desktop
8 DESTINATION "${CMAKE_INSTALL_DATADIR}/applications/")
9
10configure_file(
11 "url-dispatcher-gui.desktop.in"
12 "url-dispatcher-gui.desktop"
13 @ONLY)
014
=== added file 'gui/url-dispatcher-gui.desktop.in'
--- gui/url-dispatcher-gui.desktop.in 1970-01-01 00:00:00 +0000
+++ gui/url-dispatcher-gui.desktop.in 2016-11-07 16:32:23 +0000
@@ -0,0 +1,6 @@
1[Desktop Entry]
2Name=URL Dispatcher GUI
3Icon=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/url-dispatcher/gui/url-dispatcher-gui.svg
4Type=Application
5Exec=qmlscene @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/url-dispatcher/gui/url-dispatcher-gui.qml
6X-Ubuntu-Touch=true
07
=== added file 'gui/url-dispatcher-gui.qml'
--- gui/url-dispatcher-gui.qml 1970-01-01 00:00:00 +0000
+++ gui/url-dispatcher-gui.qml 2016-11-07 16:32:23 +0000
@@ -0,0 +1,59 @@
1import QtQuick 2.4
2import Ubuntu.Components 1.3
3import Ubuntu.Components.ListItems 1.3
4
5MainView {
6 applicationName: "url-dispatcher-gui"
7
8 Page {
9 header: PageHeader {
10 title: "URL Dispatcher GUI"
11 flickable: flickme
12 }
13
14 Flickable {
15 id: flickme
16 anchors.fill: parent
17
18 Column {
19 anchors.fill: parent
20
21 ListItem {
22 contentItem.anchors {
23 leftMargin: units.gu(2)
24 rightMargin: units.gu(2)
25 topMargin: units.gu(1)
26 bottomMargin: units.gu(1)
27 }
28
29 TextField {
30 id: textbox
31 anchors.fill: parent
32 placeholderText: "URL (e.g. 'http://ubuntu.com')"
33 }
34 }
35
36 ListItem {
37 contentItem.anchors {
38 leftMargin: units.gu(2)
39 rightMargin: units.gu(2)
40 topMargin: units.gu(1)
41 bottomMargin: units.gu(1)
42 }
43
44 Button {
45 anchors.fill: parent
46 text: "Send URL"
47 onClicked: {
48 console.log("Sending URL: " + textbox.text)
49 Qt.openUrlExternally(textbox.text)
50 }
51 }
52 }
53 }
54 }
55
56 }
57
58
59}
060
=== added file 'gui/url-dispatcher-gui.svg'
--- gui/url-dispatcher-gui.svg 1970-01-01 00:00:00 +0000
+++ gui/url-dispatcher-gui.svg 2016-11-07 16:32:23 +0000
@@ -0,0 +1,129 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:cc="http://creativecommons.org/ns#"
7 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8 xmlns:svg="http://www.w3.org/2000/svg"
9 xmlns="http://www.w3.org/2000/svg"
10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12 width="256"
13 height="256"
14 viewBox="0 0 67.733332 67.733335"
15 version="1.1"
16 id="svg8"
17 inkscape:version="0.92pre1 15068"
18 sodipodi:docname="url-dispatcher-gui.svg">
19 <defs
20 id="defs2" />
21 <sodipodi:namedview
22 id="base"
23 pagecolor="#ffffff"
24 bordercolor="#666666"
25 borderopacity="1.0"
26 inkscape:pageopacity="1"
27 inkscape:pageshadow="2"
28 inkscape:zoom="3.375"
29 inkscape:cx="128"
30 inkscape:cy="128.88889"
31 inkscape:document-units="mm"
32 inkscape:current-layer="g3484"
33 showgrid="false"
34 units="px"
35 inkscape:showpageshadow="false"
36 inkscape:pagecheckerboard="false"
37 inkscape:window-width="1920"
38 inkscape:window-height="1050"
39 inkscape:window-x="0"
40 inkscape:window-y="30"
41 inkscape:window-maximized="1" />
42 <metadata
43 id="metadata5">
44 <rdf:RDF>
45 <cc:Work
46 rdf:about="">
47 <dc:format>image/svg+xml</dc:format>
48 <dc:type
49 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
50 <dc:title></dc:title>
51 </cc:Work>
52 </rdf:RDF>
53 </metadata>
54 <g
55 inkscape:label="Layer 1"
56 inkscape:groupmode="layer"
57 id="layer1"
58 transform="translate(0,-229.26665)">
59 <g
60 id="g3484"
61 transform="translate(0,-2.732619)">
62 <path
63 inkscape:connector-curvature="0"
64 id="path3486"
65 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:17.4939785px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.69975913px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
66 d="m 16.89882,270.19082 q -1.903345,0 -3.302863,-0.5878 -1.399518,-0.58779 -2.29521,-1.59545 -0.895692,-1.03564 -1.3435374,-2.43516 -0.4198555,-1.39952 -0.4198555,-3.02296 V 250.37364 H 12.25242 v 11.86792 q 0,2.911 1.287556,4.22654 1.287557,1.31555 3.358844,1.31555 1.035644,0 1.875355,-0.30789 0.867701,-0.33589 1.483489,-1.00766 0.615788,-0.67177 0.951673,-1.70741 0.335884,-1.06363 0.335884,-2.51913 v -11.86792 h 2.715066 v 12.17581 q 0,1.62344 -0.447846,3.02296 -0.419856,1.39952 -1.343538,2.43516 -0.895692,1.00766 -2.29521,1.59545 -1.371528,0.5878 -3.274873,0.5878 z" />
67 <path
68 inkscape:connector-curvature="0"
69 id="path3488"
70 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:17.4939785px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.69975913px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
71 d="m 38.409416,261.65376 q 0.447846,0.55981 1.119614,1.48349 0.69976,0.89569 1.427509,2.01531 0.72775,1.09162 1.427509,2.29521 0.727749,1.20358 1.231576,2.3232 h -2.966979 q -0.559807,-1.06364 -1.231576,-2.15526 -0.643778,-1.09163 -1.315547,-2.07129 -0.671769,-1.00765 -1.343538,-1.87535 -0.643778,-0.86771 -1.175595,-1.51148 -0.363875,0.028 -0.75574,0.028 -0.363875,0 -0.75574,0 h -2.435162 v 7.58539 h -2.715065 v -19.11742 q 1.147605,-0.27991 2.547123,-0.36388 1.427509,-0.11196 2.603104,-0.11196 4.086593,0 6.213861,1.53947 2.155258,1.53947 2.155258,4.59042 0,1.93133 -1.035643,3.30286 -1.007653,1.37153 -2.994969,2.0433 z m -4.114584,-9.09687 q -1.735403,0 -2.659085,0.084 v 7.30549 h 1.931335 q 1.399519,0 2.519133,-0.13995 1.119615,-0.13996 1.875355,-0.53182 0.78373,-0.39187 1.203586,-1.09163 0.419855,-0.72775 0.419855,-1.90334 0,-1.09163 -0.419855,-1.81937 -0.419856,-0.72775 -1.147605,-1.14761 -0.69976,-0.41986 -1.679422,-0.5878 -0.951673,-0.16794 -2.043297,-0.16794 z" />
72 <path
73 inkscape:connector-curvature="0"
74 id="path3490"
75 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:17.4939785px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.69975913px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
76 d="m 58.19598,267.41977 v 2.3512 H 46.523997 v -19.39733 h 2.715066 v 17.04613 z" />
77 <path
78 inkscape:connector-curvature="0"
79 id="path3493"
80 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
81 d="m 16.002471,276.35782 q 0,0.87908 -0.273492,1.5335 -0.273492,0.64466 -0.771638,1.07444 -0.498145,0.42 -1.191643,0.63489 -0.693497,0.20512 -1.52374,0.20512 -0.410238,0 -0.908384,-0.0391 -0.488379,-0.0293 -0.888849,-0.12698 v -6.56381 q 0.40047,-0.0977 0.888849,-0.12698 0.498146,-0.0391 0.908384,-0.0391 0.830243,0 1.52374,0.21489 0.693498,0.20512 1.191643,0.63489 0.498146,0.42001 0.771638,1.07444 0.273492,0.64465 0.273492,1.52374 z m -3.682373,2.6177 q 1.347925,0 2.012119,-0.68373 0.664195,-0.69349 0.664195,-1.93397 0,-1.24049 -0.664195,-1.92421 -0.664194,-0.6935 -2.012119,-0.6935 -0.40047,0 -0.625124,0.01 -0.214887,0.01 -0.302795,0.0195 v 5.17681 q 0.08791,0.01 0.302795,0.0195 0.224654,0.01 0.625124,0.01 z" />
82 <path
83 inkscape:connector-curvature="0"
84 id="path3495"
85 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
86 d="m 18.257711,279.74716 h -0.908384 v -5.07913 h 0.908384 z m -0.459076,-5.99728 q -0.244189,0 -0.420005,-0.15629 -0.166049,-0.16604 -0.166049,-0.43954 0,-0.27349 0.166049,-0.42977 0.175816,-0.16605 0.420005,-0.16605 0.244189,0 0.410238,0.16605 0.175816,0.15628 0.175816,0.42977 0,0.2735 -0.175816,0.43954 -0.166049,0.15629 -0.410238,0.15629 z" />
87 <path
88 inkscape:connector-curvature="0"
89 id="path3497"
90 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
91 d="m 21.011249,279.09273 q 0.556751,0 0.820476,-0.14651 0.273492,-0.14651 0.273492,-0.46884 0,-0.3321 -0.263725,-0.52745 -0.263724,-0.19535 -0.869313,-0.43954 -0.293027,-0.11721 -0.566519,-0.23442 -0.263725,-0.12698 -0.459076,-0.29303 -0.195351,-0.16605 -0.312562,-0.40047 -0.117211,-0.23442 -0.117211,-0.57629 0,-0.67396 0.498146,-1.06466 0.498146,-0.40047 1.357692,-0.40047 0.214886,0 0.429773,0.0293 0.214886,0.0195 0.40047,0.0586 0.185584,0.0293 0.32233,0.0684 0.146514,0.0391 0.224654,0.0684 l -0.166049,0.78141 q -0.146513,-0.0781 -0.459075,-0.15628 -0.312562,-0.0879 -0.752103,-0.0879 -0.380935,0 -0.664195,0.15628 -0.283259,0.14651 -0.283259,0.46884 0,0.16605 0.05861,0.29303 0.06837,0.12698 0.195352,0.23442 0.136746,0.0977 0.332097,0.18559 0.195351,0.0879 0.468843,0.18558 0.3614,0.13675 0.64466,0.27349 0.283259,0.12698 0.478611,0.3028 0.205118,0.17581 0.312562,0.42977 0.107443,0.24419 0.107443,0.60559 0,0.70326 -0.527449,1.06466 -0.517681,0.3614 -1.48467,0.3614 -0.673962,0 -1.054897,-0.11721 -0.380935,-0.10744 -0.517681,-0.16605 l 0.166048,-0.7814 q 0.156281,0.0586 0.498146,0.17581 0.341865,0.11721 0.908384,0.11721 z" />
92 <path
93 inkscape:connector-curvature="0"
94 id="path3499"
95 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
96 d="m 27.705085,277.21736 q 0,-0.88885 -0.43954,-1.36746 -0.439541,-0.47861 -1.172109,-0.47861 -0.410237,0 -0.644659,0.0293 -0.224654,0.0293 -0.3614,0.0684 v 3.20376 q 0.166049,0.13675 0.478611,0.26372 0.312562,0.12698 0.68373,0.12698 0.390702,0 0.664194,-0.13674 0.28326,-0.14652 0.459076,-0.39071 0.175816,-0.25395 0.253957,-0.58605 0.07814,-0.34187 0.07814,-0.73257 z m 0.947454,0 q 0,0.57629 -0.156281,1.06467 -0.146513,0.48838 -0.43954,0.84001 -0.293027,0.35163 -0.7228,0.54698 -0.420006,0.19535 -0.96699,0.19535 -0.43954,0 -0.781405,-0.11721 -0.332097,-0.11721 -0.498146,-0.22465 v 2.03165 h -0.908384 v -6.72985 q 0.32233,-0.0781 0.800941,-0.16605 0.488378,-0.0977 1.12327,-0.0977 0.586054,0 1.054897,0.18559 0.468844,0.18558 0.800941,0.52745 0.332097,0.34186 0.507913,0.84001 0.185584,0.48838 0.185584,1.10373 z" />
97 <path
98 inkscape:connector-curvature="0"
99 id="path3501"
100 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
101 d="m 31.659424,279.09273 q 0.32233,0 0.566519,-0.01 0.253957,-0.0195 0.420006,-0.0586 v -1.51397 q -0.09768,-0.0488 -0.32233,-0.0781 -0.214887,-0.0391 -0.527449,-0.0391 -0.205119,0 -0.43954,0.0293 -0.224654,0.0293 -0.420006,0.12698 -0.185584,0.0879 -0.312562,0.25396 -0.126978,0.15628 -0.126978,0.42 0,0.48838 0.312562,0.68373 0.312562,0.18558 0.849778,0.18558 z m -0.07814,-4.55168 q 0.546984,0 0.918151,0.14651 0.380935,0.13675 0.605589,0.40047 0.234422,0.25396 0.332098,0.61536 0.09767,0.35163 0.09767,0.7814 v 3.17446 q -0.117211,0.0195 -0.332097,0.0586 -0.205119,0.0293 -0.468843,0.0586 -0.263725,0.0293 -0.576287,0.0488 -0.302794,0.0293 -0.605589,0.0293 -0.429773,0 -0.791173,-0.0879 -0.3614,-0.0879 -0.625124,-0.27349 -0.263725,-0.19536 -0.410238,-0.50792 -0.146514,-0.31256 -0.146514,-0.7521 0,-0.42001 0.166049,-0.7228 0.175816,-0.3028 0.468843,-0.48838 0.293027,-0.18558 0.68373,-0.27349 0.390703,-0.0879 0.820476,-0.0879 0.136746,0 0.283259,0.0195 0.146514,0.01 0.273492,0.0391 0.136746,0.0195 0.234422,0.0391 0.09768,0.0195 0.136746,0.0293 v -0.25396 q 0,-0.22465 -0.04884,-0.43954 -0.04884,-0.22465 -0.175816,-0.3907 -0.126979,-0.17582 -0.351633,-0.27349 -0.214886,-0.10745 -0.566519,-0.10745 -0.449308,0 -0.791173,0.0684 -0.332097,0.0586 -0.498146,0.12698 l -0.107443,-0.75211 q 0.175816,-0.0781 0.586054,-0.14651 0.410238,-0.0781 0.888849,-0.0781 z" />
102 <path
103 inkscape:connector-curvature="0"
104 id="path3503"
105 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
106 d="m 35.883744,274.66803 h 1.924211 v 0.76187 h -1.924211 v 2.34421 q 0,0.38094 0.05861,0.6349 0.05861,0.24418 0.175816,0.3907 0.117211,0.13674 0.293027,0.19535 0.175816,0.0586 0.410238,0.0586 0.410238,0 0.654427,-0.0879 0.253957,-0.0977 0.351632,-0.13675 l 0.175817,0.7521 q -0.136746,0.0684 -0.478611,0.16605 -0.341865,0.10745 -0.781406,0.10745 -0.517681,0 -0.859546,-0.12698 -0.332097,-0.13675 -0.537216,-0.40047 -0.205119,-0.26373 -0.293027,-0.64466 -0.07814,-0.39071 -0.07814,-0.89862 v -4.53215 l 0.908383,-0.15628 z" />
107 <path
108 inkscape:connector-curvature="0"
109 id="path3505"
110 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
111 d="m 41.037815,279.86437 q -0.615356,0 -1.0842,-0.19535 -0.459075,-0.19535 -0.781405,-0.54698 -0.312562,-0.35163 -0.468843,-0.83025 -0.156281,-0.48837 -0.156281,-1.07443 0,-0.58605 0.166048,-1.07443 0.175817,-0.48838 0.488379,-0.84001 0.312562,-0.3614 0.76187,-0.55675 0.459076,-0.20512 1.015827,-0.20512 0.341865,0 0.68373,0.0586 0.341865,0.0586 0.654427,0.18559 l -0.205119,0.77164 q -0.205119,-0.0977 -0.478611,-0.15629 -0.263724,-0.0586 -0.566519,-0.0586 -0.76187,0 -1.172108,0.47861 -0.40047,0.47861 -0.40047,1.39676 0,0.41024 0.08791,0.7521 0.09768,0.34187 0.293027,0.58606 0.205119,0.24419 0.517681,0.38093 0.312562,0.12698 0.76187,0.12698 0.3614,0 0.654427,-0.0684 0.293027,-0.0684 0.459076,-0.14651 l 0.126978,0.76187 q -0.07814,0.0488 -0.224654,0.0977 -0.146513,0.0391 -0.332097,0.0684 -0.185584,0.0391 -0.40047,0.0586 -0.205119,0.0293 -0.400471,0.0293 z" />
112 <path
113 inkscape:connector-curvature="0"
114 id="path3507"
115 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
116 d="m 43.370739,279.74716 v -7.42335 l 0.908384,-0.15628 v 2.59817 q 0.253956,-0.0977 0.537216,-0.14651 0.293027,-0.0586 0.576286,-0.0586 0.60559,0 1.00606,0.17582 0.40047,0.16605 0.634892,0.47861 0.244189,0.3028 0.341865,0.73257 0.09768,0.42977 0.09768,0.94745 v 2.85213 h -0.908383 v -2.65678 q 0,-0.46884 -0.06837,-0.80094 -0.05861,-0.33209 -0.205119,-0.53721 -0.146514,-0.20512 -0.390703,-0.29303 -0.244189,-0.0977 -0.605589,-0.0977 -0.146514,0 -0.302795,0.0195 -0.156281,0.0195 -0.302794,0.0488 -0.136746,0.0195 -0.253957,0.0488 -0.107443,0.0293 -0.156281,0.0488 v 4.21959 z" />
117 <path
118 inkscape:connector-curvature="0"
119 id="path3509"
120 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
121 d="m 48.658044,277.21736 q 0,-0.67396 0.195351,-1.17211 0.195351,-0.50791 0.517681,-0.84001 0.32233,-0.33209 0.742335,-0.49814 0.420006,-0.16605 0.859546,-0.16605 1.025595,0 1.572579,0.64466 0.546983,0.63489 0.546983,1.94374 0,0.0586 0,0.15628 0,0.0879 -0.0098,0.16605 h -3.477254 q 0.05861,0.79118 0.459075,1.20141 0.400471,0.41024 1.250249,0.41024 0.478611,0 0.800941,-0.0781 0.332097,-0.0879 0.498146,-0.16605 l 0.126978,0.76187 q -0.166049,0.0879 -0.586054,0.18559 -0.410238,0.0977 -0.937687,0.0977 -0.664194,0 -1.152573,-0.19535 -0.47861,-0.20512 -0.791172,-0.55675 -0.312563,-0.35163 -0.468844,-0.83024 -0.146513,-0.48838 -0.146513,-1.06467 z m 3.487021,-0.49814 q 0.0098,-0.61536 -0.312562,-1.00606 -0.312562,-0.40047 -0.869313,-0.40047 -0.312562,0 -0.556752,0.12697 -0.234421,0.11722 -0.40047,0.31257 -0.166049,0.19535 -0.263724,0.4493 -0.08791,0.25396 -0.117211,0.51769 z" />
122 <path
123 inkscape:connector-curvature="0"
124 id="path3511"
125 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
126 d="m 56.27278,274.56058 q 0.117211,0 0.263725,0.0195 0.156281,0.01 0.302794,0.0391 0.146514,0.0195 0.263725,0.0488 0.126978,0.0195 0.185584,0.0391 l -0.156282,0.79117 q -0.107443,-0.0391 -0.3614,-0.0879 -0.244189,-0.0586 -0.634891,-0.0586 -0.253957,0 -0.507914,0.0586 -0.244189,0.0488 -0.32233,0.0684 v 4.26843 h -0.908384 v -4.86425 q 0.32233,-0.11721 0.800941,-0.21488 0.478611,-0.10745 1.074432,-0.10745 z" />
127 </g>
128 </g>
129</svg>
0130
=== added directory 'po'
=== added file 'po/CMakeLists.txt'
--- po/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ po/CMakeLists.txt 2016-11-07 16:32:23 +0000
@@ -0,0 +1,39 @@
1include(FindGettext)
2find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
3find_program(INTLTOOL_UPDATE intltool-update)
4
5set(GETTEXT_PACKAGE ${PROJECT_NAME})
6set(POT_FILE ${GETTEXT_PACKAGE}.pot)
7file(GLOB POFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po)
8
9# Creates POTFILES
10add_custom_target(POTFILES ALL
11 COMMENT "Generating POTFILES"
12 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/genpotfiles.sh ${CMAKE_SOURCE_DIR}
13)
14
15# Creates the .pot file containing the translations template
16set(INTLTOOL_ENV
17 XGETTEXT="${GETTEXT_XGETTEXT_EXECUTABLE}"
18 XGETTEXT_ARGS="--keyword=Gettext;--keyword=NGettext:1,2;--keyword=tr;--keyword=tr:1,2;--keyword=N_"
19 srcdir="${CMAKE_CURRENT_SOURCE_DIR}"
20)
21add_custom_target(${POT_FILE}
22 COMMENT "Generating translation template"
23 COMMAND ${INTLTOOL_ENV} ${INTLTOOL_UPDATE} --gettext-package ${GETTEXT_PACKAGE} --pot
24 COMMAND cp -f ${POT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/
25 DEPENDS POTFILES
26)
27
28# Builds the binary translations catalog for each language
29# it finds source translations (*.po) for
30foreach(POFILE ${POFILES})
31 string(REPLACE ".po" "" LANG ${POFILE})
32 list(APPEND PO_FILES "${POFILE}")
33 gettext_process_po_files(${LANG} ALL PO_FILES "${POFILE}")
34 set(INSTALL_DIR ${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES)
35 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo
36 DESTINATION ${INSTALL_DIR}
37 RENAME ${GETTEXT_PACKAGE}.mo
38 )
39endforeach(POFILE)
040
=== added file 'po/POTFILES.in'
--- po/POTFILES.in 1970-01-01 00:00:00 +0000
+++ po/POTFILES.in 2016-11-07 16:32:23 +0000
@@ -0,0 +1,1 @@
1data/bad-url.qml
02
=== added file 'po/genpotfiles.sh'
--- po/genpotfiles.sh 1970-01-01 00:00:00 +0000
+++ po/genpotfiles.sh 2016-11-07 16:32:23 +0000
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3sed '/^#/d
4 s/^[[].*] *//
5 /^[ ]*$/d' \
6 "`dirname ${0}`/POTFILES.in" | sed '$!s/$/ \\/' > POTFILES
07
=== modified file 'service/CMakeLists.txt'
--- service/CMakeLists.txt 2015-06-11 21:38:13 +0000
+++ service/CMakeLists.txt 2016-11-07 16:32:23 +0000
@@ -47,15 +47,20 @@
47 overlay-tracker.cpp47 overlay-tracker.cpp
48 overlay-tracker-iface.h48 overlay-tracker-iface.h
49 overlay-tracker-mir.h49 overlay-tracker-mir.h
50 overlay-tracker-mir.cpp)50 overlay-tracker-mir.cpp
51 scope-checker-facade.h
52 scope-checker.h
53 scope-checker.cpp)
5154
52target_link_libraries(dispatcher-lib55target_link_libraries(dispatcher-lib
53 url-db-lib56 url-db-lib
54 service-generated57 service-generated
55 -pthread58 -pthread
59 ${APPARMOR_LIBRARIES}
56 ${GLIB2_LIBRARIES}60 ${GLIB2_LIBRARIES}
57 ${GOBJECT2_LIBRARIES}61 ${GOBJECT2_LIBRARIES}
58 ${GIO2_LIBRARIES}62 ${GIO2_LIBRARIES}
63 ${SCOPES_LIBRARIES}
59 ${SQLITE_LIBRARIES}64 ${SQLITE_LIBRARIES}
60 ${UBUNTU_APP_LAUNCH_LIBRARIES}65 ${UBUNTU_APP_LAUNCH_LIBRARIES}
61)66)
@@ -106,14 +111,6 @@
106target_link_libraries(update-directory ${GIO2_LIBRARIES} ${JSONGLIB_LIBRARIES} url-db-lib)111target_link_libraries(update-directory ${GIO2_LIBRARIES} ${JSONGLIB_LIBRARIES} url-db-lib)
107112
108###########################113###########################
109# URL Overlay Exec Tool
110###########################
111
112add_executable(url-overlay-exec-tool url-overlay.c recoverable-problem.c)
113set_target_properties(url-overlay-exec-tool PROPERTIES OUTPUT_NAME "exec-tool")
114target_link_libraries(url-overlay-exec-tool ${GIO2_LIBRARIES} ${UBUNTU_APP_LAUNCH_LIBRARIES} ${CLICK_LIBRARIES})
115
116###########################
117# Installation114# Installation
118###########################115###########################
119116
@@ -122,8 +119,9 @@
122 RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/url-dispatcher"119 RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/url-dispatcher"
123)120)
124121
125install(122###########################
126 TARGETS url-overlay-exec-tool123# Exec Tools
127 RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/ubuntu-app-launch/url-overlay"124###########################
128)
129125
126add_subdirectory(url-overlay)
127add_subdirectory(bad-url)
130128
=== added directory 'service/bad-url'
=== added file 'service/bad-url/CMakeLists.txt'
--- service/bad-url/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ service/bad-url/CMakeLists.txt 2016-11-07 16:32:23 +0000
@@ -0,0 +1,14 @@
1###########################
2# Bad URL Exec Tool
3###########################
4
5add_definitions( -DQML_BAD_URL="${CMAKE_INSTALL_FULL_DATADIR}/url-dispatcher/bad-url.qml" )
6add_executable(bad-url-exec-tool exec-tool.c)
7set_target_properties(bad-url-exec-tool PROPERTIES OUTPUT_NAME "exec-tool")
8target_link_libraries(bad-url-exec-tool ${GIO2_LIBRARIES} ${UBUNTU_APP_LAUNCH_LIBRARIES})
9
10install(
11 TARGETS bad-url-exec-tool
12 RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/ubuntu-app-launch/bad-url"
13)
14
015
=== added file 'service/bad-url/exec-tool.c'
--- service/bad-url/exec-tool.c 1970-01-01 00:00:00 +0000
+++ service/bad-url/exec-tool.c 2016-11-07 16:32:23 +0000
@@ -0,0 +1,42 @@
1/*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Ted Gould <ted.gould@canonical.com>
18 */
19
20#include <gio/gio.h>
21#include <ubuntu-app-launch.h>
22
23int
24main (int argc, char * argv[])
25{
26 GDBusConnection * bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
27 g_return_val_if_fail(bus != NULL, -1);
28
29 gchar * exec = g_strdup_printf("qmlscene %s %s", QML_BAD_URL, g_getenv("APP_URIS"));
30
31 gboolean sended = ubuntu_app_launch_helper_set_exec(exec, NULL);
32 g_free(exec);
33
34 /* Ensuring the messages get on the bus before we quit */
35 g_dbus_connection_flush_sync(bus, NULL, NULL);
36 g_clear_object(&bus);
37
38 if (sended)
39 return 0;
40 else
41 return -1;
42}
043
=== modified file 'service/dispatcher.c'
--- service/dispatcher.c 2015-09-03 21:50:06 +0000
+++ service/dispatcher.c 2016-11-07 16:32:23 +0000
@@ -23,10 +23,12 @@
23#include "dispatcher.h"23#include "dispatcher.h"
24#include "service-iface.h"24#include "service-iface.h"
25#include "recoverable-problem.h"25#include "recoverable-problem.h"
26#include "scope-checker.h"
26#include "url-db.h"27#include "url-db.h"
2728
28/* Globals */29/* Globals */
29static OverlayTracker * tracker = NULL;30static OverlayTracker * tracker = NULL;
31static ScopeChecker * checker = NULL;
30static GCancellable * cancellable = NULL;32static GCancellable * cancellable = NULL;
31static ServiceIfaceComCanonicalURLDispatcher * skel = NULL;33static ServiceIfaceComCanonicalURLDispatcher * skel = NULL;
32static GRegex * applicationre = NULL;34static GRegex * applicationre = NULL;
@@ -73,6 +75,10 @@
73 g_variant_get(pid_tuple, "(u)", &pid);75 g_variant_get(pid_tuple, "(u)", &pid);
74 g_variant_unref(pid_tuple);76 g_variant_unref(pid_tuple);
7577
78 /* Popup the bad url dialog */
79 overlay_tracker_badurl(tracker, pid, badurl);
80
81 /* Report recoverable error */
76 const gchar * additional[3] = {82 const gchar * additional[3] = {
77 "BadURL",83 "BadURL",
78 badurl,84 badurl,
@@ -151,6 +157,11 @@
151gboolean157gboolean
152send_to_dash (const gchar * url)158send_to_dash (const gchar * url)
153{159{
160 if (url == NULL) {
161 g_warning("Can not send nothing to the dash");
162 return FALSE;
163 }
164
154 GDBusConnection * bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);165 GDBusConnection * bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
155 g_return_val_if_fail(bus != NULL, FALSE);166 g_return_val_if_fail(bus != NULL, FALSE);
156167
@@ -210,13 +221,109 @@
210 return TRUE;221 return TRUE;
211}222}
212223
224/* Queries Upstart for the PID of a given upstart job */
225pid_t
226pid_for_upstart_job (GDBusConnection * conn, const gchar* jobname)
227{
228 GError* error = NULL;
229
230 if (jobname == NULL) {
231 return 0;
232 }
233
234 GVariant* retval = g_dbus_connection_call_sync(
235 conn,
236 "com.ubuntu.Upstart",
237 "/com/ubuntu/Upstart",
238 "com.ubuntu.Upstart0_6",
239 "GetJobByName",
240 g_variant_new("(s)", jobname),
241 G_VARIANT_TYPE("(o)"),
242 G_DBUS_CALL_FLAGS_NO_AUTO_START,
243 -1, /* timeout */
244 NULL, /* cancel */
245 &error);
246
247 if (error != NULL) {
248 g_warning("Unable to get path for job '%s': %s", jobname, error->message);
249 g_error_free(error);
250 return 0;
251 }
252
253 gchar* path = NULL;
254 g_variant_get(retval, "(o)", &path);
255 g_variant_unref(retval);
256
257 retval = g_dbus_connection_call_sync(
258 conn,
259 "com.ubuntu.Upstart",
260 path,
261 "com.ubuntu.Upstart0_6.Job",
262 "GetInstanceByName",
263 g_variant_new("(s)", ""),
264 G_VARIANT_TYPE("(o)"),
265 G_DBUS_CALL_FLAGS_NO_AUTO_START,
266 -1, /* timeout */
267 NULL, /* cancel */
268 &error);
269
270 g_free(path);
271
272 if (error != NULL) {
273 g_warning("Unable to get instance for job '%s': %s", jobname, error->message);
274 g_error_free(error);
275 return 0;
276 }
277
278 g_variant_get(retval, "(o)", &path);
279 g_variant_unref(retval);
280
281 retval = g_dbus_connection_call_sync(
282 conn,
283 "com.ubuntu.Upstart",
284 path,
285 "org.freedesktop.DBus.Properties",
286 "Get",
287 g_variant_new("(ss)", "com.ubuntu.Upstart0_6.Instance", "processes"),
288 G_VARIANT_TYPE("(v)"),
289 G_DBUS_CALL_FLAGS_NO_AUTO_START,
290 -1, /* timeout */
291 NULL, /* cancel */
292 &error);
293
294 g_free(path);
295
296 if (error != NULL) {
297 g_warning("Unable to get processes for job '%s': %s", jobname, error->message);
298 g_error_free(error);
299 return 0;
300 }
301
302 GPid pid = 0;
303 GVariant* variant = g_variant_get_child_value(retval, 0);
304 GVariant* array = g_variant_get_variant(variant);
305 if (g_variant_n_children(array) > 0) {
306 /* (si) */
307 GVariant* firstitem = g_variant_get_child_value(array, 0);
308 GVariant* vpid = g_variant_get_child_value(firstitem, 1);
309 pid = g_variant_get_int32(vpid);
310 g_variant_unref(vpid);
311 g_variant_unref(firstitem);
312 }
313 g_variant_unref(variant);
314 g_variant_unref(array);
315 g_variant_unref(retval);
316
317 return pid;
318}
319
320
213/* Handles setting up the overlay with the URL */321/* Handles setting up the overlay with the URL */
214gboolean322gboolean
215dispatcher_send_to_overlay (const gchar * app_id, const gchar * url, GDBusConnection * conn, const gchar * sender)323dispatcher_send_to_overlay (const gchar * app_id, const gchar * url, GDBusConnection * conn, const gchar * sender)
216{324{
217 GError * error = NULL;325 GError * error = NULL;
218326
219 /* TODO: Detect if a scope is what we need to overlay on */
220 GVariant * callret = g_dbus_connection_call_sync(conn,327 GVariant * callret = g_dbus_connection_call_sync(conn,
221 "org.freedesktop.DBus",328 "org.freedesktop.DBus",
222 "/",329 "/",
@@ -239,6 +346,12 @@
239 g_variant_get_child(callret, 0, "u", &pid);346 g_variant_get_child(callret, 0, "u", &pid);
240 g_variant_unref(callret);347 g_variant_unref(callret);
241348
349 /* If it is from a scope we need to overlay onto the
350 dash instead */
351 if (scope_checker_is_scope_pid(checker, pid)) {
352 pid = pid_for_upstart_job(conn, "unity8-dash");
353 }
354
242 return overlay_tracker_add(tracker, app_id, pid, url);355 return overlay_tracker_add(tracker, app_id, pid, url);
243}356}
244357
@@ -437,7 +550,17 @@
437550
438 *out_appid = ubuntu_app_launch_triplet_to_app_id(package, app, version);551 *out_appid = ubuntu_app_launch_triplet_to_app_id(package, app, version);
439 if (*out_appid != NULL) {552 if (*out_appid != NULL) {
440 retval = TRUE;553 /* Look at the current version of the app and ensure
554 we're not asking for an older version */
555 gchar * testappid = ubuntu_app_launch_triplet_to_app_id(package, app, NULL);
556 if (g_strcmp0(*out_appid, testappid) != 0) {
557 retval = FALSE;
558 g_clear_pointer(out_appid, g_free);
559 } else {
560 retval = TRUE;
561 }
562
563 g_free(testappid);
441 }564 }
442565
443 g_free(package);566 g_free(package);
@@ -483,6 +606,17 @@
483 }606 }
484 }607 }
485608
609 if (g_strcmp0(protocol, "scope") == 0) {
610 /* Add a check for the scope if we can do that, since it is
611 a system URL that we can do more checking on */
612 if (!scope_checker_is_scope(checker, domain)) {
613 found = FALSE;
614 g_clear_pointer(out_appid, g_free);
615 if (out_url != NULL)
616 g_clear_pointer(out_url, g_free);
617 }
618 }
619
486 g_free(protocol);620 g_free(protocol);
487 g_free(domain);621 g_free(domain);
488622
@@ -517,7 +651,7 @@
517651
518 if (error != NULL) {652 if (error != NULL) {
519 if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {653 if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
520 g_error("Unable to connect to D-Bus: %s", error->message);654 g_error("Unable to connect to D-Bus");
521 g_main_loop_quit(mainloop);655 g_main_loop_quit(mainloop);
522 }656 }
523 g_error_free(error);657 g_error_free(error);
@@ -547,17 +681,18 @@
547681
548/* Initialize all the globals */682/* Initialize all the globals */
549gboolean683gboolean
550dispatcher_init (GMainLoop * mainloop, OverlayTracker * intracker)684dispatcher_init (GMainLoop * mainloop, OverlayTracker * intracker, ScopeChecker * inchecker)
551{685{
552 tracker = intracker;686 tracker = intracker;
687 checker = inchecker;
553 cancellable = g_cancellable_new();688 cancellable = g_cancellable_new();
554689
555 urldb = url_db_create_database();690 urldb = url_db_create_database();
556 g_return_val_if_fail(urldb != NULL, FALSE);691 g_return_val_if_fail(urldb != NULL, FALSE);
557692
558 applicationre = g_regex_new("^application:///([a-zA-Z0-9_\\.-]*)\\.desktop$", 0, 0, NULL);693 applicationre = g_regex_new("^application:///([a-zA-Z0-9_\\.-]*)\\.desktop$", 0, 0, NULL);
559 appidre = g_regex_new("^appid://([a-z0-9\\.-]*)/([a-zA-Z0-9-]*)/([a-zA-Z0-9\\.-]*)$", 0, 0, NULL);694 appidre = g_regex_new("^appid://([a-z0-9\\.-]*)/([a-zA-Z0-9-\\.]*)/([a-zA-Z0-9\\.-]*)$", 0, 0, NULL);
560 genericre = g_regex_new("^([a-z][a-z0-9]*):(?://(?:.*@)?([a-zA-Z0-9\\.-]*)(?::[0-9]*)?/?)?(.*)?$", 0, 0, NULL);695 genericre = g_regex_new("^([a-z][a-z0-9]*):(?://(?:.*@)?([a-zA-Z0-9\\.-_]*)(?::[0-9]*)?/?)?(.*)?$", 0, 0, NULL);
561 intentre = g_regex_new("^intent://.*package=([a-zA-Z0-9\\.]*);.*$", 0, 0, NULL);696 intentre = g_regex_new("^intent://.*package=([a-zA-Z0-9\\.]*);.*$", 0, 0, NULL);
562697
563 g_bus_get(G_BUS_TYPE_SESSION, cancellable, bus_got, mainloop);698 g_bus_get(G_BUS_TYPE_SESSION, cancellable, bus_got, mainloop);
564699
=== modified file 'service/dispatcher.h'
--- service/dispatcher.h 2015-06-11 21:47:17 +0000
+++ service/dispatcher.h 2016-11-07 16:32:23 +0000
@@ -22,10 +22,11 @@
2222
23#include <gio/gio.h>23#include <gio/gio.h>
24#include "overlay-tracker.h"24#include "overlay-tracker.h"
25#include "scope-checker.h"
2526
26G_BEGIN_DECLS27G_BEGIN_DECLS
2728
28gboolean dispatcher_init (GMainLoop * mainloop, OverlayTracker * tracker);29gboolean dispatcher_init (GMainLoop * mainloop, OverlayTracker * tracker, ScopeChecker * checker);
29gboolean dispatcher_shutdown ();30gboolean dispatcher_shutdown ();
30gboolean dispatcher_url_to_appid (const gchar * url, gchar ** out_appid, const gchar ** out_url);31gboolean dispatcher_url_to_appid (const gchar * url, gchar ** out_appid, const gchar ** out_url);
31gboolean dispatcher_appid_restrict (const gchar * appid, const gchar * package);32gboolean dispatcher_appid_restrict (const gchar * appid, const gchar * package);
3233
=== modified file 'service/overlay-tracker-iface.h'
--- service/overlay-tracker-iface.h 2015-05-19 20:24:47 +0000
+++ service/overlay-tracker-iface.h 2016-11-07 16:32:23 +0000
@@ -23,4 +23,5 @@
23public:23public:
24 virtual ~OverlayTrackerIface() = default;24 virtual ~OverlayTrackerIface() = default;
25 virtual bool addOverlay (const char * appid, unsigned long pid, const char * url) = 0;25 virtual bool addOverlay (const char * appid, unsigned long pid, const char * url) = 0;
26 virtual bool badUrl (unsigned long pid, const char * url) = 0;
26};27};
2728
=== modified file 'service/overlay-tracker-mir.cpp'
--- service/overlay-tracker-mir.cpp 2015-06-11 21:47:17 +0000
+++ service/overlay-tracker-mir.cpp 2016-11-07 16:32:23 +0000
@@ -20,16 +20,20 @@
20#include "overlay-tracker-mir.h"20#include "overlay-tracker-mir.h"
21#include <ubuntu-app-launch.h>21#include <ubuntu-app-launch.h>
2222
23static const char * HELPER_TYPE = "url-overlay";23static const char * OVERLAY_HELPER_TYPE = "url-overlay";
24static const char * BAD_URL_HELPER_TYPE = "bad-url";
25static const char * BAD_URL_APP_ID = "url-dispatcher-bad-url-helper";
2426
25OverlayTrackerMir::OverlayTrackerMir () 27OverlayTrackerMir::OverlayTrackerMir ()
26 : thread([this] {28 : thread([this] {
27 /* Setup Helper Observer */29 /* Setup Helper Observer */
28 ubuntu_app_launch_observer_add_helper_stop(untrustedHelperStoppedStatic, HELPER_TYPE, this);30 ubuntu_app_launch_observer_add_helper_stop(overlayHelperStoppedStatic, OVERLAY_HELPER_TYPE, this);
31 ubuntu_app_launch_observer_add_helper_stop(overlayHelperStoppedStatic, BAD_URL_HELPER_TYPE, this);
29 },32 },
30 [this] {33 [this] {
31 /* Remove Helper Observer */34 /* Remove Helper Observer */
32 ubuntu_app_launch_observer_delete_helper_stop(untrustedHelperStoppedStatic, HELPER_TYPE, this);35 ubuntu_app_launch_observer_delete_helper_stop(overlayHelperStoppedStatic, OVERLAY_HELPER_TYPE, this);
36 ubuntu_app_launch_observer_delete_helper_stop(overlayHelperStoppedStatic, BAD_URL_HELPER_TYPE, this);
33 })37 })
34{38{
35 mir = std::shared_ptr<MirConnection>([] {39 mir = std::shared_ptr<MirConnection>([] {
@@ -52,8 +56,10 @@
52OverlayTrackerMir::~OverlayTrackerMir () 56OverlayTrackerMir::~OverlayTrackerMir ()
53{57{
54 thread.executeOnThread<bool>([this] {58 thread.executeOnThread<bool>([this] {
55 while (!ongoingSessions.empty()) {59 for (auto& sessionType : ongoingSessions) {
56 removeSession(std::get<2>(*ongoingSessions.begin()).get());60 while (!sessionType.second.empty()) {
61 removeSession(sessionType.first, sessionType.second.begin()->session.get());
62 }
57 }63 }
5864
59 return true;65 return true;
@@ -65,53 +71,76 @@
65bool71bool
66OverlayTrackerMir::addOverlay (const char * appid, unsigned long pid, const char * url)72OverlayTrackerMir::addOverlay (const char * appid, unsigned long pid, const char * url)
67{73{
68 std::string sappid(appid);74 return addOverlayCore(OVERLAY_HELPER_TYPE, appid, pid, url, overlaySessionStateChangedStatic);
75}
76
77bool
78OverlayTrackerMir::addOverlayCore (const char * helper_id, const char * appid, unsigned long pid, const char * url, void (*stateChangedFunction) (MirPromptSession*, MirPromptSessionState, void *))
79{
80 OverlayData data;
81 data.appid = appid;
69 std::string surl(url);82 std::string surl(url);
7083
71 return thread.executeOnThread<bool>([this, sappid, pid, surl] {84 return thread.executeOnThread<bool>([this, helper_id, &data, pid, surl, stateChangedFunction] {
72 g_debug("Setting up over lay for PID %d with '%s'", pid, sappid.c_str());85 g_debug("Setting up over lay for PID %d with '%s'", int(pid), data.appid.c_str());
7386
74 auto session = std::shared_ptr<MirPromptSession>(87 data.session = std::shared_ptr<MirPromptSession>(
75 mir_connection_create_prompt_session_sync(mir.get(), pid, sessionStateChangedStatic, this),88 mir_connection_create_prompt_session_sync(mir.get(), pid, stateChangedFunction, this),
76 [] (MirPromptSession * session) { if (session) mir_prompt_session_release_sync(session); });89 [] (MirPromptSession * session) { if (session) mir_prompt_session_release_sync(session); });
77 if (!session) {90 if (!data.session) {
78 g_critical("Unable to create trusted prompt session for %d with appid '%s'", pid, sappid.c_str());91 g_critical("Unable to create trusted prompt session for %d with appid '%s'", (int)pid, data.appid.c_str());
79 return false;92 return false;
80 }93 }
81 94
82 std::array<const char *, 2> urls { surl.c_str(), nullptr };95 std::array<const char *, 2> urls { surl.c_str(), nullptr };
83 auto instance = ubuntu_app_launch_start_session_helper(HELPER_TYPE, session.get(), sappid.c_str(), urls.data());96 auto instance = ubuntu_app_launch_start_session_helper(helper_id, data.session.get(), data.appid.c_str(), urls.data());
84 if (instance == nullptr) {97 if (instance == nullptr) {
85 g_critical("Unable to start helper for %d with appid '%s'", pid, sappid.c_str());98 g_critical("Unable to start helper for %d with appid '%s'", int(pid), data.appid.c_str());
86 return false;99 return false;
87 }100 }
101 data.instanceid = instance;
88102
89 ongoingSessions.emplace(std::make_tuple(sappid, std::string(instance), session));103 ongoingSessions[helper_id].push_back(data);
90 g_free(instance);104 g_free(instance);
91 return true;105 return true;
92 });106 });
93}107}
94108
95void109bool
96OverlayTrackerMir::sessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data)110OverlayTrackerMir::badUrl (unsigned long pid, const char * url)
97{111{
98 reinterpret_cast<OverlayTrackerMir *>(user_data)->sessionStateChanged(session, state);112 return addOverlayCore(BAD_URL_HELPER_TYPE, BAD_URL_APP_ID, pid, url, badUrlSessionStateChangedStatic);
99}113}
100114
101void115void
102OverlayTrackerMir::removeSession (MirPromptSession * session)116OverlayTrackerMir::overlaySessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data)
103{117{
104 for (auto it = ongoingSessions.begin(); it != ongoingSessions.end(); it++) {118 reinterpret_cast<OverlayTrackerMir *>(user_data)->sessionStateChanged(session, state, OVERLAY_HELPER_TYPE);
105 if (std::get<2>(*it).get() == session) {119}
106 ubuntu_app_launch_stop_multiple_helper(HELPER_TYPE, std::get<0>(*it).c_str(), std::get<1>(*it).c_str());120
107 ongoingSessions.erase(it);121void
122OverlayTrackerMir::badUrlSessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data)
123{
124 reinterpret_cast<OverlayTrackerMir *>(user_data)->sessionStateChanged(session, state, BAD_URL_HELPER_TYPE);
125}
126
127void
128OverlayTrackerMir::removeSession (const std::string &type, MirPromptSession * session)
129{
130 g_debug("Removing session: %p", (void*)session);
131 auto& sessions = ongoingSessions[type];
132
133 for (auto it = sessions.begin(); it != sessions.end(); it++) {
134 if (it->session.get() == session) {
135 ubuntu_app_launch_stop_multiple_helper(type.c_str(), it->appid.c_str(), it->instanceid.c_str());
136 sessions.erase(it);
108 break;137 break;
109 }138 }
110 }139 }
111}140}
112141
113void142void
114OverlayTrackerMir::sessionStateChanged (MirPromptSession * session, MirPromptSessionState state)143OverlayTrackerMir::sessionStateChanged (MirPromptSession * session, MirPromptSessionState state, const std::string &type)
115{144{
116 if (state != mir_prompt_session_state_stopped) {145 if (state != mir_prompt_session_state_stopped) {
117 /* We only care about the stopped state */146 /* We only care about the stopped state */
@@ -120,23 +149,24 @@
120149
121 /* Executing on the Mir thread, which is nice and all, but we150 /* Executing on the Mir thread, which is nice and all, but we
122 want to get back on our thread */151 want to get back on our thread */
123 thread.executeOnThread([this, session]() {152 thread.executeOnThread([this, type, session]() {
124 removeSession(session);153 removeSession(type, session);
125 });154 });
126}155}
127156
128void157void
129OverlayTrackerMir::untrustedHelperStoppedStatic (const gchar * appid, const gchar * instanceid, const gchar * helpertype, gpointer user_data)158OverlayTrackerMir::overlayHelperStoppedStatic (const gchar * appid, const gchar * instanceid, const gchar * helpertype, gpointer user_data)
130{159{
131 reinterpret_cast<OverlayTrackerMir *>(user_data)->untrustedHelperStopped(appid, instanceid, helpertype);160 reinterpret_cast<OverlayTrackerMir *>(user_data)->overlayHelperStopped(appid, instanceid, helpertype);
132}161}
133162
134void 163void
135OverlayTrackerMir::untrustedHelperStopped(const gchar * appid, const gchar * instanceid, const gchar * helpertype)164OverlayTrackerMir::overlayHelperStopped(const gchar * appid, const gchar * instanceid, const gchar * helpertype)
136{165{
137 /* This callback will happen on our thread already, we don't need166 /* This callback will happen on our thread already, we don't need
138 to proxy it on */167 to proxy it on */
139 if (g_strcmp0(helpertype, HELPER_TYPE) != 0) {168 if (g_strcmp0(helpertype, OVERLAY_HELPER_TYPE) != 0
169 && g_strcmp0(helpertype, BAD_URL_HELPER_TYPE) != 0) {
140 return;170 return;
141 }171 }
142172
@@ -144,10 +174,11 @@
144 std::string sappid(appid);174 std::string sappid(appid);
145 std::string sinstanceid(instanceid);175 std::string sinstanceid(instanceid);
146176
147 for (auto it = ongoingSessions.begin(); it != ongoingSessions.end(); it++) {177 for (auto it = ongoingSessions[helpertype].begin(); it != ongoingSessions[helpertype].end(); it++) {
148 if (std::get<0>(*it) == sappid && std::get<1>(*it) == sinstanceid) {178 if (it->appid == sappid && it->instanceid == sinstanceid) {
149 ongoingSessions.erase(it);179 ongoingSessions[helpertype].erase(it);
150 break;180 break;
151 }181 }
152 }182 }
153}183}
184
154185
=== modified file 'service/overlay-tracker-mir.h'
--- service/overlay-tracker-mir.h 2015-06-11 21:50:05 +0000
+++ service/overlay-tracker-mir.h 2016-11-07 16:32:23 +0000
@@ -19,7 +19,9 @@
1919
20#pragma once20#pragma once
2121
22#include <map>
22#include <set>23#include <set>
24#include <vector>
2325
24#include <mir_toolkit/mir_connection.h>26#include <mir_toolkit/mir_connection.h>
25#include <mir_toolkit/mir_prompt_session.h>27#include <mir_toolkit/mir_prompt_session.h>
@@ -29,21 +31,33 @@
2931
30class OverlayTrackerMir : public OverlayTrackerIface {32class OverlayTrackerMir : public OverlayTrackerIface {
31private:33private:
34 struct OverlayData {
35 std::string appid;
36 std::string instanceid;
37 std::shared_ptr<MirPromptSession> session;
38 };
39
32 GLib::ContextThread thread;40 GLib::ContextThread thread;
33 std::shared_ptr<MirConnection> mir;41 std::shared_ptr<MirConnection> mir;
34 std::set<std::tuple<std::string, std::string, std::shared_ptr<MirPromptSession>>> ongoingSessions;42 std::map<std::string, std::vector<OverlayData>> ongoingSessions;
3543
36public:44public:
37 OverlayTrackerMir (); 45 OverlayTrackerMir ();
38 ~OverlayTrackerMir (); 46 ~OverlayTrackerMir ();
39 bool addOverlay (const char * appid, unsigned long pid, const char * url) override;47 bool addOverlay (const char * appid, unsigned long pid, const char * url) override;
48 bool badUrl (unsigned long pid, const char * url) override;
4049
41private:50private:
42 void removeSession (MirPromptSession * session);51 /* Overlay Functions */
4352 void removeSession (const std::string &type, MirPromptSession * session);
44 static void sessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data);53
45 void sessionStateChanged (MirPromptSession * session, MirPromptSessionState state);54 static void badUrlSessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data);
4655 static void overlaySessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data);
47 static void untrustedHelperStoppedStatic (const gchar * appid, const gchar * instanceid, const gchar * helpertype, gpointer user_data);56 void sessionStateChanged (MirPromptSession * session, MirPromptSessionState state, const std::string &type);
48 void untrustedHelperStopped(const gchar * appid, const gchar * instanceid, const gchar * helpertype);57
58 static void overlayHelperStoppedStatic (const gchar * appid, const gchar * instanceid, const gchar * helpertype, gpointer user_data);
59 void overlayHelperStopped(const gchar * appid, const gchar * instanceid, const gchar * helpertype);
60
61 bool addOverlayCore (const gchar * helperid, const gchar * appid, unsigned long pid, const gchar * url, void (*stateChangedFunction) (MirPromptSession*, MirPromptSessionState, void *));
62
49};63};
5064
=== modified file 'service/overlay-tracker.cpp'
--- service/overlay-tracker.cpp 2015-06-11 21:47:17 +0000
+++ service/overlay-tracker.cpp 2016-11-07 16:32:23 +0000
@@ -52,3 +52,12 @@
5252
53 return reinterpret_cast<OverlayTrackerIface *>(tracker)->addOverlay(appid, pid, url) ? TRUE : FALSE;53 return reinterpret_cast<OverlayTrackerIface *>(tracker)->addOverlay(appid, pid, url) ? TRUE : FALSE;
54}54}
55
56gboolean
57overlay_tracker_badurl (OverlayTracker * tracker, unsigned long pid, const gchar * url) {
58 g_return_val_if_fail(tracker != nullptr, FALSE);
59 g_return_val_if_fail(pid != 0, FALSE);
60 g_return_val_if_fail(url != nullptr, FALSE);
61
62 return reinterpret_cast<OverlayTrackerIface *>(tracker)->badUrl(pid, url) ? TRUE : FALSE;
63}
5564
=== modified file 'service/overlay-tracker.h'
--- service/overlay-tracker.h 2015-06-11 21:47:17 +0000
+++ service/overlay-tracker.h 2016-11-07 16:32:23 +0000
@@ -25,4 +25,5 @@
25OverlayTracker * overlay_tracker_new ();25OverlayTracker * overlay_tracker_new ();
26void overlay_tracker_delete (OverlayTracker * tracker);26void overlay_tracker_delete (OverlayTracker * tracker);
27gboolean overlay_tracker_add (OverlayTracker * tracker, const char * appid, unsigned long pid, const char * url);27gboolean overlay_tracker_add (OverlayTracker * tracker, const char * appid, unsigned long pid, const char * url);
28gboolean overlay_tracker_badurl (OverlayTracker * tracker, unsigned long pid, const char * url);
2829
2930
=== added file 'service/scope-checker-facade.h'
--- service/scope-checker-facade.h 1970-01-01 00:00:00 +0000
+++ service/scope-checker-facade.h 2016-11-07 16:32:23 +0000
@@ -0,0 +1,27 @@
1/**
2 * Copyright © 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#pragma once
19
20#include <unity-scopes.h>
21
22class RuntimeFacade {
23public:
24 RuntimeFacade () = default;
25 virtual ~RuntimeFacade () = default;
26 virtual unity::scopes::RegistryProxy registry () = 0;
27};
028
=== added file 'service/scope-checker.cpp'
--- service/scope-checker.cpp 1970-01-01 00:00:00 +0000
+++ service/scope-checker.cpp 2016-11-07 16:32:23 +0000
@@ -0,0 +1,114 @@
1/**
2 * Copyright © 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18extern "C" {
19#include "scope-checker.h"
20#include <sys/apparmor.h>
21#include <ubuntu-app-launch.h>
22}
23
24#include <unity-scopes.h>
25#include "scope-checker-facade.h"
26
27class RuntimeReal : public RuntimeFacade {
28public:
29 unity::scopes::Runtime::UPtr runtime;
30 RuntimeReal () {
31 runtime = unity::scopes::Runtime::create();
32 }
33
34 unity::scopes::RegistryProxy registry () override {
35 return runtime->registry();
36 }
37};
38
39ScopeChecker *
40scope_checker_new ()
41{
42 auto fu_runtime = new RuntimeReal();
43 return reinterpret_cast<ScopeChecker *>(fu_runtime);
44}
45
46void
47scope_checker_delete (ScopeChecker * checker)
48{
49 auto runtime = reinterpret_cast<RuntimeFacade *>(checker);
50 delete runtime;
51}
52
53bool
54scope_checker_is_scope (ScopeChecker * checker, const char * appid)
55{
56 if (checker == nullptr) {
57 g_warning("%s:%d: Checker is '(null)'", __FILE__, __LINE__);
58 return false;
59 }
60 if (appid == nullptr) {
61 g_warning("%s:%d: appid is '(null)'", __FILE__, __LINE__);
62 return false;
63 }
64
65 auto runtime = reinterpret_cast<RuntimeFacade *>(checker);
66
67 try {
68 auto registry = runtime->registry();
69 registry->get_metadata(appid);
70 return true;
71 } catch (unity::scopes::NotFoundException e) {
72 return false;
73 } catch (...) {
74 g_warning("Unable to read the Unity Scopes Registry");
75 return false;
76 }
77}
78
79bool
80scope_checker_is_scope_pid (ScopeChecker * checker, pid_t pid)
81{
82 if (pid == 0)
83 return false;
84
85 char * aa = nullptr;
86 if (aa_gettaskcon(pid, &aa, nullptr) != 0) {
87 return false;
88 }
89
90 if (aa == nullptr)
91 return false;
92
93 std::string appid(aa);
94 free(aa);
95
96 if (appid == "unconfined") {
97 /* We're not going to support unconfined scopes, too hard */
98 return false;
99 }
100
101 gchar * pkg = nullptr;
102 gchar * app = nullptr;
103 if (ubuntu_app_launch_app_id_parse(appid.c_str(), &pkg, &app, nullptr)) {
104 appid= pkg;
105 appid += "_";
106 appid += app;
107
108 g_free(pkg);
109 g_free(app);
110 }
111
112 g_debug("PID %d is short App ID %s", pid, appid.c_str());
113 return scope_checker_is_scope(checker, appid.c_str());
114}
0115
=== added file 'service/scope-checker.h'
--- service/scope-checker.h 1970-01-01 00:00:00 +0000
+++ service/scope-checker.h 2016-11-07 16:32:23 +0000
@@ -0,0 +1,29 @@
1/**
2 * Copyright © 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#pragma once
19
20#include <sys/types.h>
21#include <stdbool.h>
22
23typedef struct _ScopeChecker ScopeChecker;
24
25ScopeChecker * scope_checker_new ();
26void scope_checker_delete (ScopeChecker * checker);
27bool scope_checker_is_scope (ScopeChecker * checker, const char * appid);
28bool scope_checker_is_scope_pid (ScopeChecker * checker, pid_t pid);
29
030
=== modified file 'service/service.c'
--- service/service.c 2015-09-03 21:50:06 +0000
+++ service/service.c 2016-11-07 16:32:23 +0000
@@ -40,7 +40,14 @@
40 guint term_source = g_unix_signal_add(SIGTERM, sig_term, mainloop);40 guint term_source = g_unix_signal_add(SIGTERM, sig_term, mainloop);
4141
42 OverlayTracker * tracker = overlay_tracker_new();42 OverlayTracker * tracker = overlay_tracker_new();
43 if (!dispatcher_init(mainloop, tracker)) {43
44 ScopeChecker * checker = NULL;
45 /* Allow disabing for testing */
46 if (g_getenv("URL_DISPATCHER_DISABLE_SCOPE_CHECKING") == NULL)
47 checker = scope_checker_new();
48
49 /* Initialize Dispatcher */
50 if (!dispatcher_init(mainloop, tracker, checker)) {
44 return -1;51 return -1;
45 }52 }
4653
@@ -50,6 +57,7 @@
50 /* Clean up globals */57 /* Clean up globals */
51 dispatcher_shutdown();58 dispatcher_shutdown();
52 overlay_tracker_delete(tracker);59 overlay_tracker_delete(tracker);
60 scope_checker_delete(checker);
53 g_source_remove(term_source);61 g_source_remove(term_source);
54 g_main_loop_unref(mainloop);62 g_main_loop_unref(mainloop);
5563
5664
=== added directory 'service/url-overlay'
=== added file 'service/url-overlay/CMakeLists.txt'
--- service/url-overlay/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ service/url-overlay/CMakeLists.txt 2016-11-07 16:32:23 +0000
@@ -0,0 +1,14 @@
1
2###########################
3# URL Overlay Exec Tool
4###########################
5
6add_executable(url-overlay-exec-tool exec-tool.c ../recoverable-problem.c)
7set_target_properties(url-overlay-exec-tool PROPERTIES OUTPUT_NAME "exec-tool")
8target_link_libraries(url-overlay-exec-tool ${GIO2_LIBRARIES} ${UBUNTU_APP_LAUNCH_LIBRARIES} ${CLICK_LIBRARIES})
9
10install(
11 TARGETS url-overlay-exec-tool
12 RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/ubuntu-app-launch/url-overlay"
13)
14
015
=== renamed file 'service/url-overlay.c' => 'service/url-overlay/exec-tool.c'
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2015-06-11 21:38:13 +0000
+++ tests/CMakeLists.txt 2016-11-07 16:32:23 +0000
@@ -25,6 +25,8 @@
25###########################25###########################
2626
27add_library(mock-lib STATIC27add_library(mock-lib STATIC
28 apparmor-mock.h
29 apparmor-mock.c
28 recoverable-problem-mock.c30 recoverable-problem-mock.c
29 ubuntu-app-launch-mock.h31 ubuntu-app-launch-mock.h
30 ubuntu-app-launch-mock.c)32 ubuntu-app-launch-mock.c)
@@ -62,6 +64,7 @@
62 mock-lib64 mock-lib
63 gtest65 gtest
64 ${UBUNTU_APP_LAUNCH_LIBRARIES}66 ${UBUNTU_APP_LAUNCH_LIBRARIES}
67 ${DBUSTEST_LIBRARIES}
65 ${GTEST_LIBS})68 ${GTEST_LIBS})
6669
67add_test (dispatcher-test dispatcher-test)70add_test (dispatcher-test dispatcher-test)
6871
=== modified file 'tests/app-id-test.cc'
--- tests/app-id-test.cc 2015-05-15 21:24:15 +0000
+++ tests/app-id-test.cc 2016-11-07 16:32:23 +0000
@@ -23,6 +23,8 @@
23#include "ubuntu-app-launch-mock.h"23#include "ubuntu-app-launch-mock.h"
24#include "overlay-tracker-mock.h"24#include "overlay-tracker-mock.h"
2525
26#include "ubuntu-app-launch/registry.h"
27
26class AppIdTest : public ::testing::Test28class AppIdTest : public ::testing::Test
27{29{
28 private:30 private:
@@ -33,9 +35,20 @@
3335
34 protected:36 protected:
35 virtual void SetUp() {37 virtual void SetUp() {
38 /* Click DB Config */
36 g_setenv("TEST_CLICK_DB", "click-db", TRUE);39 g_setenv("TEST_CLICK_DB", "click-db", TRUE);
37 g_setenv("TEST_CLICK_USER", "test-user", TRUE);40 g_setenv("TEST_CLICK_USER", "test-user", TRUE);
3841
42 /* Make sure we don't use the local snapd */
43 g_setenv("UBUNTU_APP_LAUNCH_SNAPD_SOCKET", "/this/should/not/exist", TRUE);
44
45 /* UAL Desktop Hook check */
46 g_setenv("UBUNTU_APP_LAUNCH_LINK_FARM", CMAKE_SOURCE_DIR "/tests/ual-link-farm", TRUE);
47
48 /* XDG Data home for libertine */
49 g_setenv("XDG_DATA_HOME", CMAKE_SOURCE_DIR "/tests/xdg-data", TRUE);
50 g_setenv("XDG_CACHE_HOME", CMAKE_SOURCE_DIR "/tests/xdg-cache", TRUE);
51
39 cachedir = g_build_filename(CMAKE_BINARY_DIR, "app-id-test-cache", nullptr);52 cachedir = g_build_filename(CMAKE_BINARY_DIR, "app-id-test-cache", nullptr);
40 g_setenv("URL_DISPATCHER_CACHE_DIR", cachedir, TRUE);53 g_setenv("URL_DISPATCHER_CACHE_DIR", cachedir, TRUE);
4154
@@ -43,13 +56,14 @@
43 g_test_dbus_up(testbus);56 g_test_dbus_up(testbus);
4457
45 mainloop = g_main_loop_new(nullptr, FALSE);58 mainloop = g_main_loop_new(nullptr, FALSE);
46 dispatcher_init(mainloop, reinterpret_cast<OverlayTracker *>(&tracker));59 dispatcher_init(mainloop, reinterpret_cast<OverlayTracker *>(&tracker), nullptr);
4760
48 return;61 return;
49 }62 }
5063
51 virtual void TearDown() {64 virtual void TearDown() {
52 dispatcher_shutdown();65 dispatcher_shutdown();
66 ubuntu::app_launch::Registry::clearDefault();
5367
54 /* Clean up queued events */68 /* Clean up queued events */
55 while (g_main_pending()) {69 while (g_main_pending()) {
@@ -88,6 +102,18 @@
88 g_clear_pointer(&out_appid, g_free);102 g_clear_pointer(&out_appid, g_free);
89 out_url = nullptr;103 out_url = nullptr;
90104
105 /* App ID with periods */
106 dispatcher_url_to_appid("appid://container-id/org.canonical.app1/0.0", &out_appid, &out_url);
107 ASSERT_STREQ("container-id_org.canonical.app1_0.0", out_appid);
108 EXPECT_EQ(nullptr, out_url);
109
110 dispatcher_send_to_app(out_appid, out_url);
111 EXPECT_STREQ("container-id_org.canonical.app1_0.0", ubuntu_app_launch_mock_get_last_app_id());
112
113 ubuntu_app_launch_mock_clear_last_app_id();
114 g_clear_pointer(&out_appid, g_free);
115 out_url = nullptr;
116
91 /* No version at all */117 /* No version at all */
92 dispatcher_url_to_appid("appid://com.test.good/app1", &out_appid, &out_url);118 dispatcher_url_to_appid("appid://com.test.good/app1", &out_appid, &out_url);
93119
@@ -199,31 +225,3 @@
199225
200 return;226 return;
201}227}
202
203TEST_F(AppIdTest, BadDirectory)
204{
205 gchar * out_appid = nullptr;
206 const gchar * out_url = nullptr;
207
208 g_setenv("TEST_CLICK_DB", "not-click-db", TRUE);
209
210 dispatcher_url_to_appid("appid://com.test.good/app1/current-user-version", &out_appid, &out_url);
211
212 EXPECT_EQ(nullptr, out_appid);
213 EXPECT_EQ(nullptr, out_url);
214
215 return;
216}
217
218TEST_F(AppIdTest, BadUser)
219{
220 gchar * out_appid = nullptr;
221 const gchar * out_url = nullptr;
222
223 g_setenv("TEST_CLICK_USER", "not-test-user", TRUE);
224
225 dispatcher_url_to_appid("appid://com.test.good/app1/current-user-version", &out_appid, &out_url);
226
227 EXPECT_EQ(nullptr, out_appid);
228 EXPECT_EQ(nullptr, out_url);
229}
230228
=== added file 'tests/apparmor-mock.c'
--- tests/apparmor-mock.c 1970-01-01 00:00:00 +0000
+++ tests/apparmor-mock.c 2016-11-07 16:32:23 +0000
@@ -0,0 +1,36 @@
1/**
2 * Copyright © 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#include <glib.h>
19#include <sys/apparmor.h>
20
21const char * aa_mock_gettask_profile = NULL;
22
23int aa_gettaskcon (pid_t pid, char ** profile, char ** mode)
24{
25 g_debug("Gettask Con '%s'", aa_mock_gettask_profile);
26
27 if (aa_mock_gettask_profile == NULL) {
28 return 1;
29 }
30
31 if (profile != NULL) {
32 *profile = g_strdup(aa_mock_gettask_profile);
33 }
34
35 return 0;
36}
037
=== added file 'tests/apparmor-mock.h'
--- tests/apparmor-mock.h 1970-01-01 00:00:00 +0000
+++ tests/apparmor-mock.h 2016-11-07 16:32:23 +0000
@@ -0,0 +1,20 @@
1/**
2 * Copyright © 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#pragma once
19
20extern const char * aa_mock_gettask_profile;
021
=== modified file 'tests/click-data/manifests/com.test.good.manifest'
--- tests/click-data/manifests/com.test.good.manifest 2013-09-18 04:16:51 +0000
+++ tests/click-data/manifests/com.test.good.manifest 2016-11-07 16:32:23 +0000
@@ -3,7 +3,7 @@
3 "name": "com.test.good",3 "name": "com.test.good",
4 "hooks": {4 "hooks": {
5 "app1": {5 "app1": {
6 "test": "test"6 "desktop": "app1.desktop"
7 }7 }
8 }8 }
9}9}
1010
=== modified file 'tests/click-data/manifests/com.test.multiple.manifest'
--- tests/click-data/manifests/com.test.multiple.manifest 2013-09-26 20:30:45 +0000
+++ tests/click-data/manifests/com.test.multiple.manifest 2016-11-07 16:32:23 +0000
@@ -3,13 +3,13 @@
3 "name": "com.test.good",3 "name": "com.test.good",
4 "hooks": {4 "hooks": {
5 "app-first": {5 "app-first": {
6 "test": "test"6 "desktop": "app-first.desktop"
7 },7 },
8 "app-middle": {8 "app-middle": {
9 "test": "test"9 "desktop": "app-middle.desktop"
10 },10 },
11 "app-last": {11 "app-last": {
12 "test": "test"12 "desktop": "app-last.desktop"
13 }13 }
14 }14 }
15}15}
1616
=== modified file 'tests/dispatcher-test.cc'
--- tests/dispatcher-test.cc 2015-06-08 17:13:44 +0000
+++ tests/dispatcher-test.cc 2016-11-07 16:32:23 +0000
@@ -19,10 +19,13 @@
1919
20#include <gio/gio.h>20#include <gio/gio.h>
21#include <gtest/gtest.h>21#include <gtest/gtest.h>
22#include <libdbustest/dbus-test.h>
22#include "dispatcher.h"23#include "dispatcher.h"
23#include "ubuntu-app-launch-mock.h"24#include "ubuntu-app-launch-mock.h"
24#include "overlay-tracker-mock.h"25#include "overlay-tracker-mock.h"
25#include "url-db.h"26#include "url-db.h"
27#include "scope-mock.h"
28#include "apparmor-mock.h"
2629
27class DispatcherTest : public ::testing::Test30class DispatcherTest : public ::testing::Test
28{31{
@@ -33,6 +36,7 @@
3336
34 protected:37 protected:
35 OverlayTrackerMock tracker;38 OverlayTrackerMock tracker;
39 RuntimeMock scope_runtime;
36 GDBusConnection * session = nullptr;40 GDBusConnection * session = nullptr;
3741
38 virtual void SetUp() {42 virtual void SetUp() {
@@ -66,6 +70,9 @@
66 url_db_set_file_motification_time(db, "/testdir/intenter.url-dispatcher", &timestamp);70 url_db_set_file_motification_time(db, "/testdir/intenter.url-dispatcher", &timestamp);
67 url_db_insert_url(db, "/testdir/intenter.url-dispatcher", "intent", "my.android.package");71 url_db_insert_url(db, "/testdir/intenter.url-dispatcher", "intent", "my.android.package");
6872
73 url_db_set_file_motification_time(db, "/testdir/scoper.url-dispatcher", &timestamp);
74 url_db_insert_url(db, "/testdir/scoper.url-dispatcher", "scope", nullptr);
75
69 sqlite3_close(db);76 sqlite3_close(db);
7077
71 testbus = g_test_dbus_new(G_TEST_DBUS_NONE);78 testbus = g_test_dbus_new(G_TEST_DBUS_NONE);
@@ -74,7 +81,7 @@
74 session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);81 session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
7582
76 mainloop = g_main_loop_new(nullptr, FALSE);83 mainloop = g_main_loop_new(nullptr, FALSE);
77 dispatcher_init(mainloop, reinterpret_cast<OverlayTracker *>(&tracker));84 dispatcher_init(mainloop, reinterpret_cast<OverlayTracker *>(&tracker), reinterpret_cast<ScopeChecker *>(&scope_runtime));
7885
79 return;86 return;
80 }87 }
@@ -90,6 +97,7 @@
90 g_main_loop_unref(mainloop);97 g_main_loop_unref(mainloop);
9198
92 ubuntu_app_launch_mock_clear_last_app_id();99 ubuntu_app_launch_mock_clear_last_app_id();
100 scope_runtime.clearExceptions();
93101
94 /* let other threads settle */102 /* let other threads settle */
95 g_usleep(500000);103 g_usleep(500000);
@@ -260,6 +268,42 @@
260 return;268 return;
261}269}
262270
271DbusTestDbusMock *
272setupUpstartMock ()
273{
274 auto mock = dbus_test_dbus_mock_new("com.ubuntu.Upstart");
275 auto obj = dbus_test_dbus_mock_get_object(mock, "/com/ubuntu/Upstart", "com.ubuntu.Upstart0_6", nullptr);
276
277 dbus_test_dbus_mock_object_add_method(mock, obj,
278 "GetJobByName",
279 G_VARIANT_TYPE_STRING,
280 G_VARIANT_TYPE_OBJECT_PATH, /* out */
281 "ret = dbus.ObjectPath('/job')", /* python */
282 nullptr); /* error */
283
284 auto jobobj = dbus_test_dbus_mock_get_object(mock, "/job", "com.ubuntu.Upstart0_6.Job", nullptr);
285
286 dbus_test_dbus_mock_object_add_method(mock, jobobj,
287 "GetInstanceByName",
288 G_VARIANT_TYPE_STRING,
289 G_VARIANT_TYPE_OBJECT_PATH, /* out */
290 "ret = dbus.ObjectPath('/instance')", /* python */
291 NULL); /* error */
292
293 auto instobj = dbus_test_dbus_mock_get_object(mock, "/instance", "com.ubuntu.Upstart0_6.Instance", NULL);
294
295 dbus_test_dbus_mock_object_add_property(mock, instobj,
296 "processes",
297 G_VARIANT_TYPE("a(si)"),
298 g_variant_new_parsed("[('main', 1234)]"),
299 NULL);
300
301 dbus_test_task_set_name(DBUS_TEST_TASK(mock), "Upstart");
302 dbus_test_task_run(DBUS_TEST_TASK(mock));
303
304 return mock;
305}
306
263TEST_F(DispatcherTest, OverlayTest)307TEST_F(DispatcherTest, OverlayTest)
264{308{
265 EXPECT_TRUE(dispatcher_is_overlay("com.test.good_application_1.2.3"));309 EXPECT_TRUE(dispatcher_is_overlay("com.test.good_application_1.2.3"));
@@ -272,5 +316,44 @@
272 EXPECT_EQ(getpid(), std::get<1>(tracker.addedOverlays[0]));316 EXPECT_EQ(getpid(), std::get<1>(tracker.addedOverlays[0]));
273 EXPECT_EQ("overlay://ubuntu.com", std::get<2>(tracker.addedOverlays[0]));317 EXPECT_EQ("overlay://ubuntu.com", std::get<2>(tracker.addedOverlays[0]));
274318
319 tracker.addedOverlays.clear();
320 aa_mock_gettask_profile = "simplescope.scopemaster_simplescope_1.2.3";
321
322 auto upstartMock = setupUpstartMock();
323
324 EXPECT_TRUE(dispatcher_send_to_overlay ("com.test.good_application_1.2.3", "overlay://ubuntu.com", session, g_dbus_connection_get_unique_name(session)));
325
326 ASSERT_EQ(1, tracker.addedOverlays.size());
327 EXPECT_EQ("com.test.good_application_1.2.3", std::get<0>(tracker.addedOverlays[0]));
328 EXPECT_EQ(1234, std::get<1>(tracker.addedOverlays[0]));
329 EXPECT_EQ("overlay://ubuntu.com", std::get<2>(tracker.addedOverlays[0]));
330
331 g_object_unref(upstartMock);
332
275 return;333 return;
276}334}
335
336TEST_F(DispatcherTest, ScopeTest)
337{
338 gchar * out_appid = nullptr;
339
340 unity::scopes::NotFoundException scopeException("test", "badscope");
341 scope_runtime.addException("badscope.scopemaster_badscope", scopeException);
342 std::invalid_argument invalidException("confused");
343 scope_runtime.addException("confusedscope.scopemaster_confusedscope", invalidException);
344
345 /* Good sanity check */
346 dispatcher_url_to_appid("scope://simplescope.scopemaster_simplescope", &out_appid, nullptr);
347 EXPECT_STREQ("scoper", out_appid);
348 g_free(out_appid);
349
350 /* Bad scope */
351 dispatcher_url_to_appid("scope://badscope.scopemaster_badscope", &out_appid, nullptr);
352 EXPECT_STRNE("scoper", out_appid);
353 g_free(out_appid);
354
355 /* Confused scope */
356 dispatcher_url_to_appid("scope://confusedscope.scopemaster_confusedscope", &out_appid, nullptr);
357 EXPECT_STRNE("scoper", out_appid);
358 g_free(out_appid);
359}
277360
=== modified file 'tests/overlay-tracker-mock.h'
--- tests/overlay-tracker-mock.h 2015-05-19 20:24:47 +0000
+++ tests/overlay-tracker-mock.h 2016-11-07 16:32:23 +0000
@@ -22,9 +22,15 @@
22{22{
23 public:23 public:
24 std::vector<std::tuple<std::string, unsigned long, std::string>> addedOverlays;24 std::vector<std::tuple<std::string, unsigned long, std::string>> addedOverlays;
25 std::vector<std::pair<unsigned long, std::string>> addedBadUrl;
2526
26 bool addOverlay (const char * appid, unsigned long pid, const char * url) {27 bool addOverlay (const char * appid, unsigned long pid, const char * url) {
27 addedOverlays.push_back(std::make_tuple(std::string(appid), pid, std::string(url)));28 addedOverlays.push_back(std::make_tuple(std::string(appid), pid, std::string(url)));
28 return true;29 return true;
29 }30 }
31
32 bool badUrl (unsigned long pid, const char * url) {
33 addedBadUrl.push_back(std::make_pair(pid, std::string(url)));
34 return true;
35 }
30};36};
3137
=== modified file 'tests/overlay-tracker-test.cpp'
--- tests/overlay-tracker-test.cpp 2015-05-19 20:24:47 +0000
+++ tests/overlay-tracker-test.cpp 2016-11-07 16:32:23 +0000
@@ -95,23 +95,43 @@
95 }95 }
96}96}
9797
98TEST_F(OverlayTrackerTest, UALSignalStop) {98void
99 OverlayTrackerMir tracker;99ualStop (const char * helper_type, std::function<bool(OverlayTrackerMir *)> addFunc)
100{
101 auto tracker = new OverlayTrackerMir();
100102
101 /* Call with the overlay before it is set */103 /* Call with the overlay before it is set */
102 ubuntu_app_launch_mock_observer_helper_stop_func("app-id", "instance", "url-overlay", ubuntu_app_launch_mock_observer_helper_stop_user_data);104 ubuntu_app_launch_mock_observer_helper_stop_func("app-id", "instance", helper_type, ubuntu_app_launch_mock_observer_helper_stop_user_data);
103105
104 EXPECT_TRUE(tracker.addOverlay("app-id", 5, "http://no-name-yet.com"));106 EXPECT_TRUE(addFunc(tracker));
105107
106 mir_mock_last_released_session = nullptr;108 mir_mock_last_released_session = nullptr;
107 ubuntu_app_launch_mock_observer_helper_stop_func("app-id", "instance", "url-overlay", ubuntu_app_launch_mock_observer_helper_stop_user_data);109 ubuntu_app_launch_mock_observer_helper_stop_func("app-id", "instance", helper_type, ubuntu_app_launch_mock_observer_helper_stop_user_data);
110
111 delete tracker;
112
108 EXPECT_NE(nullptr, mir_mock_last_released_session);113 EXPECT_NE(nullptr, mir_mock_last_released_session);
109}114}
110115
111TEST_F(OverlayTrackerTest, MirSignalStop) {116TEST_F(OverlayTrackerTest, UALSignalStop) {
112 OverlayTrackerMir tracker;117 ualStop("url-overlay", [](OverlayTrackerMir * tracker) {
113118 return tracker->addOverlay("app-id", 5, "http://no-name-yet.com");
114 EXPECT_TRUE(tracker.addOverlay("app-id", 5, "http://no-name-yet.com"));119 });
120 ualStop("bad-url", [](OverlayTrackerMir * tracker) {
121 return tracker->badUrl(5, "http://no-name-yet.com");
122 });
123}
124
125void
126mirStop (const char * helper_type, const char * appid, std::function<bool(OverlayTrackerMir *)> addFunc)
127{
128 g_clear_pointer(&ubuntu_app_launch_mock_last_stop_helper, g_free);
129 g_clear_pointer(&ubuntu_app_launch_mock_last_stop_appid, g_free);
130 g_clear_pointer(&ubuntu_app_launch_mock_last_stop_instance, g_free);
131
132 auto tracker = new OverlayTrackerMir();
133
134 EXPECT_TRUE(addFunc(tracker));
115135
116 /* Try a badie */136 /* Try a badie */
117 mir_mock_last_trust_func((MirPromptSession *)1337, mir_prompt_session_state_stopped, mir_mock_last_trust_data);137 mir_mock_last_trust_func((MirPromptSession *)1337, mir_prompt_session_state_stopped, mir_mock_last_trust_data);
@@ -119,9 +139,18 @@
119 EXPECT_NE(nullptr, mir_mock_last_trust_func);139 EXPECT_NE(nullptr, mir_mock_last_trust_func);
120 mir_mock_last_trust_func(mir_mock_valid_trust_session, mir_prompt_session_state_stopped, mir_mock_last_trust_data);140 mir_mock_last_trust_func(mir_mock_valid_trust_session, mir_prompt_session_state_stopped, mir_mock_last_trust_data);
121141
122 pause(100);142 delete tracker;
123143
124 EXPECT_STREQ("url-overlay", ubuntu_app_launch_mock_last_stop_helper);144 EXPECT_STREQ(helper_type, ubuntu_app_launch_mock_last_stop_helper);
125 EXPECT_STREQ("app-id", ubuntu_app_launch_mock_last_stop_appid);145 EXPECT_STREQ(appid, ubuntu_app_launch_mock_last_stop_appid);
126 EXPECT_STREQ("instance", ubuntu_app_launch_mock_last_stop_instance);146 EXPECT_STREQ("instance", ubuntu_app_launch_mock_last_stop_instance);
127}147}
148
149TEST_F(OverlayTrackerTest, MirSignalStop) {
150 mirStop("url-overlay", "app-id", [](OverlayTrackerMir * tracker) {
151 return tracker->addOverlay("app-id", 5, "http://no-name-yet.com");
152 });
153 mirStop("bad-url", "url-dispatcher-bad-url-helper", [](OverlayTrackerMir * tracker) {
154 return tracker->badUrl(5, "http://no-name-yet.com");
155 });
156}
128157
=== added file 'tests/scope-mock.h'
--- tests/scope-mock.h 1970-01-01 00:00:00 +0000
+++ tests/scope-mock.h 2016-11-07 16:32:23 +0000
@@ -0,0 +1,95 @@
1/**
2 * Copyright © 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#include <unity-scopes.h>
19#include <unity/scopes/testing/ScopeMetadataBuilder.h>
20
21#include "scope-checker-facade.h"
22
23class unity::scopes::internal::ScopeMetadataImpl {
24public:
25 ScopeMetadataImpl () { }
26 virtual ~ScopeMetadataImpl () {}
27
28};
29
30/********
31 TODO: Look at replacing this with: #include <unity/scopes/testing/MockRegistry.h>
32 *******/
33
34class RegistryMock : public virtual unity::scopes::Registry
35{
36 std::shared_ptr<std::map<std::string, std::exception>> scopeExceptions;
37
38public:
39 RegistryMock (std::shared_ptr<std::map<std::string, std::exception>> inexceptions)
40 : scopeExceptions(inexceptions)
41 {
42 }
43
44 unity::scopes::ScopeMetadata get_metadata(std::string const& scope_id) override {
45 std::cout << "Getting Metadata" << std::endl;
46 try {
47 auto exp = scopeExceptions->at(scope_id);
48 throw exp;
49 } catch (std::out_of_range e) {
50 unity::scopes::testing::ScopeMetadataBuilder builder;
51 builder.scope_id(scope_id);
52 std::shared_ptr<unity::scopes::Scope> foo((unity::scopes::Scope *)5, [](unity::scopes::Scope *) { return; });
53 builder.proxy(foo);
54 builder.display_name("foo");
55 builder.description("foo");
56 builder.author("foo");
57 return builder();
58 }
59 }
60
61 /* I hate C++ so much right now */
62 std::string endpoint() override { throw new std::invalid_argument("Not implemented"); }
63 std::string identity() override { throw new std::invalid_argument("Not implemented"); }
64 std::string target_category() override { throw new std::invalid_argument("Not implemented"); }
65 std::string to_string() override { throw new std::invalid_argument("Not implemented"); }
66 int64_t timeout() override { throw new std::invalid_argument("Not implemented"); }
67 unity::scopes::MetadataMap list() override { throw new std::invalid_argument("Not implemented"); }
68 unity::scopes::MetadataMap list_if(std::function<bool(unity::scopes::ScopeMetadata const& item)>) override { throw new std::invalid_argument("Not implemented"); }
69 bool is_scope_running(std::string const&) override { throw new std::invalid_argument("Not implemented"); }
70 core::ScopedConnection set_scope_state_callback(std::string const&, std::function<void(bool is_running)>) override { throw new std::invalid_argument("Not implemented"); }
71 core::ScopedConnection set_list_update_callback(std::function<void()>) override { throw new std::invalid_argument("Not implemented"); }
72};
73
74class RuntimeMock : public RuntimeFacade
75{
76 std::shared_ptr<std::map<std::string, std::exception>> scopeExceptions;
77
78public:
79 RuntimeMock() {
80 scopeExceptions = std::make_shared<std::map<std::string, std::exception>>();
81 }
82
83 unity::scopes::RegistryProxy registry () {
84 return std::make_shared<RegistryMock>(scopeExceptions);
85 }
86
87 void clearExceptions() {
88 scopeExceptions->clear();
89 }
90
91 void addException (std::string scopeid, std::exception exp) {
92 (*scopeExceptions)[scopeid] = exp;
93 }
94};
95
096
=== modified file 'tests/service-test.cc'
--- tests/service-test.cc 2015-05-20 16:27:27 +0000
+++ tests/service-test.cc 2016-11-07 16:32:23 +0000
@@ -38,6 +38,7 @@
38 virtual void SetUp() {38 virtual void SetUp() {
39 g_setenv("UBUNTU_APP_LAUNCH_USE_SESSION", "1", TRUE);39 g_setenv("UBUNTU_APP_LAUNCH_USE_SESSION", "1", TRUE);
40 g_setenv("URL_DISPATCHER_DISABLE_RECOVERABLE_ERROR", "1", TRUE);40 g_setenv("URL_DISPATCHER_DISABLE_RECOVERABLE_ERROR", "1", TRUE);
41 g_setenv("URL_DISPATCHER_DISABLE_SCOPE_CHECKING", "1", TRUE);
41 g_setenv("XDG_DATA_DIRS", XDG_DATA_DIRS, TRUE);42 g_setenv("XDG_DATA_DIRS", XDG_DATA_DIRS, TRUE);
42 g_setenv("LD_PRELOAD", MIR_MOCK_PATH, TRUE);43 g_setenv("LD_PRELOAD", MIR_MOCK_PATH, TRUE);
4344
@@ -95,6 +96,10 @@
95 }96 }
9697
97 virtual void TearDown() {98 virtual void TearDown() {
99 gchar * cmdline = g_strdup_printf("kill -TERM %d", dbus_test_process_get_pid(dispatcher));
100 g_spawn_command_line_sync(cmdline, nullptr, nullptr, nullptr, nullptr);
101 g_free(cmdline);
102
98 g_clear_object(&dispatcher);103 g_clear_object(&dispatcher);
99 g_clear_object(&mock);104 g_clear_object(&mock);
100 g_clear_object(&dashmock);105 g_clear_object(&dashmock);
@@ -123,7 +128,7 @@
123 GTimeVal time = {0, 0};128 GTimeVal time = {0, 0};
124 time.tv_sec = 5;129 time.tv_sec = 5;
125 url_db_set_file_motification_time(db, "/unity8-dash.url-dispatcher", &time);130 url_db_set_file_motification_time(db, "/unity8-dash.url-dispatcher", &time);
126 url_db_insert_url(db, "/unity8-dash.url-dispatcher", "scope", nullptr);131 url_db_insert_url(db, "/unity8-dash.url-dispatcher", "scopeish", nullptr);
127 sqlite3_close(db);132 sqlite3_close(db);
128 }133 }
129134
@@ -271,7 +276,7 @@
271 GMainLoop * main = g_main_loop_new(nullptr, FALSE);276 GMainLoop * main = g_main_loop_new(nullptr, FALSE);
272277
273 /* Send an invalid URL */278 /* Send an invalid URL */
274 url_dispatch_send("scope://foo-bar", simple_cb, main);279 url_dispatch_send("scopeish://foo-bar", simple_cb, main);
275280
276 /* Give it some time to send and reply */281 /* Give it some time to send and reply */
277 g_main_loop_run(main);282 g_main_loop_run(main);
@@ -288,7 +293,7 @@
288 calls = dbus_test_dbus_mock_object_get_method_calls(dashmock, fdoobj, "Open", &callslen, nullptr);293 calls = dbus_test_dbus_mock_object_get_method_calls(dashmock, fdoobj, "Open", &callslen, nullptr);
289294
290 EXPECT_EQ(1, callslen);295 EXPECT_EQ(1, callslen);
291 EXPECT_TRUE(g_variant_equal(calls[0].params, g_variant_new_parsed("(['scope://foo-bar'], @a{sv} {})")));296 EXPECT_TRUE(g_variant_equal(calls[0].params, g_variant_new_parsed("(['scopeish://foo-bar'], @a{sv} {})")));
292297
293 EXPECT_EQ(1, focus_count);298 EXPECT_EQ(1, focus_count);
294299
295300
=== modified file 'tests/test-config.h.in'
--- tests/test-config.h.in 2015-06-08 16:39:15 +0000
+++ tests/test-config.h.in 2016-11-07 16:32:23 +0000
@@ -11,6 +11,6 @@
11#define UPDATE_DIRECTORY_VARIED "@CMAKE_CURRENT_SOURCE_DIR@/test-urls-varied"11#define UPDATE_DIRECTORY_VARIED "@CMAKE_CURRENT_SOURCE_DIR@/test-urls-varied"
12#define UPDATE_DIRECTORY_INTENT "@CMAKE_CURRENT_SOURCE_DIR@/test-urls-intent"12#define UPDATE_DIRECTORY_INTENT "@CMAKE_CURRENT_SOURCE_DIR@/test-urls-intent"
13#define OVERLAY_TEST_DIR "@CMAKE_CURRENT_SOURCE_DIR@/overlay-dir"13#define OVERLAY_TEST_DIR "@CMAKE_CURRENT_SOURCE_DIR@/overlay-dir"
14#define EXEC_TOOL "@CMAKE_BINARY_DIR@/service/exec-tool"14#define EXEC_TOOL "@CMAKE_BINARY_DIR@/service/url-overlay/exec-tool"
15#define MIR_MOCK_PATH "@CMAKE_CURRENT_BINARY_DIR@/libmir-mock.so"15#define MIR_MOCK_PATH "@CMAKE_CURRENT_BINARY_DIR@/libmir-mock.so"
16#define CLICK_DATA_DIR "@CMAKE_CURRENT_SOURCE_DIR@/click-data"16#define CLICK_DATA_DIR "@CMAKE_CURRENT_SOURCE_DIR@/click-data"
1717
=== added directory 'tests/ual-link-farm'
=== added file 'tests/ual-link-farm/com.test.good_app1_1.2.3.desktop'
--- tests/ual-link-farm/com.test.good_app1_1.2.3.desktop 1970-01-01 00:00:00 +0000
+++ tests/ual-link-farm/com.test.good_app1_1.2.3.desktop 2016-11-07 16:32:23 +0000
@@ -0,0 +1,1 @@
1Needs to exist
02
=== added file 'tests/ual-link-farm/com.test.multiple_app-first_1.2.3.desktop'
--- tests/ual-link-farm/com.test.multiple_app-first_1.2.3.desktop 1970-01-01 00:00:00 +0000
+++ tests/ual-link-farm/com.test.multiple_app-first_1.2.3.desktop 2016-11-07 16:32:23 +0000
@@ -0,0 +1,1 @@
1Needs to exist
02
=== added directory 'tests/xdg-cache'
=== added directory 'tests/xdg-cache/libertine-container'
=== added directory 'tests/xdg-cache/libertine-container/container-id'
=== added directory 'tests/xdg-cache/libertine-container/container-id/rootfs'
=== added directory 'tests/xdg-cache/libertine-container/container-id/rootfs/usr'
=== added directory 'tests/xdg-cache/libertine-container/container-id/rootfs/usr/share'
=== added directory 'tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications'
=== added file 'tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications/org.canonical.app1.desktop'
--- tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications/org.canonical.app1.desktop 1970-01-01 00:00:00 +0000
+++ tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications/org.canonical.app1.desktop 2016-11-07 16:32:23 +0000
@@ -0,0 +1,4 @@
1[Desktop File]
2Name=App1
3Exec=app1
4Icon=app1.png
05
=== modified file 'tests/xdg-data/applications/foo-bar.desktop'
--- tests/xdg-data/applications/foo-bar.desktop 2014-09-17 22:12:21 +0000
+++ tests/xdg-data/applications/foo-bar.desktop 2016-11-07 16:32:23 +0000
@@ -2,3 +2,4 @@
2Name=Foo Bar2Name=Foo Bar
3Exec=foo-bar3Exec=foo-bar
4Type=Application4Type=Application
5Icon=foo-bar.png
56
=== added directory 'tests/xdg-data/libertine'
=== added file 'tests/xdg-data/libertine/ContainersConfig.json'
--- tests/xdg-data/libertine/ContainersConfig.json 1970-01-01 00:00:00 +0000
+++ tests/xdg-data/libertine/ContainersConfig.json 2016-11-07 16:32:23 +0000
@@ -0,0 +1,14 @@
1{
2 "containerList": [
3 {
4 "distro": "xenial",
5 "id": "container-id",
6 "installStatus": "ready",
7 "installedApps": [],
8 "multiarch": "disabled",
9 "name": "Ubuntu 'Xenial Xerus'",
10 "type": "lxc"
11 }
12 ],
13 "defaultContainer": "container-id"
14}

Subscribers

People subscribed via source and target branches