Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: content/renderer/notification_permission_dispatcher.cc

Issue 1943963004: Revert of (reland) Move permission.mojom from WebKit/public/platform/ to components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/notification_permission_dispatcher.h" 5 #include "content/renderer/notification_permission_dispatcher.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "components/permissions/permission_status.mojom.h"
11 #include "content/public/common/service_registry.h" 10 #include "content/public/common/service_registry.h"
12 #include "content/public/renderer/render_frame.h" 11 #include "content/public/renderer/render_frame.h"
13 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 12 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
14 #include "third_party/WebKit/public/platform/WebString.h" 13 #include "third_party/WebKit/public/platform/WebString.h"
14 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h"
15 #include "third_party/WebKit/public/web/modules/notifications/WebNotificationPer missionCallback.h" 15 #include "third_party/WebKit/public/web/modules/notifications/WebNotificationPer missionCallback.h"
16 16
17 using blink::WebNotificationPermissionCallback; 17 using blink::WebNotificationPermissionCallback;
18 18
19 namespace content { 19 namespace content {
20 20
21 NotificationPermissionDispatcher::NotificationPermissionDispatcher( 21 NotificationPermissionDispatcher::NotificationPermissionDispatcher(
22 RenderFrame* render_frame) 22 RenderFrame* render_frame)
23 : RenderFrameObserver(render_frame) {} 23 : RenderFrameObserver(render_frame) {}
24 24
25 NotificationPermissionDispatcher::~NotificationPermissionDispatcher() {} 25 NotificationPermissionDispatcher::~NotificationPermissionDispatcher() {}
26 26
27 void NotificationPermissionDispatcher::RequestPermission( 27 void NotificationPermissionDispatcher::RequestPermission(
28 const blink::WebSecurityOrigin& origin, 28 const blink::WebSecurityOrigin& origin,
29 WebNotificationPermissionCallback* callback) { 29 WebNotificationPermissionCallback* callback) {
30 if (!permission_service_.get()) { 30 if (!permission_service_.get()) {
31 render_frame()->GetServiceRegistry()->ConnectToRemoteService( 31 render_frame()->GetServiceRegistry()->ConnectToRemoteService(
32 mojo::GetProxy(&permission_service_)); 32 mojo::GetProxy(&permission_service_));
33 } 33 }
34 34
35 std::unique_ptr<WebNotificationPermissionCallback> owned_callback(callback); 35 std::unique_ptr<WebNotificationPermissionCallback> owned_callback(callback);
36 36
37 // base::Unretained is safe here because the Mojo channel, with associated 37 // base::Unretained is safe here because the Mojo channel, with associated
38 // callbacks, will be deleted before the "this" instance is deleted. 38 // callbacks, will be deleted before the "this" instance is deleted.
39 permission_service_->RequestPermission( 39 permission_service_->RequestPermission(
40 permissions::mojom::PermissionName::NOTIFICATIONS, 40 blink::mojom::PermissionName::NOTIFICATIONS, origin.toString().utf8(),
41 origin.toString().utf8(),
42 base::Bind(&NotificationPermissionDispatcher::OnPermissionRequestComplete, 41 base::Bind(&NotificationPermissionDispatcher::OnPermissionRequestComplete,
43 base::Unretained(this), 42 base::Unretained(this),
44 base::Passed(std::move(owned_callback)))); 43 base::Passed(std::move(owned_callback))));
45 } 44 }
46 45
47 void NotificationPermissionDispatcher::OnPermissionRequestComplete( 46 void NotificationPermissionDispatcher::OnPermissionRequestComplete(
48 std::unique_ptr<WebNotificationPermissionCallback> callback, 47 std::unique_ptr<WebNotificationPermissionCallback> callback,
49 permissions::mojom::PermissionStatus status) { 48 blink::mojom::PermissionStatus status) {
50 DCHECK(callback); 49 DCHECK(callback);
51 50
52 callback->permissionRequestComplete(status); 51 callback->permissionRequestComplete(status);
53 } 52 }
54 53
55 } // namespace content 54 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/notification_permission_dispatcher.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698