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

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

Issue 2116763002: Reland: Web MIDI: use mojom::blink::PermissionService directly to ask permission (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for second attempt Created 4 years, 4 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
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/midi_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_
6 #define CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_
7
8 #include "base/id_map.h"
9 #include "base/macros.h"
10 #include "content/public/renderer/render_frame_observer.h"
11 #include "third_party/WebKit/public/platform/modules/permissions/permission.mojo m.h"
12 #include "third_party/WebKit/public/web/modules/webmidi/WebMIDIClient.h"
13
14 namespace blink {
15 class WebMIDIPermissionRequest;
16 }
17
18 namespace content {
19
20 // MidiDispatcher implements WebMIDIClient to handle permissions for using
21 // system exclusive messages.
22 // It works as RenderFrameObserver to keep a 1:1 relationship with a RenderFrame
23 // and make sure it has the same life cycle.
24 class MidiDispatcher : public RenderFrameObserver,
25 public blink::WebMIDIClient {
26 public:
27 explicit MidiDispatcher(RenderFrame* render_frame);
28 ~MidiDispatcher() override;
29
30 private:
31 // RenderFrameObserver implementation.
32 void OnDestruct() override;
33
34 // blink::WebMIDIClient implementation.
35 void requestPermission(const blink::WebMIDIPermissionRequest& request,
36 const blink::WebMIDIOptions& options) override;
37 void cancelPermissionRequest(
38 const blink::WebMIDIPermissionRequest& request) override;
39
40 // Permission for using MIDI system has been set.
41 void OnPermissionSet(int request_id, blink::mojom::PermissionStatus status);
42
43 // Each WebMIDIPermissionRequest object is valid until
44 // cancelSysexPermissionRequest() is called with the object, or used to call
45 // WebMIDIPermissionRequest::setIsAllowed().
46 typedef IDMap<blink::WebMIDIPermissionRequest, IDMapOwnPointer> Requests;
47 Requests requests_;
48
49 blink::mojom::PermissionServicePtr permission_service_;
50
51 DISALLOW_COPY_AND_ASSIGN(MidiDispatcher);
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/midi_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698