Merge lp:~osomon/webbrowser-app/geolocation-permission into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Merged at revision: 580
Proposed branch: lp:~osomon/webbrowser-app/geolocation-permission
Merge into: lp:webbrowser-app
Diff against target: 298 lines (+128/-31)
7 files modified
po/webbrowser-app.pot (+21/-17)
src/app/GeolocationPermissionRequest.qml (+50/-0)
src/app/WebViewImpl.qml (+8/-13)
src/app/webcontainer/WebViewImplWebkit.qml (+1/-1)
tests/autopilot/webbrowser_app/emulators/browser.py (+3/-0)
tests/autopilot/webbrowser_app/tests/http_server.py (+6/-0)
tests/autopilot/webbrowser_app/tests/test_geolocation.py (+39/-0)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/geolocation-permission
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+218758@code.launchpad.net

Commit message

Re-enable the geolocation permission request dialog, now that it is implemented in oxide.
Fix it in the webkit-based webapp container.

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

Note: this requires a recent version of oxide (≥ bzr revision 548), not released yet as of now.

531. By Olivier Tilloy

Add autopilot tests.

532. By Olivier Tilloy

Updated translation template.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
533. By Olivier Tilloy

Merge the latest changes from trunk and resolve a conflict.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/webbrowser-app.pot'
2--- po/webbrowser-app.pot 2014-05-27 09:37:45 +0000
3+++ po/webbrowser-app.pot 2014-06-18 13:57:31 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: webbrowser-app\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2014-05-06 16:25+0100\n"
9+"POT-Creation-Date: 2014-06-18 10:33+0200\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -89,7 +89,7 @@
14 msgid "Forward"
15 msgstr ""
16
17-#: src/app/Chrome.qml:127 src/app/webbrowser/ActivityView.qml:36
18+#: src/app/Chrome.qml:126 src/app/webbrowser/ActivityView.qml:36
19 msgid "Activity"
20 msgstr ""
21
22@@ -120,14 +120,22 @@
23 msgid "Please choose a file"
24 msgstr ""
25
26+#: src/app/GeolocationPermissionRequest.qml:28
27 #: src/app/PermissionRequest.qml:28
28 msgid "Permission Request"
29 msgstr ""
30
31+#: src/app/GeolocationPermissionRequest.qml:29
32+#: src/app/webcontainer/WebViewImplWebkit.qml:69
33+msgid "This page wants to know your device’s location."
34+msgstr ""
35+
36+#: src/app/GeolocationPermissionRequest.qml:33
37 #: src/app/PermissionRequest.qml:31
38 msgid "Deny"
39 msgstr ""
40
41+#: src/app/GeolocationPermissionRequest.qml:43
42 #: src/app/PermissionRequest.qml:40
43 msgid "Allow"
44 msgstr ""
45@@ -246,39 +254,39 @@
46 msgid "Currently viewing (%1)"
47 msgstr ""
48
49-#: src/app/webbrowser/TabsList.qml:68
50+#: src/app/webbrowser/TabsList.qml:69
51 msgid "+"
52 msgstr ""
53
54-#: src/app/webbrowser/TimelineView.qml:84
55+#: src/app/webbrowser/TimelineView.qml:87
56 msgid "Today"
57 msgstr ""
58
59-#: src/app/webbrowser/TimelineView.qml:86
60+#: src/app/webbrowser/TimelineView.qml:89
61 msgid "Yesterday"
62 msgstr ""
63
64-#: src/app/webbrowser/TimelineView.qml:88
65+#: src/app/webbrowser/TimelineView.qml:91
66 msgid "Last 7 Days"
67 msgstr ""
68
69-#: src/app/webbrowser/TimelineView.qml:90
70+#: src/app/webbrowser/TimelineView.qml:93
71 msgid "This Month"
72 msgstr ""
73
74-#: src/app/webbrowser/TimelineView.qml:92
75+#: src/app/webbrowser/TimelineView.qml:95
76 msgid "This Year"
77 msgstr ""
78
79-#: src/app/webbrowser/TimelineView.qml:94
80+#: src/app/webbrowser/TimelineView.qml:97
81 msgid "Older"
82 msgstr ""
83
84-#: src/app/webbrowser/TimelineView.qml:277
85+#: src/app/webbrowser/TimelineView.qml:287
86 msgid "(local files)"
87 msgstr ""
88
89-#: src/app/webbrowser/TimelineView.qml:279
90+#: src/app/webbrowser/TimelineView.qml:289
91 msgid "(other)"
92 msgstr ""
93
94@@ -296,13 +304,13 @@
95
96 #. TRANSLATORS: %1 refers to the current page’s title
97 #: src/app/webbrowser/webbrowser-app.qml:35
98-#: src/app/webcontainer/webapp-container.qml:47
99+#: src/app/webcontainer/webapp-container.qml:54
100 #, qt-format
101 msgid "%1 - Ubuntu Web Browser"
102 msgstr ""
103
104 #: src/app/webbrowser/webbrowser-app.qml:37
105-#: src/app/webcontainer/webapp-container.qml:49
106+#: src/app/webcontainer/webapp-container.qml:56
107 msgid "Ubuntu Web Browser"
108 msgstr ""
109
110@@ -321,7 +329,3 @@
111 #: src/app/webcontainer/AccountsView.qml:38
112 msgid "Select an account"
113 msgstr ""
114-
115-#: src/app/webcontainer/WebViewImplWebkit.qml:63
116-msgid "This page wants to know your device’s location."
117-msgstr ""
118
119=== added file 'src/app/GeolocationPermissionRequest.qml'
120--- src/app/GeolocationPermissionRequest.qml 1970-01-01 00:00:00 +0000
121+++ src/app/GeolocationPermissionRequest.qml 2014-06-18 13:57:31 +0000
122@@ -0,0 +1,50 @@
123+/*
124+ * Copyright 2014 Canonical Ltd.
125+ *
126+ * This file is part of webbrowser-app.
127+ *
128+ * webbrowser-app is free software; you can redistribute it and/or modify
129+ * it under the terms of the GNU General Public License as published by
130+ * the Free Software Foundation; version 3.
131+ *
132+ * webbrowser-app is distributed in the hope that it will be useful,
133+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
134+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
135+ * GNU General Public License for more details.
136+ *
137+ * You should have received a copy of the GNU General Public License
138+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
139+ */
140+
141+import QtQuick 2.0
142+import Ubuntu.Components 0.1
143+import Ubuntu.Components.Popups 0.1
144+
145+Dialog {
146+ id: dialog
147+
148+ property QtObject request: null
149+
150+ title: i18n.tr("Permission Request")
151+ text: i18n.tr("This page wants to know your device’s location.")
152+
153+ Button {
154+ objectName: "deny"
155+ text: i18n.tr("Deny")
156+ color: UbuntuColors.warmGrey
157+ onClicked: {
158+ request.deny()
159+ PopupUtils.close(dialog)
160+ }
161+ }
162+
163+ Button {
164+ objectName: "allow"
165+ text: i18n.tr("Allow")
166+ color: UbuntuColors.orange
167+ onClicked: {
168+ request.accept()
169+ PopupUtils.close(dialog)
170+ }
171+ }
172+}
173
174=== modified file 'src/app/WebViewImpl.qml'
175--- src/app/WebViewImpl.qml 2014-05-29 15:30:11 +0000
176+++ src/app/WebViewImpl.qml 2014-06-18 13:57:31 +0000
177@@ -17,9 +17,9 @@
178 */
179
180 import QtQuick 2.0
181-//import Ubuntu.Components 0.1
182+import Ubuntu.Components 0.1
183+import Ubuntu.Components.Popups 0.1
184 import Ubuntu.Web 0.2
185-//import Ubuntu.Components.Popups 0.1
186 //import "actions" as Actions
187
188 WebView {
189@@ -48,18 +48,13 @@
190 }
191 }*/
192
193- /*experimental.onPermissionRequested: {
194- if (permission.type === PermissionRequest.Geolocation) {
195- if (webview.toolbar) {
196- webview.toolbar.close()
197- }
198- var text = i18n.tr("This page wants to know your device’s location.")
199- PopupUtils.open(Qt.resolvedUrl("PermissionRequest.qml"),
200- webview.currentWebview,
201- {"permission": permission, "text": text})
202+ onGeolocationPermissionRequested: {
203+ if (webview.toolbar) {
204+ webview.toolbar.close()
205 }
206- // TODO: handle other types of permission requests
207+ PopupUtils.open(Qt.resolvedUrl("GeolocationPermissionRequest.qml"),
208+ webview.currentWebview, {"request": request})
209 // TODO: we might want to store the answer to avoid requesting
210 // the permission everytime the user visits this site.
211- }*/
212+ }
213 }
214
215=== modified file 'src/app/webcontainer/WebViewImplWebkit.qml'
216--- src/app/webcontainer/WebViewImplWebkit.qml 2014-06-09 19:47:56 +0000
217+++ src/app/webcontainer/WebViewImplWebkit.qml 2014-06-18 13:57:31 +0000
218@@ -67,7 +67,7 @@
219 webview.toolbar.close()
220 }
221 var text = i18n.tr("This page wants to know your device’s location.")
222- PopupUtils.open(Qt.resolvedUrl("PermissionRequest.qml"),
223+ PopupUtils.open(Qt.resolvedUrl("../PermissionRequest.qml"),
224 webview.currentWebview,
225 {"permission": permission, "text": text})
226 }
227
228=== modified file 'tests/autopilot/webbrowser_app/emulators/browser.py'
229--- tests/autopilot/webbrowser_app/emulators/browser.py 2014-06-11 11:12:14 +0000
230+++ tests/autopilot/webbrowser_app/emulators/browser.py 2014-06-18 13:57:31 +0000
231@@ -103,3 +103,6 @@
232 tabs = view.select_many("PageDelegate", objectName="openTabDelegate")
233 tabs.sort(key=lambda tab: tab.x)
234 return tabs
235+
236+ def get_geolocation_dialog(self):
237+ return self.wait_select_single("GeolocationPermissionRequest")
238
239=== modified file 'tests/autopilot/webbrowser_app/tests/http_server.py'
240--- tests/autopilot/webbrowser_app/tests/http_server.py 2014-06-11 11:12:14 +0000
241+++ tests/autopilot/webbrowser_app/tests/http_server.py 2014-06-18 13:57:31 +0000
242@@ -115,6 +115,12 @@
243 html += '} else { document.webkitExitFullscreen(); } });'
244 html += '</script></html>'
245 self.send_html(html)
246+ elif self.path == "/geolocation":
247+ self.send_response(200)
248+ html = '<html><body><script>'
249+ html += 'navigator.geolocation.getCurrentPosition('
250+ html += 'function r(p) {});</script></body></html>'
251+ self.send_html(html)
252 else:
253 self.send_error(404)
254
255
256=== added file 'tests/autopilot/webbrowser_app/tests/test_geolocation.py'
257--- tests/autopilot/webbrowser_app/tests/test_geolocation.py 1970-01-01 00:00:00 +0000
258+++ tests/autopilot/webbrowser_app/tests/test_geolocation.py 2014-06-18 13:57:31 +0000
259@@ -0,0 +1,39 @@
260+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
261+#
262+# Copyright 2014 Canonical
263+#
264+# This program is free software: you can redistribute it and/or modify it
265+# under the terms of the GNU General Public License version 3, as published
266+# by the Free Software Foundation.
267+#
268+# This program is distributed in the hope that it will be useful,
269+# but WITHOUT ANY WARRANTY; without even the implied warranty of
270+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
271+# GNU General Public License for more details.
272+#
273+# You should have received a copy of the GNU General Public License
274+# along with this program. If not, see <http://www.gnu.org/licenses/>.
275+
276+from webbrowser_app.tests import StartOpenRemotePageTestCaseBase
277+
278+
279+class TestGeolocation(StartOpenRemotePageTestCaseBase):
280+
281+ def setUp(self):
282+ super(TestGeolocation, self).setUp()
283+ url = self.base_url + "/geolocation"
284+ self.go_to_url(url)
285+ self.assert_page_eventually_loaded(url)
286+ self.dialog = self.main_window.get_geolocation_dialog()
287+
288+ def tearDown(self):
289+ self.dialog.wait_until_destroyed()
290+ super(TestGeolocation, self).tearDown()
291+
292+ def test_geolocation_deny(self):
293+ button = self.dialog.select_single("Button", objectName="deny")
294+ self.pointing_device.click_object(button)
295+
296+ def test_geolocation_accept(self):
297+ button = self.dialog.select_single("Button", objectName="allow")
298+ self.pointing_device.click_object(button)

Subscribers

People subscribed via source and target branches

to status/vote changes: