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

Side by Side Diff: content/browser/permissions/permission_service_impl.cc

Issue 755673002: Update MidiDispatcher to use Mojo Permission Service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/browser/permissions/permission_service_impl.h" 5 #include "content/browser/permissions/permission_service_impl.h"
6 6
7 #include "content/browser/geolocation/geolocation_provider_impl.h" 7 #include "content/browser/geolocation/geolocation_provider_impl.h"
8 #include "content/public/browser/content_browser_client.h" 8 #include "content/public/browser/content_browser_client.h"
9 #include "content/public/browser/render_process_host.h" 9 #include "content/public/browser/render_process_host.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 namespace { 13 namespace {
14 14
15 PermissionType PermissionNameToPermissionType(PermissionName name) { 15 PermissionType PermissionNameToPermissionType(PermissionName name) {
16 switch(name) { 16 switch(name) {
17 case PERMISSION_NAME_GEOLOCATION: 17 case PERMISSION_NAME_GEOLOCATION:
18 return PERMISSION_GEOLOCATION; 18 return PERMISSION_GEOLOCATION;
19 case PERMISSION_NAME_MIDI_SYSEX:
20 return PERMISSION_MIDI_SYSEX;
19 } 21 }
20 22
21 NOTREACHED(); 23 NOTREACHED();
22 return PERMISSION_NUM; 24 return PERMISSION_NUM;
23 } 25 }
24 26
25 } // anonymous namespace 27 } // anonymous namespace
26 28
27 PermissionServiceImpl::PendingRequest::PendingRequest(PermissionType permission, 29 PermissionServiceImpl::PendingRequest::PendingRequest(PermissionType permission,
28 const GURL& origin) 30 const GURL& origin)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 weak_factory_.GetWeakPtr(), 77 weak_factory_.GetWeakPtr(),
76 callback, 78 callback,
77 request_id)); 79 request_id));
78 } 80 }
79 81
80 void PermissionServiceImpl::OnRequestPermissionResponse( 82 void PermissionServiceImpl::OnRequestPermissionResponse(
81 const mojo::Callback<void(PermissionStatus)>& callback, 83 const mojo::Callback<void(PermissionStatus)>& callback,
82 int request_id, 84 int request_id,
83 bool allowed) { 85 bool allowed) {
84 // TODO(mlamouri): we might want a generic way to handle those things. 86 // TODO(mlamouri): we might want a generic way to handle those things.
87 // TODO(mlamouri): could that move to <name>_permission_context.cc?
85 if (allowed && 88 if (allowed &&
86 pending_requests_.Lookup(request_id)->permission == 89 pending_requests_.Lookup(request_id)->permission ==
87 PERMISSION_GEOLOCATION) { 90 PERMISSION_GEOLOCATION) {
88 GeolocationProviderImpl::GetInstance()->UserDidOptIntoLocationServices(); 91 GeolocationProviderImpl::GetInstance()->UserDidOptIntoLocationServices();
89 } 92 }
90 93
91 pending_requests_.Remove(request_id); 94 pending_requests_.Remove(request_id);
92 95
93 // TODO(mlamouri): for now, we only get a boolean back, but we would ideally 96 // TODO(mlamouri): for now, we only get a boolean back, but we would ideally
94 // need a ContentSetting, see http://crbug.com/432978 97 // need a ContentSetting, see http://crbug.com/432978
(...skipping 16 matching lines...) Expand all
111 } 114 }
112 115
113 void PermissionServiceImpl::HasPermission( 116 void PermissionServiceImpl::HasPermission(
114 PermissionName permission, 117 PermissionName permission,
115 const mojo::String& origin, 118 const mojo::String& origin,
116 const mojo::Callback<void(PermissionStatus)>& callback) { 119 const mojo::Callback<void(PermissionStatus)>& callback) {
117 NOTIMPLEMENTED(); 120 NOTIMPLEMENTED();
118 } 121 }
119 122
120 } // namespace content 123 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698