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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_MEDIA_MIDI_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_MEDIA_MIDI_DISPATCHER_HOST_H_
10 #include "base/callback_forward.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/web_contents_observer.h"
18 // MidiDispatcherHost handles permissions for using system exclusive messages.
19 class MidiDispatcherHost : public WebContentsObserver {
21 explicit MidiDispatcherHost(WebContents* web_contents);
22 virtual ~MidiDispatcherHost();
24 // WebContentsObserver implementation.
25 virtual bool OnMessageReceived(const IPC::Message& message,
26 RenderFrameHost* render_frame_host) OVERRIDE;
29 void OnRequestSysExPermission(RenderFrameHost* render_frame_host,
33 void OnCancelSysExPermissionRequest(RenderFrameHost* render_frame_host,
35 const GURL& requesting_frame);
36 void WasSysExPermissionGranted(int render_process_id,
41 struct PendingPermission {
42 PendingPermission(int render_process_id,
46 int render_process_id;
51 std::vector<PendingPermission> pending_permissions_;
53 base::WeakPtrFactory<MidiDispatcherHost> weak_factory_;
55 DISALLOW_COPY_AND_ASSIGN(MidiDispatcherHost);
58 } // namespace content
60 #endif // CONTENT_BROWSER_MEDIA_MIDI_DISPATCHER_HOST_H_