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

Unified Diff: content/browser/renderer_host/media/midi_dispatcher_host.cc

Issue 38043004: Cancel MIDI permission request infobar on MIDIAccess stop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delay "requests_.Remove(it.GetCurrentKey());" until we're done using |it|. Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/media/midi_dispatcher_host.h ('k') | content/common/media/midi_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/midi_dispatcher_host.cc
diff --git a/content/browser/renderer_host/media/midi_dispatcher_host.cc b/content/browser/renderer_host/media/midi_dispatcher_host.cc
index 53f5a7693136fb6dc116524d005ad70a1b834593..2181dccdd7211358a705eeafc1b7bc04c6ef797a 100644
--- a/content/browser/renderer_host/media/midi_dispatcher_host.cc
+++ b/content/browser/renderer_host/media/midi_dispatcher_host.cc
@@ -29,6 +29,8 @@ bool MIDIDispatcherHost::OnMessageReceived(const IPC::Message& message,
IPC_BEGIN_MESSAGE_MAP_EX(MIDIDispatcherHost, message, *message_was_ok)
IPC_MESSAGE_HANDLER(MIDIHostMsg_RequestSysExPermission,
OnRequestSysExPermission)
+ IPC_MESSAGE_HANDLER(MIDIHostMsg_CancelSysExPermissionRequest,
+ OnCancelSysExPermissionRequest)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
return handled;
@@ -36,31 +38,42 @@ bool MIDIDispatcherHost::OnMessageReceived(const IPC::Message& message,
void MIDIDispatcherHost::OverrideThreadForMessage(
const IPC::Message& message, BrowserThread::ID* thread) {
- if (message.type() == MIDIHostMsg_RequestSysExPermission::ID)
+ if (IPC_MESSAGE_CLASS(message) == MIDIMsgStart)
*thread = BrowserThread::UI;
}
void MIDIDispatcherHost::OnRequestSysExPermission(int render_view_id,
- int client_id,
+ int bridge_id,
const GURL& origin) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
browser_context_->RequestMIDISysExPermission(
render_process_id_,
render_view_id,
+ bridge_id,
origin,
base::Bind(&MIDIDispatcherHost::WasSysExPermissionGranted,
base::Unretained(this),
render_view_id,
- client_id));
+ bridge_id));
}
+void MIDIDispatcherHost::OnCancelSysExPermissionRequest(
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" << render_view_id
+ << ":" << bridge_id;
+ browser_context_->CancelMIDISysExPermissionRequest(
+ render_process_id_, render_view_id, bridge_id, requesting_frame);
+}
void MIDIDispatcherHost::WasSysExPermissionGranted(int render_view_id,
- int client_id,
+ int bridge_id,
bool success) {
ChildProcessSecurityPolicyImpl::GetInstance()->GrantSendMIDISysExMessage(
render_process_id_);
- Send(new MIDIMsg_SysExPermissionApproved(render_view_id, client_id, success));
+ Send(new MIDIMsg_SysExPermissionApproved(render_view_id, bridge_id, success));
}
} // namespace content
« no previous file with comments | « content/browser/renderer_host/media/midi_dispatcher_host.h ('k') | content/common/media/midi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698