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

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

Issue 2079943002: Change RenderFrame to use InterfaceRegistry et al. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2
Patch Set: . Created 4 years, 6 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 "content/public/common/service_registry.h"
11 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
11 #include "services/shell/public/cpp/interface_provider.h"
12 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 12 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
13 #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-blink.h" 14 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom-blink.h"
15 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h" 15 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h"
16 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 16 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
17 #include "third_party/WebKit/public/web/modules/notifications/WebNotificationPer missionCallback.h" 17 #include "third_party/WebKit/public/web/modules/notifications/WebNotificationPer missionCallback.h"
18 18
19 using blink::WebNotificationPermissionCallback; 19 using blink::WebNotificationPermissionCallback;
20 20
21 namespace content { 21 namespace content {
22 22
23 NotificationPermissionDispatcher::NotificationPermissionDispatcher( 23 NotificationPermissionDispatcher::NotificationPermissionDispatcher(
24 RenderFrame* render_frame) 24 RenderFrame* render_frame)
25 : RenderFrameObserver(render_frame) {} 25 : RenderFrameObserver(render_frame) {}
26 26
27 NotificationPermissionDispatcher::~NotificationPermissionDispatcher() {} 27 NotificationPermissionDispatcher::~NotificationPermissionDispatcher() {}
28 28
29 void NotificationPermissionDispatcher::RequestPermission( 29 void NotificationPermissionDispatcher::RequestPermission(
30 const blink::WebSecurityOrigin& origin, 30 const blink::WebSecurityOrigin& origin,
31 WebNotificationPermissionCallback* callback) { 31 WebNotificationPermissionCallback* callback) {
32 if (!permission_service_.get()) { 32 if (!permission_service_.get()) {
33 render_frame()->GetServiceRegistry()->ConnectToRemoteService( 33 render_frame()->GetRemoteInterfaces()->GetInterface(&permission_service_);
34 mojo::GetProxy(&permission_service_));
35 } 34 }
36 35
37 std::unique_ptr<WebNotificationPermissionCallback> owned_callback(callback); 36 std::unique_ptr<WebNotificationPermissionCallback> owned_callback(callback);
38 37
39 // base::Unretained is safe here because the Mojo channel, with associated 38 // base::Unretained is safe here because the Mojo channel, with associated
40 // callbacks, will be deleted before the "this" instance is deleted. 39 // callbacks, will be deleted before the "this" instance is deleted.
41 permission_service_->RequestPermission( 40 permission_service_->RequestPermission(
42 blink::mojom::PermissionName::NOTIFICATIONS, origin.toString().utf8(), 41 blink::mojom::PermissionName::NOTIFICATIONS, origin.toString().utf8(),
43 blink::WebUserGestureIndicator::isProcessingUserGesture(), 42 blink::WebUserGestureIndicator::isProcessingUserGesture(),
44 base::Bind(&NotificationPermissionDispatcher::OnPermissionRequestComplete, 43 base::Bind(&NotificationPermissionDispatcher::OnPermissionRequestComplete,
(...skipping 10 matching lines...) Expand all
55 static_cast<blink::mojom::blink::PermissionStatus>(status); 54 static_cast<blink::mojom::blink::PermissionStatus>(status);
56 55
57 callback->permissionRequestComplete(blink_status); 56 callback->permissionRequestComplete(blink_status);
58 } 57 }
59 58
60 void NotificationPermissionDispatcher::OnDestruct() { 59 void NotificationPermissionDispatcher::OnDestruct() {
61 delete this; 60 delete this;
62 } 61 }
63 62
64 } // namespace content 63 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/mojo/service_registry_js_wrapper.cc ('k') | content/renderer/presentation/presentation_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698