OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_BROWSER_MEDIA_MIDI_DISPATCHER_HOST_H_ | |
6 #define CONTENT_BROWSER_MEDIA_MIDI_DISPATCHER_HOST_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/callback_forward.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "content/public/browser/web_contents_observer.h" | |
13 | |
14 namespace content { | |
15 | |
16 class BrowserContext; | |
17 | |
18 // MidiDispatcherHost handles permissions for using system exclusive messages. | |
19 class MidiDispatcherHost : public WebContentsObserver { | |
20 public: | |
21 explicit MidiDispatcherHost(WebContents* web_contents); | |
22 ~MidiDispatcherHost() override; | |
23 | |
24 // WebContentsObserver implementation. | |
25 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; | |
26 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, | |
27 const LoadCommittedDetails& details, | |
28 const FrameNavigateParams& params) override; | |
29 bool OnMessageReceived(const IPC::Message& message, | |
30 RenderFrameHost* render_frame_host) override; | |
31 | |
32 private: | |
33 void OnRequestSysExPermission(RenderFrameHost* render_frame_host, | |
34 int bridge_id, | |
35 const GURL& origin, | |
36 bool user_gesture); | |
37 void OnCancelSysExPermissionRequest(RenderFrameHost* render_frame_host, | |
38 int bridge_id, | |
39 const GURL& requesting_frame); | |
40 void WasSysExPermissionGranted(int render_process_id, | |
41 int render_frame_id, | |
42 int bridge_id, | |
43 bool is_allowed); | |
44 void CancelPermissionRequestsForFrame(RenderFrameHost* render_frame_host); | |
45 | |
46 struct PendingPermission { | |
47 PendingPermission(int render_process_id, | |
48 int render_frame_id, | |
49 int bridge_id); | |
50 ~PendingPermission(); | |
51 int render_process_id; | |
52 int render_frame_id; | |
53 int bridge_id; | |
54 }; | |
55 std::vector<PendingPermission> pending_permissions_; | |
56 | |
57 base::WeakPtrFactory<MidiDispatcherHost> weak_factory_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(MidiDispatcherHost); | |
60 }; | |
61 | |
62 } // namespace content | |
63 | |
64 #endif // CONTENT_BROWSER_MEDIA_MIDI_DISPATCHER_HOST_H_ | |
OLD | NEW |