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

Side by Side Diff: content/renderer/media/midi_dispatcher.cc

Issue 365123003: Implement midi permissions on top of the new common permission classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/media/midi_dispatcher.h" 5 #include "content/renderer/media/midi_dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/common/media/midi_messages.h" 9 #include "content/common/media/midi_messages.h"
10 #include "third_party/WebKit/public/platform/WebString.h" 10 #include "third_party/WebKit/public/platform/WebString.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 void MidiDispatcher::cancelSysexPermissionRequest( 45 void MidiDispatcher::cancelSysexPermissionRequest(
46 const WebMIDIPermissionRequest& request) { 46 const WebMIDIPermissionRequest& request) {
47 for (Requests::iterator it(&requests_); !it.IsAtEnd(); it.Advance()) { 47 for (Requests::iterator it(&requests_); !it.IsAtEnd(); it.Advance()) {
48 WebMIDIPermissionRequest* value = it.GetCurrentValue(); 48 WebMIDIPermissionRequest* value = it.GetCurrentValue();
49 if (value->equals(request)) { 49 if (value->equals(request)) {
50 base::string16 origin = request.securityOrigin().toString(); 50 base::string16 origin = request.securityOrigin().toString();
51 Send(new MidiHostMsg_CancelSysExPermissionRequest( 51 Send(new MidiHostMsg_CancelSysExPermissionRequest(
52 routing_id(), it.GetCurrentKey(), GURL(origin))); 52 routing_id(), it.GetCurrentKey(), GURL(origin)));
53 requests_.Remove(it.GetCurrentKey()); 53 // The request will be removed by OnSysExPermissionApproved once
54 // the blink MIDIAccessInitializer object is deleted.
54 break; 55 break;
55 } 56 }
56 } 57 }
57 } 58 }
58 59
59 void MidiDispatcher::OnSysExPermissionApproved(int bridge_id, 60 void MidiDispatcher::OnSysExPermissionApproved(int bridge_id,
60 bool is_allowed) { 61 bool is_allowed) {
61 // |request| can be NULL when the request is canceled. 62 // |request| can be NULL when the request is canceled.
62 WebMIDIPermissionRequest* request = requests_.Lookup(bridge_id); 63 WebMIDIPermissionRequest* request = requests_.Lookup(bridge_id);
63 if (!request) 64 if (!request)
64 return; 65 return;
65 request->setIsAllowed(is_allowed); 66 request->setIsAllowed(is_allowed);
66 requests_.Remove(bridge_id); 67 requests_.Remove(bridge_id);
67 } 68 }
68 69
69 } // namespace content 70 } // namespace content
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698