| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/browser_message_filter.h" | 8 #include "content/public/browser/browser_message_filter.h" |
| 9 #include "content/public/browser/midi_permission_context.h" |
| 9 | 10 |
| 10 class GURL; | 11 class GURL; |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 | 14 |
| 14 class BrowserContext; | |
| 15 | |
| 16 // MIDIDispatcherHost handles permissions for using system exclusive messages. | 15 // MIDIDispatcherHost handles permissions for using system exclusive messages. |
| 17 // It works as BrowserMessageFilter to handle IPC messages between | 16 // It works as BrowserMessageFilter to handle IPC messages between |
| 18 // MIDIDispatcher running as a RenderViewObserver. | 17 // MIDIDispatcher running as a RenderViewObserver. |
| 19 class MIDIDispatcherHost : public BrowserMessageFilter { | 18 class MIDIDispatcherHost : public BrowserMessageFilter { |
| 20 public: | 19 public: |
| 21 MIDIDispatcherHost(int render_process_id, BrowserContext* browser_context); | 20 MIDIDispatcherHost(int render_process_id, |
| 21 MidiPermissionContext* midi_permission_context_); |
| 22 | 22 |
| 23 // BrowserMessageFilter implementation. | 23 // BrowserMessageFilter implementation. |
| 24 virtual bool OnMessageReceived(const IPC::Message& message, | 24 virtual bool OnMessageReceived(const IPC::Message& message, |
| 25 bool* message_was_ok) OVERRIDE; | 25 bool* message_was_ok) OVERRIDE; |
| 26 virtual void OverrideThreadForMessage( | 26 virtual void OverrideThreadForMessage( |
| 27 const IPC::Message& message, BrowserThread::ID* thread) OVERRIDE; | 27 const IPC::Message& message, BrowserThread::ID* thread) OVERRIDE; |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 virtual ~MIDIDispatcherHost(); | 30 virtual ~MIDIDispatcherHost(); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 void OnRequestSysExPermission(int render_view_id, | 33 void OnRequestSysExPermission(int render_view_id, |
| 34 int client_id, | 34 int bridge_id, |
| 35 const GURL& origin); | 35 const GURL& origin); |
| 36 void OnCancelSysExPermissionRequest(int render_view_id, |
| 37 int bridge_id, |
| 38 const GURL& requesting_frame); |
| 36 void WasSysExPermissionGranted(int render_view_id, | 39 void WasSysExPermissionGranted(int render_view_id, |
| 37 int client_id, | 40 int bridge_id, |
| 38 bool success); | 41 bool success); |
| 39 | 42 |
| 40 int render_process_id_; | 43 int render_process_id_; |
| 41 BrowserContext* browser_context_; | 44 scoped_refptr<MidiPermissionContext> midi_permission_context_; |
| 42 | 45 |
| 43 DISALLOW_COPY_AND_ASSIGN(MIDIDispatcherHost); | 46 DISALLOW_COPY_AND_ASSIGN(MIDIDispatcherHost); |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 } // namespace content | 49 } // namespace content |
| 47 | 50 |
| 48 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_DISPATCHER_HOST_H_ | 51 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_DISPATCHER_HOST_H_ |
| OLD | NEW |