Merge lp:~zaspire/oxide/web-notifications_v2 into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Maxim Ermilov
Status: Superseded
Proposed branch: lp:~zaspire/oxide/web-notifications_v2
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Diff against target: 948 lines (+664/-2)
24 files modified
build/system.gyp (+19/-0)
qt/core/browser/oxide_qt_browser_platform_integration.cc (+5/-0)
qt/core/browser/oxide_qt_browser_platform_integration.h (+1/-0)
qt/core/browser/oxide_qt_web_view.cc (+10/-0)
qt/core/browser/oxide_qt_web_view.h (+2/-0)
qt/core/glue/oxide_qt_web_view_proxy_client.h (+3/-0)
qt/qmlplugin/oxide_qml_plugin.cc (+1/-0)
qt/quick/api/oxideqquickwebview.cc (+23/-0)
qt/quick/api/oxideqquickwebview_p.h (+1/-0)
qt/quick/api/oxideqquickwebview_p_p.h (+3/-0)
qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.html (+21/-0)
qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.js (+6/-0)
qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.qml (+198/-0)
shared/browser/oxide_browser_platform_integration.h (+2/-0)
shared/browser/oxide_content_browser_client.cc (+9/-1)
shared/browser/oxide_content_browser_client.h (+1/-0)
shared/browser/oxide_platform_notification_service.cc (+265/-0)
shared/browser/oxide_platform_notification_service.h (+77/-0)
shared/browser/oxide_web_view.cc (+1/-1)
shared/browser/permissions/oxide_permission_manager.cc (+5/-0)
shared/browser/permissions/oxide_permission_request_dispatcher.cc (+3/-0)
shared/browser/permissions/oxide_permission_request_dispatcher_client.h (+3/-0)
shared/browser/permissions/oxide_temporary_saved_permission_context.h (+1/-0)
shared/shared.gyp (+4/-0)
To merge this branch: bzr merge lp:~zaspire/oxide/web-notifications_v2
Reviewer Review Type Date Requested Status
Chris Coulson Needs Fixing
Review via email: mp+255392@code.launchpad.net

This proposal has been superseded by a proposal from 2015-06-19.

Description of the change

depend on bug 1428754 (to implement session persistence)

To post a comment you must log in.
1027. By Olivier Tilloy

LP: #1441777

1028. By Chris Coulson

Fix out-of-bounds read in CompositorOutputSurfaceGL

1029. By Chris Coulson

Clean up the interfaces in qt/core/glue. Hopefully this will make it more obvious where to place new code (ie, only interfaces in qt/core/glue now)

1030. By Chris Coulson

Bump Chromium rev to 43.0.2357.10

1031. By Chris Coulson

Set the minimum page scale to 0.25 on mobile (the default is 1, which is fine for desktop)

1032. By Chris Coulson

Fix crash when accessing ScriptMessage.frame if the frame has disappeared

1033. By Chris Coulson

Stack allocate the objects passed to WebContextDelegateWorker

1034. By Chris Coulson

Improve network callback tests

1035. By Chris Coulson

Use a ResourceThrottle for intercepting redirects

1036. By Chris Coulson

Added EGLFS QPA support

1037. By Olivier Tilloy

Use the simple backend for the network cache.

1038. By Chris Coulson

Bump Chromium rev to 43.0.2357.18

1039. By Chris Coulson

Add LocationBarController.show(), LocationBarController.hide() and LocationBarController.animated

1040. By Chris Coulson

Bump Chromium rev to 44.0.2369.0 and Qt version to 1.8

1041. By Chris Coulson

Don't allow QObjects to be passed to WebContextDelegateWorker

1042. By Alexandre Abreu

tweak pak deps

1043. By Alexandre Abreu

update the blink resource name

1044. By Alexandre Abreu

fix build & mediahub link

1045. By Chris Coulson

GPU canvas + raster is enabled on Krillin in Chrome now, so we don't need a patch

1046. By Chris Coulson

Fix a parse error in the GPU blacklist

1047. By Chris Coulson

Make chrome://tracing/ work

1048. By Chris Coulson

Tidy up the navigator.userAgent override mechanism - an empty string is no override. The extra bool is redundant

1049. By Chris Coulson

Fix a test failure

1050. By Chris Coulson

Fix handling of JS values wrapped in QVariants with Qt 5.4

1051. By Chris Coulson

Add OxideQPermissionRequest::origin (effectively undeprecating OxideQGeolocationPermissionRequest::origin), given that recent changes in Chromium mean we get an origin in most cases. Let's use origin for all request types

1052. By Chris Coulson

Bump Chromium rev to 44.0.2376.0

1053. By Chris Coulson

Replace remaining uses of USE_NSS with USE_NSS_CERTS

1054. By Chris Coulson

The webview compositor shouldn't be unthrottled

1055. By Chris Coulson

Disable one-copy rasterizer on the phone - it's currently disabled on Android anyway

1056. By Chris Coulson

Fix a memory corruption when the visibilty of a webview is changed

1057. By Chris Coulson

Don't crash when the frame tree is torn down during a process swap

1058. By Olivier Tilloy

Fix a crash when a popup menu is dismissed twice (by calling accept() and then cancel() on it).

1059. By Olivier Tilloy

Fix a crash when a JS dialog is dismissed twice (by calling accept() and then reject() on it).

1060. By Chris Coulson

Process all descendents in WebView::FrameDeleted, rather than just the immediate children

1061. By Chris Coulson

Don't disable share-group usage if virtualized GL contexts are enabled on desktop. This sucks, as we can't really know why virtualized contexts are enabled - if it's due to performance issues, then using share-groups is ok (and better than the alternative - software compositing). If it's because of driver bugs / crashes, then we're screwed. We need to do this now because Chromium cananry enables virtualized contexts globally on desktop Linux

1062. By Chris Coulson

Don't run unload handlers on webviews that are script closed. Also, beef up the tests to catch this and work a bit more reliably

1063. By Chris Coulson

Bump Chromium rev to 44.0.2391.0

1064. By Olivier Tilloy

Add a WebView::webProcessStatus property to notify embedders when the renderer process crashed or was killed.

1065. By Chris Coulson

Add WebView.mediaAccessPermissionRequested API

1066. By Chris Coulson

Make comments more accurate

1067. By Chris Coulson

FrameTreeNode::frame_tree_node_id is an int rather than int64_t

1068. By Chris Coulson

Remove a workaround for the old browser headerbar, used when scrolling the focused editable node in to view

1069. By Alexandre Abreu

Prevent a shutdown deadlock if the render process is killed whilst waiting for the close ACK

1070. By Chris Coulson

When deleting a WebContext, ensure that the service worker context is shut down to release references on the RenderProcessHost

1071. By Chris Coulson

Don't leak BrowserContext

1072. By Chris Coulson

Fix test failure in tst_OxideGlobal - it seems that the displayName doesn't have extra characters on some machines

1073. By Chris Coulson

Ensure we correctly shut down the OTR BrowserContext

1074. By Chris Coulson

Move gesture detection to RWHV, keep MotionEvent tracking on WebView (so that we keep it in sync with incoming touch events), and reset the gesture pipeline when navigating to a new page

1075. By Chris Coulson

Refactor ownership model of BrowserContext, and discard the OTR BrowserContext as soon as all incognito webviews using it have been deleted

1076. By Chris Coulson

Actually fix tst_OxideGlobal.qml

1077. By Chris Coulson

Don't create multiple WebContexts pointing at the same path in tst_UnloadHandlers.qml

1078. By Riccardo Padovani

Add LoadEvent.httpStatusCode property

1079. By Chris Coulson

Bump Chromium rev to 44.0.2398.0

1080. By Chris Coulson

Revert a couple of changes that shouldn't have landed

1081. By Chris Coulson

Initialize handle_ for all Proxy objects

1082. By Chris Coulson

Flush profile data when the application goes in to the background

1083. By Chris Coulson

Generate a synthetic Suspended state on the phone

1084. By Chris Coulson

Remove spurious printf

1085. By Chris Coulson

Bump Chromium rev to 44.0.2403.0

1086. By Chris Coulson

Bump Chromium rev to 44.0.2403.4

1087. By Chris Coulson

Add a client interface for WebView, and implement that in qt/. This is the start of an attempt to split functionality out of WebView in to smaller classes

1088. By Ugo Riboni

Add WebView.findController API

1089. By Chris Coulson

Revert r1041 for causing LP: #1455371

1090. By Chris Coulson

Bump Chromium rev to 44.0.2403.9

Revision history for this message
Maxim Ermilov (zaspire) wrote :

this work is required for PushNotifications.

1091. By Chris Coulson

Remove the implementation of MessageLoop::TaskObserver from MessagePump - this fails in canary because there is no MessageLoop when MessagePump is constructed. Also remove the MessageLoopForUI class, which was always a bit of a mess

1092. By Chris Coulson

DCHECK that the PowerSaveBlocker factory exists, given that it's set unconditionally in BrowserMainParts. It should never be null

1093. By Alexandre Abreu

Add clipboard support

1094. By Olivier Tilloy

Support for context menus.

1095. By Chris Coulson

Bump qt version to 1.9

1096. By Chris Coulson

Fix issues with mouse event handling, so that text selection works correctly

1097. By Chris Coulson

Move event / screen utils bits from common/ to browser/, where they belong

1098. By Chris Coulson

Kill the hidden input Item inside WebView

1099. By Chris Coulson

Stub out RenderViewHostDelegateView::StartDragging to cancel all drag starts, else the renderer hangs indefinitely

1100. By Chris Coulson

Bump Chromium rev to 45.0.2415.0

1101. By Chris Coulson

Clean up MessagePump a bit:
- Refactor code that runs a task in to a separate function
- Keep track of when we've posted a work event to avoid posting lots of them
- When scheduling missed delayed work, defer to ScheduleWork so that we don't post another task if work is already scheduled

1102. By Chris Coulson

Fix arm build regression

1103. By Chris Coulson

Enable run-time NEON detection in components that support it (eg, skia)

1104. By Chris Coulson

Add back to the task depth checking that was removed in an earlier commit when it broke due to changes to MessageLoop initialization. I think it's reasonably important to keep this check as the consequences of an application stopping the MessagePump whilst processing a task aren't good

1105. By Chris Coulson

r1101 introduced a threading bug to MessagePump::ScheduleWork, which can be called on any thread

1106. By Alexandre Abreu

Expose user agent as part of downloadRequest

1107. By Alexandre Abreu

Remove deprecated patch

1108. By Alexandre Abreu

Guess mimetype based on suggested filename when available

1109. By Alexandre Abreu

remove EOLs at end of series file

1110. By Alexandre Abreu

Add forgotten download manager delegate file

1111. By Alexandre Abreu

Add forgotten download manager delegate file

1112. By Alexandre Abreu

Fix build issue w/ string16 not declared

1113. By Alexandre Abreu

download requested UA: add forgotten file (test related)

1114. By Olivier Tilloy

Add missing unit tests now that clipboard support has landed.

1115. By Chris Coulson

Land some refactoring of permissions, which starts to decouple it from WebView in to separate classes

1116. By Chris Coulson

Refinements to MediaAccessPermissionRequest:
- Remove the per-request capture device override
- Add WebContext.default{Audio,Video}CaptureDeviceId, which will be used for all media capture.
Note, the tests for WebContext.defaultVideoCaptureDeviceId are not great - we don't have a way yet to verify that it actually causes the correct device to be used. WebContext.defaultAudioCaptureDeviceId is not yet tested at all, because we have no way to mock audio devices right now like we do with video devices

1117. By Chris Coulson

Bump Chromium rev to 45.0.2421.0

1118. By Chris Coulson

base::FilePath::Extension() returns the extension with the preceding period, but net::GetMimeTypeFromExtension assumes that there is no period, causing it to fall back to a platform lookup which returns the wrong mime-type and results in test_WebView_downloadAnchorRequest failing

1119. By Chris Coulson

Route media permissions through MediaCaptureDeviceDispatcher

1120. By Chris Coulson

Change Oxide.available{Audio,Video}CaptureDevices() in to a notifiable property

1121. By Chris Coulson

Fix failing test

1122. By Chris Coulson

Depend on keyed_service_core to fix a link failure in component builds

1123. By Chris Coulson

Fix up some additional dependencies

1124. By Chris Coulson

Fix a startup ordering issue when creating WebContext

1125. By Chris Coulson

Persist geolocation permission request decisions for the life of WebContext

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Ok, I've reviewed this again.

There's also quite a few cases missing in the tests - please take a look at the geolocation permission tests.

Also, we should figure out a way to test the actual libnotify integration (I'm not sure of the best way to do that, but it shouldn't be too difficult to mock).

review: Needs Fixing
1126. By Chris Coulson

Bump Chromium rev to 45.0.2427.7

1127. By Chris Coulson

Persist media device permissions for the life of WebContext

1128. By Chris Coulson

Make ContentBrowserClient / ContentRendererClient memebers of ContentMainDelegate like ContentClient already is

1129. By Chris Coulson

Pass the application locale to ui::ResourceBundle::InitSharedInstanceWithLocale. Because we don't build with glib support, it's unable to detect the system locale and depends on a preferred one being passed

1130. By Chris Coulson

Convert UserScriptMaster in to a KeyedService

1131. By Chris Coulson

Create a single TestWebContext in tst_WebView_save_restore_state.qml

1132. By Chris Coulson

Don't allow QObjects to be passed to WebContextDelegateWorker

1133. By Maxim Ermilov

add Web Notifications support

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'build/system.gyp'
--- build/system.gyp 2015-01-21 23:40:11 +0000
+++ build/system.gyp 2015-06-19 15:51:41 +0000
@@ -18,6 +18,25 @@
18 'variables': {18 'variables': {
19 'pkg_config': 'pkg-config'19 'pkg_config': 'pkg-config'
20 },20 },
21 'targets': [
22 {
23 'target_name': 'libnotify',
24 'type': 'none',
25 'direct_dependent_settings': {
26 'cflags_cc': [
27 '<!@(<(pkg_config) --cflags libnotify)'
28 ]
29 },
30 'link_settings': {
31 'ldflags': [
32 '<!@(<(pkg_config) --libs-only-L --libs-only-other libnotify)',
33 ],
34 'libraries': [
35 '<!@(<(pkg_config) --libs-only-l libnotify)',
36 ],
37 },
38 },
39 ],
21 'conditions': [40 'conditions': [
22 ['target_arch=="arm"', {41 ['target_arch=="arm"', {
23 'targets': [42 'targets': [
2443
=== modified file 'qt/core/browser/oxide_qt_browser_platform_integration.cc'
--- qt/core/browser/oxide_qt_browser_platform_integration.cc 2015-06-12 07:39:38 +0000
+++ qt/core/browser/oxide_qt_browser_platform_integration.cc 2015-06-19 15:51:41 +0000
@@ -161,6 +161,11 @@
161 return state_;161 return state_;
162}162}
163163
164std::string
165BrowserPlatformIntegration::GetAppName() {
166 return QCoreApplication::applicationName().toStdString();
167}
168
164bool BrowserPlatformIntegration::eventFilter(QObject* watched, QEvent* event) {169bool BrowserPlatformIntegration::eventFilter(QObject* watched, QEvent* event) {
165 if (event->type() == QEvent::ApplicationActivate ||170 if (event->type() == QEvent::ApplicationActivate ||
166 event->type() == QEvent::ApplicationDeactivate) {171 event->type() == QEvent::ApplicationDeactivate) {
167172
=== modified file 'qt/core/browser/oxide_qt_browser_platform_integration.h'
--- qt/core/browser/oxide_qt_browser_platform_integration.h 2015-06-12 07:39:38 +0000
+++ qt/core/browser/oxide_qt_browser_platform_integration.h 2015-06-19 15:51:41 +0000
@@ -57,6 +57,7 @@
57 void BrowserThreadInit(content::BrowserThread::ID id) override;57 void BrowserThreadInit(content::BrowserThread::ID id) override;
58 content::LocationProvider* CreateLocationProvider() override;58 content::LocationProvider* CreateLocationProvider() override;
59 ApplicationState GetApplicationState() override;59 ApplicationState GetApplicationState() override;
60 std::string GetAppName() override;
60 ui::ClipboardOxideFactory GetClipboardOxideFactory() override;61 ui::ClipboardOxideFactory GetClipboardOxideFactory() override;
6162
62 // QObject implementation63 // QObject implementation
6364
=== modified file 'qt/core/browser/oxide_qt_web_view.cc'
--- qt/core/browser/oxide_qt_web_view.cc 2015-06-04 17:11:01 +0000
+++ qt/core/browser/oxide_qt_web_view.cc 2015-06-19 15:51:41 +0000
@@ -1011,6 +1011,16 @@
1011 client_->RequestGeolocationPermission(req.release());1011 client_->RequestGeolocationPermission(req.release());
1012}1012}
10131013
1014void WebView::RequestNotificationPermission(
1015 scoped_ptr<oxide::SimplePermissionRequest> request) {
1016 scoped_ptr<OxideQSimplePermissionRequest> req(
1017 OxideQSimplePermissionRequestPrivate::Create(
1018 request.Pass()));
1019
1020 // The embedder takes ownership of this
1021 client_->RequestNotificationPermission(req.release());
1022}
1023
1014void WebView::RequestMediaAccessPermission(1024void WebView::RequestMediaAccessPermission(
1015 scoped_ptr<oxide::MediaAccessPermissionRequest> request) {1025 scoped_ptr<oxide::MediaAccessPermissionRequest> request) {
1016 scoped_ptr<OxideQMediaAccessPermissionRequest> req(1026 scoped_ptr<OxideQMediaAccessPermissionRequest> req(
10171027
=== modified file 'qt/core/browser/oxide_qt_web_view.h'
--- qt/core/browser/oxide_qt_web_view.h 2015-06-04 13:21:49 +0000
+++ qt/core/browser/oxide_qt_web_view.h 2015-06-19 15:51:41 +0000
@@ -177,6 +177,8 @@
177 // oxide::PermissionRequestDispatcherClient implementation177 // oxide::PermissionRequestDispatcherClient implementation
178 void RequestGeolocationPermission(178 void RequestGeolocationPermission(
179 scoped_ptr<oxide::SimplePermissionRequest> request) override;179 scoped_ptr<oxide::SimplePermissionRequest> request) override;
180 void RequestNotificationPermission(
181 scoped_ptr<oxide::SimplePermissionRequest> request) override;
180 void RequestMediaAccessPermission(182 void RequestMediaAccessPermission(
181 scoped_ptr<oxide::MediaAccessPermissionRequest> request) override;183 scoped_ptr<oxide::MediaAccessPermissionRequest> request) override;
182184
183185
=== modified file 'qt/core/glue/oxide_qt_web_view_proxy_client.h'
--- qt/core/glue/oxide_qt_web_view_proxy_client.h 2015-05-27 20:56:59 +0000
+++ qt/core/glue/oxide_qt_web_view_proxy_client.h 2015-06-19 15:51:41 +0000
@@ -32,6 +32,7 @@
32class OxideQMediaAccessPermissionRequest;32class OxideQMediaAccessPermissionRequest;
33class OxideQNavigationRequest;33class OxideQNavigationRequest;
34class OxideQNewViewRequest;34class OxideQNewViewRequest;
35class OxideQSimplePermissionRequest;
3536
36QT_BEGIN_NAMESPACE37QT_BEGIN_NAMESPACE
37class QCursor;38class QCursor;
@@ -128,6 +129,8 @@
128 OxideQGeolocationPermissionRequest* request) = 0;129 OxideQGeolocationPermissionRequest* request) = 0;
129 virtual void RequestMediaAccessPermission(130 virtual void RequestMediaAccessPermission(
130 OxideQMediaAccessPermissionRequest* request) = 0;131 OxideQMediaAccessPermissionRequest* request) = 0;
132 virtual void RequestNotificationPermission(
133 OxideQSimplePermissionRequest* request) = 0;
131134
132 virtual void HandleUnhandledKeyboardEvent(QKeyEvent* event) = 0;135 virtual void HandleUnhandledKeyboardEvent(QKeyEvent* event) = 0;
133136
134137
=== modified file 'qt/qmlplugin/oxide_qml_plugin.cc'
--- qt/qmlplugin/oxide_qml_plugin.cc 2015-06-05 18:43:21 +0000
+++ qt/qmlplugin/oxide_qml_plugin.cc 2015-06-19 15:51:41 +0000
@@ -134,6 +134,7 @@
134 qmlRegisterUncreatableType<OxideQLoadEvent, 2>(uri, 1, 8, "LoadEvent",134 qmlRegisterUncreatableType<OxideQLoadEvent, 2>(uri, 1, 8, "LoadEvent",
135 "LoadEvent is delivered by WebView.loadEvent");135 "LoadEvent is delivered by WebView.loadEvent");
136 qmlRegisterType<OxideQQuickWebView, 4>(uri, 1, 8, "WebView");136 qmlRegisterType<OxideQQuickWebView, 4>(uri, 1, 8, "WebView");
137 qmlRegisterType<OxideQQuickWebView, 5>(uri, 1, 8, "WebView");
137138
138 qmlRegisterType<OxideQQuickWebContext, 3>(uri, 1, 9, "WebContext");139 qmlRegisterType<OxideQQuickWebContext, 3>(uri, 1, 9, "WebContext");
139 }140 }
140141
=== modified file 'qt/quick/api/oxideqquickwebview.cc'
--- qt/quick/api/oxideqquickwebview.cc 2015-05-28 23:51:39 +0000
+++ qt/quick/api/oxideqquickwebview.cc 2015-06-19 15:51:41 +0000
@@ -461,6 +461,29 @@
461461
462}462}
463463
464void OxideQQuickWebViewPrivate::RequestNotificationPermission(
465 OxideQSimplePermissionRequest* request) {
466 Q_Q(OxideQQuickWebView);
467
468 QQmlEngine* engine = qmlEngine(q);
469 if (!engine) {
470 delete request;
471 return;
472 }
473
474 {
475 QJSValue val = engine->newQObject(request);
476 if (!val.isQObject()) {
477 delete request;
478 return;
479 }
480
481 emit q->notificationPermissionRequested(val);
482 }
483
484 engine->collectGarbage();
485}
486
464void OxideQQuickWebViewPrivate::HandleUnhandledKeyboardEvent(487void OxideQQuickWebViewPrivate::HandleUnhandledKeyboardEvent(
465 QKeyEvent* event) {488 QKeyEvent* event) {
466 Q_Q(OxideQQuickWebView);489 Q_Q(OxideQQuickWebView);
467490
=== modified file 'qt/quick/api/oxideqquickwebview_p.h'
--- qt/quick/api/oxideqquickwebview_p.h 2015-05-28 23:51:39 +0000
+++ qt/quick/api/oxideqquickwebview_p.h 2015-06-19 15:51:41 +0000
@@ -345,6 +345,7 @@
345 void navigationRequested(OxideQNavigationRequest* request);345 void navigationRequested(OxideQNavigationRequest* request);
346 void newViewRequested(OxideQNewViewRequest* request);346 void newViewRequested(OxideQNewViewRequest* request);
347 void geolocationPermissionRequested(const QJSValue& request);347 void geolocationPermissionRequested(const QJSValue& request);
348 Q_REVISION(5) void notificationPermissionRequested(const QJSValue& request);
348 Q_REVISION(4) void mediaAccessPermissionRequested(const QJSValue& request);349 Q_REVISION(4) void mediaAccessPermissionRequested(const QJSValue& request);
349 void javaScriptConsoleMessage(LogMessageSeverityLevel level,350 void javaScriptConsoleMessage(LogMessageSeverityLevel level,
350 const QString& message,351 const QString& message,
351352
=== modified file 'qt/quick/api/oxideqquickwebview_p_p.h'
--- qt/quick/api/oxideqquickwebview_p_p.h 2015-05-28 23:51:39 +0000
+++ qt/quick/api/oxideqquickwebview_p_p.h 2015-06-19 15:51:41 +0000
@@ -128,6 +128,9 @@
128 OxideQGeolocationPermissionRequest* request) override;128 OxideQGeolocationPermissionRequest* request) override;
129 void RequestMediaAccessPermission(129 void RequestMediaAccessPermission(
130 OxideQMediaAccessPermissionRequest* request) override;130 OxideQMediaAccessPermissionRequest* request) override;
131 void RequestNotificationPermission(
132 OxideQSimplePermissionRequest* request) override;
133
131 void HandleUnhandledKeyboardEvent(QKeyEvent *event) override;134 void HandleUnhandledKeyboardEvent(QKeyEvent *event) override;
132 void FrameMetadataUpdated(135 void FrameMetadataUpdated(
133 oxide::qt::FrameMetadataChangeFlags flags) override;136 oxide::qt::FrameMetadataChangeFlags flags) override;
134137
=== added file 'qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.html'
--- qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.html 1970-01-01 00:00:00 +0000
+++ qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.html 2015-06-19 15:51:41 +0000
@@ -0,0 +1,21 @@
1<html>
2<body>
3</body>
4<script>
5
6var vgaConstraints = {video: true, audio: true};
7
8function invoke() {
9 Notification.requestPermission(function(permission){
10 if(permission == 'granted'){
11 var e = new CustomEvent("result", { bubbles: true, detail: { status: 0 } });
12 document.documentElement.dispatchEvent(e);
13 } else {
14 var e = new CustomEvent("result", { bubbles: true, detail: { status: 1 } });
15 document.documentElement.dispatchEvent(e);
16 }
17 });
18}
19setTimeout(invoke, 400);
20</script>
21</html>
022
=== added file 'qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.js'
--- qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.js 1970-01-01 00:00:00 +0000
+++ qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.js 2015-06-19 15:51:41 +0000
@@ -0,0 +1,6 @@
1// ==UserScript==
2// @run-at document-start
3// ==/UserScript==
4document.addEventListener("result", function(event) {
5 oxide.sendMessage("TEST-RESPONSE", { status: event.detail.status });
6});
07
=== added file 'qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.qml'
--- qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.qml 1970-01-01 00:00:00 +0000
+++ qt/tests/qmltests/api/tst_WebNotificationPermissionRequest.qml 2015-06-19 15:51:41 +0000
@@ -0,0 +1,198 @@
1import QtQuick 2.0
2import QtTest 1.0
3import com.canonical.Oxide 1.8
4import com.canonical.Oxide.Testing 1.0
5
6Item {
7 width: 200
8 height: 200
9
10 SignalSpy {
11 id: spy
12 signalName: "notificationPermissionRequested"
13 }
14
15 Component {
16 id: userScriptFactory
17 UserScript {}
18 }
19
20 TestWebContext {
21 id: c
22 Component.onCompleted: {
23 var script = userScriptFactory.createObject(null, {
24 context: "oxide://testutils/",
25 url: Qt.resolvedUrl("tst_WebNotificationPermissionRequest.js"),
26 matchAllFrames: true
27 });
28 addUserScript(script);
29 }
30 }
31
32 Component {
33 id: webViewFactory
34 TestWebView {
35 context: c
36
37 property var lastRequest: null
38 onNotificationPermissionRequested: {
39 lastRequest = request;
40 }
41
42 QtObject {
43 id: _internal
44 property var lastStatus: -1
45 }
46 property alias lastStatus: _internal.lastStatus
47
48 messageHandlers: [
49 ScriptMessageHandler {
50 msgId: "TEST-RESPONSE"
51 contexts: [ "oxide://testutils/" ]
52 callback: function(msg) {
53 _internal.lastStatus = msg.args.status;
54 }
55 }
56 ]
57 }
58 }
59
60 TestCase {
61 id: test
62 name: "NotificationPermissionRequest_session_persist"
63 when: windowShown
64
65 function _test_accept(req) {
66 req.allow();
67 }
68
69 function _test_deny(req) {
70 req.deny();
71 }
72
73 function _test_destroy(req) {
74 req.destroy();
75 }
76
77 function init() {
78 spy.target = null;
79 spy.clear();
80 c.clearTemporarySavedPermissionStatuses();
81 }
82
83 function test_NotificationPermissionRequest_session_persist1_data() {
84 return [
85 { function: _test_accept, expected: 0, save: true },
86 { function: _test_deny, expected: 1, save: true },
87 { function: _test_destroy, expected: 1, save: false },
88 ];
89 }
90
91 function test_NotificationPermissionRequest_session_persist1(data) {
92 var webView = webViewFactory.createObject(null, {});
93 spy.target = webView;
94
95 webView.url = "http://foo.testsuite/tst_WebNotificationPermissionRequest.html";
96
97 verify(webView.waitForLoadSucceeded());
98
99 spy.wait();
100
101 compare(webView.lastRequest.embedder, "http://foo.testsuite/");
102
103 data.function(webView.lastRequest);
104
105 verify(webView.waitFor(function() { return webView.lastStatus != -1; }));
106 compare(webView.lastStatus, data.expected);
107
108 spy.clear();
109 webView.lastStatus = -1;
110
111 webView.reload();
112 verify(webView.waitForLoadSucceeded());
113
114 if (data.save) {
115 verify(webView.waitFor(function() { return webView.lastStatus != -1; }));
116 compare(webView.lastStatus, data.expected);
117 } else {
118 spy.wait();
119 compare(webView.lastRequest.embedder, "http://foo.testsuite/");
120 }
121 }
122
123 function test_NotificationPermissionRequest_session_persist2_data() {
124 return test_NotificationPermissionRequest_session_persist1_data();
125 }
126
127 function test_NotificationPermissionRequest_session_persist2(data) {
128 var webView = webViewFactory.createObject(null, {});
129 spy.target = webView;
130
131 webView.url = "http://foo.testsuite/tst_WebNotificationPermissionRequest.html";
132 verify(webView.waitForLoadSucceeded());
133
134 spy.wait();
135
136 compare(webView.lastRequest.embedder, "http://foo.testsuite/");
137
138 data.function(webView.lastRequest);
139
140 verify(webView.waitFor(function() { return webView.lastStatus != -1; }));
141 compare(webView.lastStatus, data.expected);
142
143 webView = webViewFactory.createObject(null, {});
144 spy.target = webView;
145
146 spy.clear();
147
148 webView.url = "http://foo.testsuite/tst_WebNotificationPermissionRequest.html";
149 verify(webView.waitForLoadSucceeded());
150
151 if (data.save) {
152 verify(webView.waitFor(function() { return webView.lastStatus != -1; }));
153 compare(webView.lastStatus, data.expected);
154 } else {
155 spy.wait();
156 compare(webView.lastRequest.embedder, "http://foo.testsuite/");
157 }
158 }
159
160 function test_NotificationPermissionRequest_session_persist3_data() {
161 return [
162 // Same origin / different embedder
163 { url1: "http://foo.testsuite/tst_WebNotificationPermissionRequest.html",
164 url2: "http://bar.testsuite/tst_WebNotificationPermissionRequest.html" },
165 // Same origin / embedder == allowed origin
166 { url1: "http://foo.testsuite/tst_WebNotificationPermissionRequest.html",
167 url2: "http://testsuite/tst_WebNotificationPermissionRequest.html" },
168 // Different origin / different embedder
169 { url1: "http://foo.testsuite/tst_WebNotificationPermissionRequest.html",
170 url2: "http://bar.testsuite/tst_WebNotificationPermissionRequest.html" },
171 ];
172 }
173
174 // Verify several cases where saved permissions should not be used
175 function test_NotificationPermissionRequest_session_persist3(data) {
176 var webView = webViewFactory.createObject(null, {});
177 spy.target = webView;
178
179 webView.url = data.url1;
180 verify(webView.waitForLoadSucceeded());
181
182 spy.wait();
183
184 webView.lastRequest.allow();
185
186 verify(webView.waitFor(function() { return webView.lastStatus != -1; }));
187 compare(webView.lastStatus, 0);
188
189 spy.clear();
190 webView.lastStatus = -1;
191
192 webView.url = data.url2;
193 verify(webView.waitForLoadSucceeded());
194
195 spy.wait();
196 }
197 }
198}
0199
=== modified file 'shared/browser/oxide_browser_platform_integration.h'
--- shared/browser/oxide_browser_platform_integration.h 2015-06-12 07:39:38 +0000
+++ shared/browser/oxide_browser_platform_integration.h 2015-06-19 15:51:41 +0000
@@ -96,6 +96,8 @@
96 // Get the current application state96 // Get the current application state
97 virtual ApplicationState GetApplicationState();97 virtual ApplicationState GetApplicationState();
9898
99 virtual std::string GetAppName() = 0;
100
99 protected:101 protected:
100 BrowserPlatformIntegration();102 BrowserPlatformIntegration();
101103
102104
=== modified file 'shared/browser/oxide_content_browser_client.cc'
--- shared/browser/oxide_content_browser_client.cc 2015-06-18 15:48:50 +0000
+++ shared/browser/oxide_content_browser_client.cc 2015-06-19 15:51:41 +0000
@@ -52,6 +52,7 @@
52#include "oxide_web_preferences.h"52#include "oxide_web_preferences.h"
53#include "oxide_web_view.h"53#include "oxide_web_view.h"
54#include "oxide_web_view_contents_helper.h"54#include "oxide_web_view_contents_helper.h"
55#include "oxide_platform_notification_service.h"
5556
56#if defined(ENABLE_PLUGINS)57#if defined(ENABLE_PLUGINS)
57#include "content/public/browser/browser_ppapi_host.h"58#include "content/public/browser/browser_ppapi_host.h"
@@ -298,7 +299,14 @@
298 const std::string& application_locale,299 const std::string& application_locale,
299 BrowserPlatformIntegration* integration)300 BrowserPlatformIntegration* integration)
300 : application_locale_(application_locale),301 : application_locale_(application_locale),
301 platform_integration_(integration) {}302 platform_integration_(integration) {
303 PlatformNotificationService::GetInstance()->Initialize(integration->GetAppName());
304}
305
306content::PlatformNotificationService*
307ContentBrowserClient::GetPlatformNotificationService() {
308 return PlatformNotificationService::GetInstance();
309}
302310
303ContentBrowserClient::~ContentBrowserClient() {}311ContentBrowserClient::~ContentBrowserClient() {}
304312
305313
=== modified file 'shared/browser/oxide_content_browser_client.h'
--- shared/browser/oxide_content_browser_client.h 2015-06-17 21:04:11 +0000
+++ shared/browser/oxide_content_browser_client.h 2015-06-19 15:51:41 +0000
@@ -49,6 +49,7 @@
49 private:49 private:
50 // content::ContentBrowserClient implementation50 // content::ContentBrowserClient implementation
51 std::string GetApplicationLocale() final;51 std::string GetApplicationLocale() final;
52 content::PlatformNotificationService* GetPlatformNotificationService() final;
52 content::BrowserMainParts* CreateBrowserMainParts(53 content::BrowserMainParts* CreateBrowserMainParts(
53 const content::MainFunctionParams& parameters) final;54 const content::MainFunctionParams& parameters) final;
54 void RenderProcessWillLaunch(content::RenderProcessHost* host) final;55 void RenderProcessWillLaunch(content::RenderProcessHost* host) final;
5556
=== added file 'shared/browser/oxide_platform_notification_service.cc'
--- shared/browser/oxide_platform_notification_service.cc 1970-01-01 00:00:00 +0000
+++ shared/browser/oxide_platform_notification_service.cc 2015-06-19 15:51:41 +0000
@@ -0,0 +1,265 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2014 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#include "oxide_platform_notification_service.h"
19
20#include <map>
21#include <libnotify/notify.h>
22#include "third_party/skia/include/core/SkImageEncoder.h"
23#include "third_party/skia/include/core/SkBitmap.h"
24
25#include "base/strings/utf_string_conversions.h"
26#include "content/public/common/platform_notification_data.h"
27#include "content/public/browser/desktop_notification_delegate.h"
28#include "third_party/skia/include/core/SkUnPreMultiply.h"
29
30#include "shared/browser/permissions/oxide_temporary_saved_permission_context.h"
31#include "shared/browser/oxide_browser_context.h"
32
33namespace oxide {
34
35// Copy&paste from chrome/browser/ui/libgtk2ui/skia_utils_gtk2.cc
36// to avoid dependency on full Gdk.
37GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap) {
38 if (bitmap.isNull()) {
39 return nullptr;
40 }
41
42 SkAutoLockPixels lock_pixels(bitmap);
43
44 int width = bitmap.width();
45 int height = bitmap.height();
46
47 GdkPixbuf* pixbuf =
48 gdk_pixbuf_new(GDK_COLORSPACE_RGB, // The only colorspace gtk supports.
49 TRUE, // There is an alpha channel.
50 8,
51 width,
52 height);
53
54 // SkBitmaps are premultiplied, we need to unpremultiply them.
55 const int kBytesPerPixel = 4;
56 uint8_t* divided = gdk_pixbuf_get_pixels(pixbuf);
57
58 for (int y = 0, i = 0; y < height; y++) {
59 for (int x = 0; x < width; x++) {
60 uint32_t pixel = bitmap.getAddr32(0, y)[x];
61
62 int alpha = SkColorGetA(pixel);
63 if (alpha != 0 && alpha != 255) {
64 SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(pixel);
65 divided[i + 0] = SkColorGetR(unmultiplied);
66 divided[i + 1] = SkColorGetG(unmultiplied);
67 divided[i + 2] = SkColorGetB(unmultiplied);
68 divided[i + 3] = alpha;
69 } else {
70 divided[i + 0] = SkColorGetR(pixel);
71 divided[i + 1] = SkColorGetG(pixel);
72 divided[i + 2] = SkColorGetB(pixel);
73 divided[i + 3] = alpha;
74 }
75 i += kBytesPerPixel;
76 }
77 }
78
79 return pixbuf;
80}
81
82
83namespace {
84
85blink::WebNotificationPermission
86ToNotificationPermission(TemporarySavedPermissionStatus status) {
87 switch (status) {
88 case TEMPORARY_SAVED_PERMISSION_STATUS_ALLOWED:
89 return blink::WebNotificationPermissionAllowed;
90 case TEMPORARY_SAVED_PERMISSION_STATUS_DENIED:
91 return blink::WebNotificationPermissionDenied;
92 default:
93 return blink::WebNotificationPermissionDefault;
94 };
95}
96
97class DesktopNotification: public base::RefCounted<DesktopNotification> {
98public:
99 base::Closure* GetCancelCallback();
100
101 static scoped_refptr<DesktopNotification> CreateDesktopNotification(
102 const GURL& origin, const std::string &tag);
103 void Initialize(
104 const base::string16& title, const base::string16& body,
105 const SkBitmap& icon,
106 scoped_ptr<content::DesktopNotificationDelegate> delegate);
107private:
108 DesktopNotification(const GURL &origin, const std::string &tag);
109 ~DesktopNotification();
110
111 void CancelNotification();
112
113 GURL origin_;
114 std::string tag_;
115 base::Closure cancel_callback_;
116 NotifyNotification *notification_;
117 scoped_ptr<content::DesktopNotificationDelegate> delegate_;
118
119 static void OnClosed(NotifyNotification *notification, DesktopNotification *self);
120 static std::map<GURL, std::map<std::string, scoped_refptr<DesktopNotification>>> table_;
121
122 friend class base::RefCounted<DesktopNotification>;
123};
124
125std::map<GURL, std::map<std::string, scoped_refptr<DesktopNotification>>> DesktopNotification::table_;
126
127DesktopNotification::DesktopNotification(const GURL &origin, const std::string &tag)
128 : origin_(origin), tag_(tag), notification_(nullptr) {
129}
130
131scoped_refptr<DesktopNotification>
132DesktopNotification::CreateDesktopNotification(const GURL& origin, const std::string &tag) {
133 table_[origin][tag] = new DesktopNotification(origin, tag);
134 return table_[origin][tag];
135}
136
137void
138DesktopNotification::Initialize(
139 const base::string16& title, const base::string16& body,
140 const SkBitmap& icon,
141 scoped_ptr<content::DesktopNotificationDelegate> delegate) {
142 DCHECK(!notification_);
143
144 delegate_ = delegate.Pass();
145
146 std::string t = base::UTF16ToUTF8(title);
147 std::string b = base::UTF16ToUTF8(body);
148
149 notification_ = notify_notification_new(t.c_str(), b.c_str(), nullptr);
150
151 g_signal_connect(notification_, "closed", G_CALLBACK(OnClosed), this);
152
153 if (delegate_.get()) {
154 delegate_->NotificationDisplayed();
155 }
156
157 if (icon.width() && icon.height()) {
158 GdkPixbuf *pix = GdkPixbufFromSkBitmap(icon);
159 notify_notification_set_image_from_pixbuf(notification_, pix);
160 g_object_unref(G_OBJECT(pix));
161 }
162 notify_notification_show(notification_, nullptr);
163}
164
165base::Closure*
166DesktopNotification::GetCancelCallback() {
167 cancel_callback_ = base::Bind(&DesktopNotification::CancelNotification, this);
168 return &cancel_callback_;
169}
170
171DesktopNotification::~DesktopNotification() {
172 g_object_unref(G_OBJECT(notification_));
173}
174
175void
176DesktopNotification::CancelNotification() {
177 table_[origin_].erase(tag_);
178 this->Release();
179}
180
181void
182DesktopNotification::OnClosed(NotifyNotification *notification, DesktopNotification *self) {
183 table_[self->origin_].erase(self->tag_);
184 if (self->delegate_.get()) {
185 self->delegate_->NotificationClosed();
186 }
187 self->Release();
188}
189
190}
191
192void
193PlatformNotificationService::Initialize(const std::string& name) {
194 notify_init(name.c_str());
195}
196
197blink::WebNotificationPermission
198PlatformNotificationService::CheckPermissionOnIOThread(
199 content::ResourceContext* resource_context,
200 const GURL& origin,
201 int render_process_id) {
202 TemporarySavedPermissionContext* permission_context =
203 BrowserContextIOData::FromResourceContext(resource_context)->GetTemporarySavedPermissionContext();
204
205 return ToNotificationPermission(permission_context->GetPermissionStatus(
206 TEMPORARY_SAVED_PERMISSION_TYPE_NOTIFICATIONS, origin, origin));
207}
208
209blink::WebNotificationPermission
210PlatformNotificationService::CheckPermissionOnUIThread(
211 content::BrowserContext* browser_context,
212 const GURL& origin,
213 int render_process_id) {
214 BrowserContext* context = static_cast<BrowserContext*>(browser_context);
215 TemporarySavedPermissionContext* permission_context = context->GetTemporarySavedPermissionContext();
216
217 return ToNotificationPermission(permission_context->GetPermissionStatus(
218 TEMPORARY_SAVED_PERMISSION_TYPE_NOTIFICATIONS, origin, origin));
219}
220
221void
222PlatformNotificationService::DisplayNotification(
223 content::BrowserContext* browser_context,
224 const GURL& origin,
225 const SkBitmap& icon,
226 const content::PlatformNotificationData& notification_data,
227 scoped_ptr<content::DesktopNotificationDelegate> delegate,
228 base::Closure* cancel_callback) {
229
230 scoped_refptr<DesktopNotification> notification = DesktopNotification::CreateDesktopNotification(
231 origin, notification_data.tag);
232 notification->Initialize(notification_data.title, notification_data.body, icon, delegate.Pass());
233
234 cancel_callback = notification->GetCancelCallback();
235}
236
237void
238PlatformNotificationService::DisplayPersistentNotification(
239 content::BrowserContext* browser_context,
240 int64 service_worker_registration_id,
241 const GURL& origin,
242 const SkBitmap& icon,
243 const content::PlatformNotificationData& notification_data) {
244 NOTIMPLEMENTED();
245}
246
247void
248PlatformNotificationService::ClosePersistentNotification(content::BrowserContext* browser_context,
249 int64_t persistent_notification_id) {
250 NOTIMPLEMENTED();
251}
252
253bool
254PlatformNotificationService::GetDisplayedPersistentNotifications(
255 content::BrowserContext* browser_context,
256 std::set<std::string>* displayed_notifications) {
257 return false;
258}
259
260PlatformNotificationService*
261PlatformNotificationService::GetInstance() {
262 return Singleton<PlatformNotificationService>::get();
263}
264
265}
0266
=== added file 'shared/browser/oxide_platform_notification_service.h'
--- shared/browser/oxide_platform_notification_service.h 1970-01-01 00:00:00 +0000
+++ shared/browser/oxide_platform_notification_service.h 2015-06-19 15:51:41 +0000
@@ -0,0 +1,77 @@
1// vim:expandtab:shiftwidth=2:tabstop=2:
2// Copyright (C) 2014 Canonical Ltd.
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18#ifndef _OXIDE_QT_CORE_PLATFORM_NOTIFICATION_H_
19#define _OXIDE_QT_CORE_PLATFORM_NOTIFICATION_H_
20
21#include <string>
22
23#include "base/memory/singleton.h"
24#include "base/values.h"
25#include "content/public/browser/platform_notification_service.h"
26
27namespace oxide {
28
29class PlatformNotificationService: public content::PlatformNotificationService {
30public:
31 void Initialize(const std::string &name);
32
33 blink::WebNotificationPermission CheckPermissionOnIOThread(
34 content::ResourceContext* resource_context,
35 const GURL& origin,
36 int render_process_id) override;
37
38 blink::WebNotificationPermission CheckPermissionOnUIThread(
39 content::BrowserContext* browser_context,
40 const GURL& origin,
41 int render_process_id) override;
42
43 void DisplayNotification(
44 content::BrowserContext* browser_context,
45 const GURL& origin,
46 const SkBitmap& icon,
47 const content::PlatformNotificationData& notification_data,
48 scoped_ptr<content::DesktopNotificationDelegate> delegate,
49 base::Closure* cancel_callback) override;
50
51 void DisplayPersistentNotification(
52 content::BrowserContext* browser_context,
53 int64 service_worker_registration_id,
54 const GURL& origin,
55 const SkBitmap& icon,
56 const content::PlatformNotificationData& notification_data) override;
57
58 void ClosePersistentNotification(
59 content::BrowserContext* browser_context,
60 int64_t persistent_notification_id) override;
61
62 bool GetDisplayedPersistentNotifications(
63 content::BrowserContext* browser_context,
64 std::set<std::string>* displayed_notifications) override;
65
66 static PlatformNotificationService* GetInstance();
67private:
68 friend struct DefaultSingletonTraits<PlatformNotificationService>;
69 PlatformNotificationService() = default;
70
71 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationService);
72};
73
74
75}
76
77#endif
078
=== modified file 'shared/browser/oxide_web_view.cc'
--- shared/browser/oxide_web_view.cc 2015-06-18 15:48:50 +0000
+++ shared/browser/oxide_web_view.cc 2015-06-19 15:51:41 +0000
@@ -1271,7 +1271,7 @@
1271 DCHECK(root_frame_.get());1271 DCHECK(root_frame_.get());
12721272
1273 if (params->context && init_data_->load_params) {1273 if (params->context && init_data_->load_params) {
1274 web_contents_->GetController().LoadURLWithParams(*init_data_->load_params); 1274 web_contents_->GetController().LoadURLWithParams(*init_data_->load_params);
1275 }1275 }
12761276
1277 web_contents_->GetController().LoadIfNecessary();1277 web_contents_->GetController().LoadIfNecessary();
12781278
=== modified file 'shared/browser/permissions/oxide_permission_manager.cc'
--- shared/browser/permissions/oxide_permission_manager.cc 2015-06-17 21:04:11 +0000
+++ shared/browser/permissions/oxide_permission_manager.cc 2015-06-19 15:51:41 +0000
@@ -21,6 +21,7 @@
21#include "content/public/browser/geolocation_provider.h"21#include "content/public/browser/geolocation_provider.h"
22#include "content/public/browser/permission_type.h"22#include "content/public/browser/permission_type.h"
23#include "content/public/common/permission_status.mojom.h"23#include "content/public/common/permission_status.mojom.h"
24#include "shared/browser/oxide_platform_notification_service.h"
2425
25#include "shared/browser/oxide_browser_context.h"26#include "shared/browser/oxide_browser_context.h"
2627
@@ -57,6 +58,7 @@
57bool IsPermissionTypeSupported(content::PermissionType permission) {58bool IsPermissionTypeSupported(content::PermissionType permission) {
58 switch (permission) {59 switch (permission) {
59 case content::PermissionType::GEOLOCATION:60 case content::PermissionType::GEOLOCATION:
61 case content::PermissionType::NOTIFICATIONS:
60 return true;62 return true;
61 default:63 default:
62 return false;64 return false;
@@ -68,6 +70,8 @@
68 switch (permission) {70 switch (permission) {
69 case content::PermissionType::GEOLOCATION:71 case content::PermissionType::GEOLOCATION:
70 return TEMPORARY_SAVED_PERMISSION_TYPE_GEOLOCATION;72 return TEMPORARY_SAVED_PERMISSION_TYPE_GEOLOCATION;
73 case content::PermissionType::NOTIFICATIONS:
74 return TEMPORARY_SAVED_PERMISSION_TYPE_NOTIFICATIONS;
71 default:75 default:
72 NOTREACHED();76 NOTREACHED();
73 // XXX(chrisccoulson): Perhaps we need __builtin_unreachable here?77 // XXX(chrisccoulson): Perhaps we need __builtin_unreachable here?
@@ -134,6 +138,7 @@
134 case content::PermissionType::GEOLOCATION:138 case content::PermissionType::GEOLOCATION:
135 return base::Bind(&RespondToGeolocationPermissionRequest,139 return base::Bind(&RespondToGeolocationPermissionRequest,
136 wrapped_callback);140 wrapped_callback);
141 case content::PermissionType::NOTIFICATIONS:
137 default:142 default:
138 return wrapped_callback;143 return wrapped_callback;
139 }144 }
140145
=== modified file 'shared/browser/permissions/oxide_permission_request_dispatcher.cc'
--- shared/browser/permissions/oxide_permission_request_dispatcher.cc 2015-06-17 21:04:11 +0000
+++ shared/browser/permissions/oxide_permission_request_dispatcher.cc 2015-06-19 15:51:41 +0000
@@ -140,6 +140,9 @@
140 case content::PermissionType::GEOLOCATION:140 case content::PermissionType::GEOLOCATION:
141 client_->RequestGeolocationPermission(request.Pass());141 client_->RequestGeolocationPermission(request.Pass());
142 break;142 break;
143 case content::PermissionType::NOTIFICATIONS:
144 client_->RequestNotificationPermission(request.Pass());
145 break;
143 default:146 default:
144 NOTIMPLEMENTED();147 NOTIMPLEMENTED();
145 break;148 break;
146149
=== modified file 'shared/browser/permissions/oxide_permission_request_dispatcher_client.h'
--- shared/browser/permissions/oxide_permission_request_dispatcher_client.h 2015-06-04 08:35:28 +0000
+++ shared/browser/permissions/oxide_permission_request_dispatcher_client.h 2015-06-19 15:51:41 +0000
@@ -38,6 +38,9 @@
3838
39 virtual void RequestMediaAccessPermission(39 virtual void RequestMediaAccessPermission(
40 scoped_ptr<MediaAccessPermissionRequest> request) {}40 scoped_ptr<MediaAccessPermissionRequest> request) {}
41
42 virtual void RequestNotificationPermission(
43 scoped_ptr<SimplePermissionRequest> request) {}
41};44};
4245
43} // namespace oxide46} // namespace oxide
4447
=== modified file 'shared/browser/permissions/oxide_temporary_saved_permission_context.h'
--- shared/browser/permissions/oxide_temporary_saved_permission_context.h 2015-06-10 13:10:39 +0000
+++ shared/browser/permissions/oxide_temporary_saved_permission_context.h 2015-06-19 15:51:41 +0000
@@ -41,6 +41,7 @@
41 PERMISSION_TYPES_START,41 PERMISSION_TYPES_START,
4242
43 TEMPORARY_SAVED_PERMISSION_TYPE_GEOLOCATION = PERMISSION_TYPES_START,43 TEMPORARY_SAVED_PERMISSION_TYPE_GEOLOCATION = PERMISSION_TYPES_START,
44 TEMPORARY_SAVED_PERMISSION_TYPE_NOTIFICATIONS,
44 TEMPORARY_SAVED_PERMISSION_TYPE_MEDIA_DEVICE_MIC,45 TEMPORARY_SAVED_PERMISSION_TYPE_MEDIA_DEVICE_MIC,
45 TEMPORARY_SAVED_PERMISSION_TYPE_MEDIA_DEVICE_CAMERA,46 TEMPORARY_SAVED_PERMISSION_TYPE_MEDIA_DEVICE_CAMERA,
4647
4748
=== modified file 'shared/shared.gyp'
--- shared/shared.gyp 2015-06-18 15:48:50 +0000
+++ shared/shared.gyp 2015-06-19 15:51:41 +0000
@@ -17,6 +17,7 @@
17{17{
18 'variables': {18 'variables': {
19 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/oxide',19 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/oxide',
20 'pkg_config': 'pkg-config'
20 },21 },
21 'conditions': [22 'conditions': [
22 ['enable_mediahub==1', {23 ['enable_mediahub==1', {
@@ -264,6 +265,7 @@
264 '<(DEPTH)/ui/ozone/ozone.gyp:ozone',265 '<(DEPTH)/ui/ozone/ozone.gyp:ozone',
265 '<(DEPTH)/url/url.gyp:url_lib',266 '<(DEPTH)/url/url.gyp:url_lib',
266 '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',267 '<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
268 '../build/system.gyp:libnotify',
267 ],269 ],
268 'include_dirs': [270 'include_dirs': [
269 '..',271 '..',
@@ -357,6 +359,8 @@
357 'browser/oxide_message_pump.h',359 'browser/oxide_message_pump.h',
358 'browser/oxide_network_delegate.cc',360 'browser/oxide_network_delegate.cc',
359 'browser/oxide_network_delegate.h',361 'browser/oxide_network_delegate.h',
362 'browser/oxide_platform_notification_service.h',
363 'browser/oxide_platform_notification_service.cc',
360 'browser/oxide_power_save_blocker.cc',364 'browser/oxide_power_save_blocker.cc',
361 'browser/oxide_power_save_blocker.h',365 'browser/oxide_power_save_blocker.h',
362 'browser/oxide_quota_permission_context.cc',366 'browser/oxide_quota_permission_context.cc',

Subscribers

People subscribed via source and target branches