blob: cfa77ee9b7b91b496a941e935d079fd30c0f4d56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_
#define CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_
#include "base/id_map.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/WebKit/public/web/WebMIDIClient.h"
namespace blink {
class WebMIDIPermissionRequest;
}
namespace content {
// MidiDispatcher implements WebMIDIClient to handle permissions for using
// system exclusive messages.
// It works as RenderFrameObserver to handle IPC messages between
// MidiDispatcherHost owned by WebContents since permissions are managed in
// the browser process.
class MidiDispatcher : public RenderFrameObserver,
public blink::WebMIDIClient {
public:
explicit MidiDispatcher(RenderFrame* render_frame);
virtual ~MidiDispatcher();
private:
// RenderFrameObserver implementation.
bool OnMessageReceived(const IPC::Message& message) override;
// blink::WebMIDIClient implementation.
virtual void requestSysexPermission(
const blink::WebMIDIPermissionRequest& request);
virtual void cancelSysexPermissionRequest(
const blink::WebMIDIPermissionRequest& request);
// Permission for using system exclusive messages has been set.
void OnSysExPermissionApproved(int client_id, bool is_allowed);
// Each WebMIDIPermissionRequest object is valid until
// cancelSysexPermissionRequest() is called with the object, or used to call
// WebMIDIPermissionRequest::setIsAllowed().
typedef IDMap<blink::WebMIDIPermissionRequest, IDMapOwnPointer> Requests;
Requests requests_;
DISALLOW_COPY_AND_ASSIGN(MidiDispatcher);
};
} // namespace content
#endif // CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_
|