Chromium Code Reviews| 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 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/keyed_service/core/keyed_service.h" | 9 #include "components/keyed_service/core/keyed_service.h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 class WebContents; | 13 class WebContents; |
| 14 } | 14 } |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 class MidiPermissionRequest; | |
| 17 class PermissionQueueController; | 18 class PermissionQueueController; |
| 18 class PermissionRequestID; | 19 class PermissionRequestID; |
| 19 class Profile; | 20 class Profile; |
| 20 | 21 |
| 21 // This class manages MIDI permissions flow. Used on the UI thread. | 22 // This class manages MIDI permissions flow. Used on the UI thread. |
| 22 class ChromeMidiPermissionContext : public KeyedService { | 23 class ChromeMidiPermissionContext : public KeyedService { |
| 23 public: | 24 public: |
| 24 explicit ChromeMidiPermissionContext(Profile* profile); | 25 explicit ChromeMidiPermissionContext(Profile* profile); |
| 25 virtual ~ChromeMidiPermissionContext(); | 26 virtual ~ChromeMidiPermissionContext(); |
| 26 | 27 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 45 // Called when the permission decision is made. If a permissions prompt is | 46 // Called when the permission decision is made. If a permissions prompt is |
| 46 // shown to the user it will be called when the user selects an option | 47 // shown to the user it will be called when the user selects an option |
| 47 // from that prompt. | 48 // from that prompt. |
| 48 void NotifyPermissionSet( | 49 void NotifyPermissionSet( |
| 49 const PermissionRequestID& id, | 50 const PermissionRequestID& id, |
| 50 const GURL& requesting_frame, | 51 const GURL& requesting_frame, |
| 51 const content::BrowserContext::MidiSysExPermissionCallback& callback, | 52 const content::BrowserContext::MidiSysExPermissionCallback& callback, |
| 52 bool allowed); | 53 bool allowed); |
| 53 | 54 |
| 54 private: | 55 private: |
| 56 friend class MidiPermissionRequest; | |
| 57 | |
| 55 // Decide whether the permission should be granted. | 58 // Decide whether the permission should be granted. |
| 56 // Calls PermissionDecided if permission can be decided non-interactively, | 59 // Calls PermissionDecided if permission can be decided non-interactively, |
| 57 // or NotifyPermissionSet if permission decided by presenting an infobar. | 60 // or NotifyPermissionSet if permission decided by presenting an infobar. |
| 58 void DecidePermission( | 61 void DecidePermission( |
| 59 content::WebContents* web_contents, | 62 content::WebContents* web_contents, |
| 60 const PermissionRequestID& id, | 63 const PermissionRequestID& id, |
| 61 const GURL& requesting_frame, | 64 const GURL& requesting_frame, |
| 62 const GURL& embedder, | 65 const GURL& embedder, |
| 63 bool user_gesture, | 66 bool user_gesture, |
| 64 const content::BrowserContext::MidiSysExPermissionCallback& callback); | 67 const content::BrowserContext::MidiSysExPermissionCallback& callback); |
| 65 | 68 |
| 66 // Called when permission is granted without interactively asking the user. | 69 // Called when permission is granted without interactively asking the user. |
| 67 void PermissionDecided( | 70 void PermissionDecided( |
| 68 const PermissionRequestID& id, | 71 const PermissionRequestID& id, |
| 69 const GURL& requesting_frame, | 72 const GURL& requesting_frame, |
| 70 const GURL& embedder, | 73 const GURL& embedder, |
| 71 const content::BrowserContext::MidiSysExPermissionCallback& callback, | 74 const content::BrowserContext::MidiSysExPermissionCallback& callback, |
| 72 bool allowed); | 75 bool allowed); |
| 73 | 76 |
| 74 // Return an instance of the infobar queue controller, creating it if needed. | 77 // Return an instance of the infobar queue controller, creating it if needed. |
| 75 PermissionQueueController* GetQueueController(); | 78 PermissionQueueController* GetQueueController(); |
| 76 | 79 |
| 77 // Removes any pending InfoBar request. | 80 // Removes any pending InfoBar request. |
| 78 void CancelPendingInfobarRequest(const PermissionRequestID& id); | 81 void CancelPendingInfobarRequest(const PermissionRequestID& id); |
| 79 | 82 |
| 83 // Notify the context that a particular request object is no longer needed. | |
| 84 void RequestFinished(MidiPermissionRequest* request); | |
| 85 | |
| 80 Profile* const profile_; | 86 Profile* const profile_; |
| 81 bool shutting_down_; | 87 bool shutting_down_; |
| 82 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 88 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
| 83 | 89 |
| 90 std::map<std::string, MidiPermissionRequest*> pending_requests_; | |
|
Ami GONE FROM CHROMIUM
2014/05/21 20:15:13
I think you missed the comments I made on this fil
| |
| 91 | |
| 84 DISALLOW_COPY_AND_ASSIGN(ChromeMidiPermissionContext); | 92 DISALLOW_COPY_AND_ASSIGN(ChromeMidiPermissionContext); |
| 85 }; | 93 }; |
| 86 | 94 |
| 87 #endif // CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_ | 95 #endif // CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_ |
| OLD | NEW |