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 CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_ | |
6 #define CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "chrome/browser/content_settings/permission_queue_controller.h" | |
12 #include "content/public/browser/browser_context.h" | |
13 | |
14 class GURL; | |
15 class PermissionRequestID; | |
16 class Profile; | |
17 | |
18 // Chrome specific implementation of MIDIPermissionContext; manages MIDI | |
Bernhard Bauer
2013/07/31 15:35:39
What's MIDIPermissionContext? It's not a superclas
Takashi Toyoshima
2013/08/01 07:43:09
Oops. Sorry, this should be removed at cleanup.
Or
| |
19 // permissions flow, and delegates UI handling. | |
20 class ChromeMIDIPermissionContext | |
21 : public base::RefCountedThreadSafe<ChromeMIDIPermissionContext> { | |
Bernhard Bauer
2013/07/31 15:35:39
Why is this class refcounted thread safe?
Takashi Toyoshima
2013/08/01 07:43:09
As we commented in the cc file, this class is used
| |
22 public: | |
23 explicit ChromeMIDIPermissionContext(Profile* profile); | |
24 | |
25 void RequestMIDISysExPermission( | |
26 int render_process_id, | |
27 int render_view_id, | |
28 const GURL& requesting_frame, | |
29 const content::BrowserContext::MIDISysExPermissionCallback& callback); | |
30 | |
31 // Called on the UI thread when the profile is about to be destroyed. | |
32 void ShutdownOnUIThread(); | |
33 | |
34 protected: | |
35 virtual ~ChromeMIDIPermissionContext(); | |
Bernhard Bauer
2013/07/31 15:35:39
Is this class subclassed?
Takashi Toyoshima
2013/08/01 07:43:09
Yes for RefCounted.
Bernhard Bauer
2013/08/01 08:21:27
?
Oh, my question might have been worded ambiguou
Takashi Toyoshima
2013/08/01 09:29:45
Ah, I see. I misunderstood your question.
Done.
| |
36 | |
37 private: | |
38 Profile* profile() const { return profile_; } | |
Bernhard Bauer
2013/07/31 15:35:39
Do you really need a private accessor? :)
Takashi Toyoshima
2013/08/01 07:43:09
Good point. I remove this to use it directly :)
| |
39 | |
40 // Return an instance of the infobar queue controller, creating it | |
41 // if necessary. | |
42 PermissionQueueController* QueueController(); | |
Bernhard Bauer
2013/07/31 15:35:39
Nit: GetQueueController() maybe?
Takashi Toyoshima
2013/08/01 07:43:09
Done.
| |
43 | |
44 // Called on the UI thread when the permission decision is made. It may be by | |
45 // the InfoBarDelegate to notify permission has been set. | |
46 void NotifyPermissionSet( | |
47 const PermissionRequestID& id, | |
48 const GURL& requesting_frame, | |
49 const content::BrowserContext::MIDISysExPermissionCallback& callback, | |
50 bool allowed); | |
51 | |
52 // Decide whether the permission should be granted. | |
53 // Calls PermissionDecided if permission can be decided non-interactively, | |
54 // or NotifyPermissionSet if permission decided by presenting an infobar. | |
55 // Called on the UI thread. | |
56 void DecidePermission( | |
57 const PermissionRequestID& id, | |
58 const GURL& requesting_frame, | |
59 const GURL& embedder, | |
60 const content::BrowserContext::MIDISysExPermissionCallback& callback); | |
61 | |
62 // Called when permission is granted without interactively asking the user. | |
63 // Called on the UI thread. | |
64 void PermissionDecided( | |
65 const PermissionRequestID& id, | |
66 const GURL& requesting_frame, | |
67 const GURL& embedder, | |
68 const content::BrowserContext::MIDISysExPermissionCallback& callback, | |
69 bool allowed); | |
70 | |
71 // Create an PermissionQueueController. overriden in derived classes to | |
Bernhard Bauer
2013/07/31 15:35:39
Nit: "Overridden". Also, are these derived classes
Takashi Toyoshima
2013/08/01 07:43:09
Oops. This also may not happen now, so I'll remove
| |
72 // provide additional UI flow. Called on the UI thread. | |
73 virtual PermissionQueueController* CreateQueueController(); | |
74 | |
75 Profile* const profile_; | |
76 bool shutting_down_; | |
77 scoped_ptr<PermissionQueueController> permission_queue_controller_; | |
78 | |
79 friend class base::RefCountedThreadSafe<ChromeMIDIPermissionContext>; | |
Bernhard Bauer
2013/07/31 15:35:39
Friend declarations come first in the private part
Takashi Toyoshima
2013/08/01 07:43:09
Done.
| |
80 }; | |
81 | |
82 #endif // CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_ | |
OLD | NEW |