Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/media/chrome_midi_permission_context.h

Issue 156173002: [MIDI] Add a permission bubble client for MIDI system control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_
6 #define CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_ 6 #define CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 9 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
11 11
12 namespace content {
13 class WebContents;
14 }
15
12 class GURL; 16 class GURL;
13 class PermissionQueueController; 17 class PermissionQueueController;
14 class PermissionRequestID; 18 class PermissionRequestID;
15 class Profile; 19 class Profile;
16 20
17 // This class manages MIDI permissions flow. Used on the UI thread. 21 // This class manages MIDI permissions flow. Used on the UI thread.
18 class ChromeMidiPermissionContext : public BrowserContextKeyedService { 22 class ChromeMidiPermissionContext : public BrowserContextKeyedService {
19 public: 23 public:
20 explicit ChromeMidiPermissionContext(Profile* profile); 24 explicit ChromeMidiPermissionContext(Profile* profile);
21 virtual ~ChromeMidiPermissionContext(); 25 virtual ~ChromeMidiPermissionContext();
22 26
23 // BrowserContextKeyedService methods: 27 // BrowserContextKeyedService methods:
24 virtual void Shutdown() OVERRIDE; 28 virtual void Shutdown() OVERRIDE;
25 29
26 // Request to ask users permission about MIDI. 30 // Request to ask users permission about MIDI.
27 void RequestMidiSysExPermission( 31 void RequestMidiSysExPermission(
28 int render_process_id, 32 int render_process_id,
29 int render_view_id, 33 int render_view_id,
30 int bridge_id, 34 int bridge_id,
31 const GURL& requesting_frame, 35 const GURL& requesting_frame,
32 const content::BrowserContext::MidiSysExPermissionCallback& callback); 36 const content::BrowserContext::MidiSysExPermissionCallback& callback);
33 37
34 // Cancel a pending MIDI permission request. 38 // Cancel a pending MIDI permission request.
35 void CancelMidiSysExPermissionRequest(int render_process_id, 39 void CancelMidiSysExPermissionRequest(int render_process_id,
36 int render_view_id, 40 int render_view_id,
37 int bridge_id, 41 int bridge_id,
38 const GURL& requesting_frame); 42 const GURL& requesting_frame);
39 43
44 // Called when the permission decision is made. It may be by the
Ami GONE FROM CHROMIUM 2014/02/06 19:51:17 s/be by/be called by/ ?
Greg Billock 2014/02/07 18:20:55 reworded.
45 // InfoBarDelegate to notify permission has been set.
Ami GONE FROM CHROMIUM 2014/02/06 19:51:17 I'm no mind reader but I'm pretty sure you can rew
Greg Billock 2014/02/07 18:20:55 :-) yes. clarified.
46 void NotifyPermissionSet(
47 const PermissionRequestID& id,
48 const GURL& requesting_frame,
49 const content::BrowserContext::MidiSysExPermissionCallback& callback,
50 bool allowed);
51
40 private: 52 private:
41 // Decide whether the permission should be granted. 53 // Decide whether the permission should be granted.
42 // Calls PermissionDecided if permission can be decided non-interactively, 54 // Calls PermissionDecided if permission can be decided non-interactively,
43 // or NotifyPermissionSet if permission decided by presenting an infobar. 55 // or NotifyPermissionSet if permission decided by presenting an infobar.
44 void DecidePermission( 56 void DecidePermission(
57 content::WebContents* web_contents,
45 const PermissionRequestID& id, 58 const PermissionRequestID& id,
46 const GURL& requesting_frame, 59 const GURL& requesting_frame,
47 const GURL& embedder, 60 const GURL& embedder,
48 const content::BrowserContext::MidiSysExPermissionCallback& callback); 61 const content::BrowserContext::MidiSysExPermissionCallback& callback);
49 62
50 // Called when permission is granted without interactively asking the user. 63 // Called when permission is granted without interactively asking the user.
51 void PermissionDecided( 64 void PermissionDecided(
52 const PermissionRequestID& id, 65 const PermissionRequestID& id,
53 const GURL& requesting_frame, 66 const GURL& requesting_frame,
54 const GURL& embedder, 67 const GURL& embedder,
55 const content::BrowserContext::MidiSysExPermissionCallback& callback, 68 const content::BrowserContext::MidiSysExPermissionCallback& callback,
56 bool allowed); 69 bool allowed);
57 70
58 // Called when the permission decision is made. It may be by the
59 // InfoBarDelegate to notify permission has been set.
60 void NotifyPermissionSet(
61 const PermissionRequestID& id,
62 const GURL& requesting_frame,
63 const content::BrowserContext::MidiSysExPermissionCallback& callback,
64 bool allowed);
65
66 // Return an instance of the infobar queue controller, creating it if needed. 71 // Return an instance of the infobar queue controller, creating it if needed.
67 PermissionQueueController* GetQueueController(); 72 PermissionQueueController* GetQueueController();
68 73
69 // Removes any pending InfoBar request. 74 // Removes any pending InfoBar request.
70 void CancelPendingInfobarRequest(const PermissionRequestID& id); 75 void CancelPendingInfobarRequest(const PermissionRequestID& id);
71 76
72 Profile* const profile_; 77 Profile* const profile_;
73 bool shutting_down_; 78 bool shutting_down_;
74 scoped_ptr<PermissionQueueController> permission_queue_controller_; 79 scoped_ptr<PermissionQueueController> permission_queue_controller_;
75 80
76 DISALLOW_COPY_AND_ASSIGN(ChromeMidiPermissionContext); 81 DISALLOW_COPY_AND_ASSIGN(ChromeMidiPermissionContext);
77 }; 82 };
78 83
79 #endif // CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_ 84 #endif // CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698