summaryrefslogtreecommitdiff
path: root/chromium/content/browser/renderer_host/media/midi_dispatcher_host.h
blob: 068f71918f5ecfe5a1582ce0ae5d1db721ca2201 (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
// 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_BROWSER_RENDERER_HOST_MEDIA_MIDI_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_DISPATCHER_HOST_H_

#include "content/public/browser/browser_message_filter.h"

class GURL;

namespace content {

class BrowserContext;

// MIDIDispatcherHost handles permissions for using system exclusive messages.
// It works as BrowserMessageFilter to handle IPC messages between
// MIDIDispatcher running as a RenderViewObserver.
class MIDIDispatcherHost : public BrowserMessageFilter {
 public:
  MIDIDispatcherHost(int render_process_id, BrowserContext* browser_context);

  // BrowserMessageFilter implementation.
  virtual bool OnMessageReceived(const IPC::Message& message,
                                 bool* message_was_ok) OVERRIDE;
  virtual void OverrideThreadForMessage(
      const IPC::Message& message, BrowserThread::ID* thread) OVERRIDE;

 protected:
  virtual ~MIDIDispatcherHost();

 private:
  void OnRequestSysExPermission(int render_view_id,
                                int bridge_id,
                                const GURL& origin);
  void OnCancelSysExPermissionRequest(int render_view_id,
                                      int bridge_id,
                                      const GURL& requesting_frame);
  void WasSysExPermissionGranted(int render_view_id,
                                 int bridge_id,
                                 bool success);

  int render_process_id_;
  BrowserContext* browser_context_;

  DISALLOW_COPY_AND_ASSIGN(MIDIDispatcherHost);
};

}  // namespace content

#endif  // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_DISPATCHER_HOST_H_