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

Unified Diff: content/renderer/media/midi_dispatcher.h

Issue 755673002: Update MidiDispatcher to use Mojo Permission Service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
Index: content/renderer/media/midi_dispatcher.h
diff --git a/content/renderer/media/midi_dispatcher.h b/content/renderer/media/midi_dispatcher.h
index cfa77ee9b7b91b496a941e935d079fd30c0f4d56..65a11d117b70d550144e58f5012665fa8785697d 100644
--- a/content/renderer/media/midi_dispatcher.h
+++ b/content/renderer/media/midi_dispatcher.h
@@ -6,6 +6,7 @@
#define CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_
#include "base/id_map.h"
+#include "content/common/permission_service.mojom.h"
#include "content/public/renderer/render_frame_observer.h"
#include "third_party/WebKit/public/web/WebMIDIClient.h"
@@ -17,9 +18,8 @@ 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.
+// It works as RenderFrameObserver to keep a 1:1 relationship with a RenderFrame
+// and make sure it has the same life cycle.
class MidiDispatcher : public RenderFrameObserver,
public blink::WebMIDIClient {
public:
@@ -27,9 +27,6 @@ class MidiDispatcher : public RenderFrameObserver,
virtual ~MidiDispatcher();
private:
- // RenderFrameObserver implementation.
- bool OnMessageReceived(const IPC::Message& message) override;
-
// blink::WebMIDIClient implementation.
virtual void requestSysexPermission(
const blink::WebMIDIPermissionRequest& request);
@@ -37,7 +34,7 @@ class MidiDispatcher : public RenderFrameObserver,
const blink::WebMIDIPermissionRequest& request);
// Permission for using system exclusive messages has been set.
- void OnSysExPermissionApproved(int client_id, bool is_allowed);
+ void OnSysExPermissionSet(int request_id, PermissionStatus status);
// Each WebMIDIPermissionRequest object is valid until
// cancelSysexPermissionRequest() is called with the object, or used to call
@@ -45,6 +42,8 @@ class MidiDispatcher : public RenderFrameObserver,
typedef IDMap<blink::WebMIDIPermissionRequest, IDMapOwnPointer> Requests;
Requests requests_;
+ PermissionServicePtr permission_service_;
+
DISALLOW_COPY_AND_ASSIGN(MidiDispatcher);
};

Powered by Google App Engine
This is Rietveld 408576698