| 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_RENDERER_MEDIA_MIDI_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "content/public/renderer/render_view_observer.h" | 9 #include "content/public/renderer/render_view_observer.h" |
| 10 #include "third_party/WebKit/public/web/WebMIDIClient.h" | 10 #include "third_party/WebKit/public/web/WebMIDIClient.h" |
| 11 | 11 |
| 12 namespace WebKit { | 12 namespace blink { |
| 13 class WebMIDIPermissionRequest; | 13 class WebMIDIPermissionRequest; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 class RenderViewImpl; | 18 class RenderViewImpl; |
| 19 | 19 |
| 20 // MIDIDispatcher implements WebMIDIClient to handle permissions for using | 20 // MIDIDispatcher implements WebMIDIClient to handle permissions for using |
| 21 // system exclusive messages. | 21 // system exclusive messages. |
| 22 // It works as RenderViewObserver to handle IPC messages between | 22 // It works as RenderViewObserver to handle IPC messages between |
| 23 // MIDIDispatcherHost owned by RenderViewHost since permissions are managed in | 23 // MIDIDispatcherHost owned by RenderViewHost since permissions are managed in |
| 24 // the browser process. | 24 // the browser process. |
| 25 class MIDIDispatcher : public RenderViewObserver, | 25 class MIDIDispatcher : public RenderViewObserver, |
| 26 public WebKit::WebMIDIClient { | 26 public blink::WebMIDIClient { |
| 27 public: | 27 public: |
| 28 explicit MIDIDispatcher(RenderViewImpl* render_view); | 28 explicit MIDIDispatcher(RenderViewImpl* render_view); |
| 29 virtual ~MIDIDispatcher(); | 29 virtual ~MIDIDispatcher(); |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 // RenderView::Observer implementation. | 32 // RenderView::Observer implementation. |
| 33 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 33 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 34 | 34 |
| 35 // WebKit::WebMIDIClient implementation. | 35 // blink::WebMIDIClient implementation. |
| 36 virtual void requestSysExPermission( | 36 virtual void requestSysExPermission( |
| 37 const WebKit::WebMIDIPermissionRequest& request) OVERRIDE; | 37 const blink::WebMIDIPermissionRequest& request) OVERRIDE; |
| 38 virtual void cancelSysExPermissionRequest( | 38 virtual void cancelSysExPermissionRequest( |
| 39 const WebKit::WebMIDIPermissionRequest& request) OVERRIDE; | 39 const blink::WebMIDIPermissionRequest& request) OVERRIDE; |
| 40 | 40 |
| 41 // Permission for using system exclusive messages has been set. | 41 // Permission for using system exclusive messages has been set. |
| 42 void OnSysExPermissionApproved(int client_id, bool is_allowed); | 42 void OnSysExPermissionApproved(int client_id, bool is_allowed); |
| 43 | 43 |
| 44 // Each WebMIDIPermissionRequest object is valid until | 44 // Each WebMIDIPermissionRequest object is valid until |
| 45 // cancelSysExPermissionRequest() is called with the object, or used to call | 45 // cancelSysExPermissionRequest() is called with the object, or used to call |
| 46 // WebMIDIPermissionRequest::setIsAllowed(). | 46 // WebMIDIPermissionRequest::setIsAllowed(). |
| 47 IDMap<WebKit::WebMIDIPermissionRequest> requests_; | 47 IDMap<blink::WebMIDIPermissionRequest> requests_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(MIDIDispatcher); | 49 DISALLOW_COPY_AND_ASSIGN(MIDIDispatcher); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace content | 52 } // namespace content |
| 53 | 53 |
| 54 #endif // CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_ | 54 #endif // CONTENT_RENDERER_MEDIA_MIDI_DISPATCHER_H_ |
| OLD | NEW |