All instances of addresses as void* are changed to uintptr_t in
[chromium-blink-merge.git] / media / midi / midi_manager_win.h
blobdbee7e15a1791551953b73f6c2dbd53baeff516c
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 MEDIA_MIDI_MIDI_MANAGER_WIN_H_
6 #define MEDIA_MIDI_MIDI_MANAGER_WIN_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/thread.h"
13 #include "base/time/time.h"
14 #include "media/midi/midi_manager.h"
16 namespace media {
17 namespace midi {
19 class MidiServiceWinDelegate {
20 public:
21 virtual ~MidiServiceWinDelegate() {}
22 virtual void OnCompleteInitialization(Result result) = 0;
23 virtual void OnAddInputPort(MidiPortInfo info) = 0;
24 virtual void OnAddOutputPort(MidiPortInfo info) = 0;
25 virtual void OnSetInputPortState(uint32 port_index, MidiPortState state) = 0;
26 virtual void OnSetOutputPortState(uint32 port_index, MidiPortState state) = 0;
27 virtual void OnReceiveMidiData(uint32 port_index,
28 const std::vector<uint8>& data,
29 base::TimeTicks time) = 0;
32 class MidiServiceWin {
33 public:
34 virtual ~MidiServiceWin() {}
35 // This method may return before the initialization is completed.
36 virtual void InitializeAsync(MidiServiceWinDelegate* delegate) = 0;
37 // This method may return before the specified data is actually sent.
38 virtual void SendMidiDataAsync(uint32 port_number,
39 const std::vector<uint8>& data,
40 base::TimeTicks time) = 0;
43 class MidiManagerWin final : public MidiManager, public MidiServiceWinDelegate {
44 public:
45 MidiManagerWin();
46 ~MidiManagerWin() override;
48 // MidiManager overrides:
49 void StartInitialization() final;
50 void DispatchSendMidiData(MidiManagerClient* client,
51 uint32 port_index,
52 const std::vector<uint8>& data,
53 double timestamp) final;
55 // MidiServiceWinDelegate overrides:
56 void OnCompleteInitialization(Result result) final;
57 void OnAddInputPort(MidiPortInfo info) final;
58 void OnAddOutputPort(MidiPortInfo info) final;
59 void OnSetInputPortState(uint32 port_index, MidiPortState state) final;
60 void OnSetOutputPortState(uint32 port_index, MidiPortState state) final;
61 void OnReceiveMidiData(uint32 port_index,
62 const std::vector<uint8>& data,
63 base::TimeTicks time) final;
65 private:
66 scoped_ptr<MidiServiceWin> midi_service_;
67 DISALLOW_COPY_AND_ASSIGN(MidiManagerWin);
70 } // namespace midi
71 } // namespace media
73 #endif // MEDIA_MIDI_MIDI_MANAGER_WIN_H_