#ifndef CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_
#define CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_
#include "base/memory/scoped_ptr.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/browser_context.h"
namespace content {
class WebContents;
}
class GURL;
class PermissionQueueController;
class PermissionRequestID;
class Profile;
class ChromeMidiPermissionContext : public KeyedService {
public:
explicit ChromeMidiPermissionContext(Profile* profile);
virtual ~ChromeMidiPermissionContext();
virtual void Shutdown() OVERRIDE;
void RequestMidiSysExPermission(
int render_process_id,
int render_view_id,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
const content::BrowserContext::MidiSysExPermissionCallback& callback);
void CancelMidiSysExPermissionRequest(int render_process_id,
int render_view_id,
int bridge_id,
const GURL& requesting_frame);
void NotifyPermissionSet(
const PermissionRequestID& id,
const GURL& requesting_frame,
const content::BrowserContext::MidiSysExPermissionCallback& callback,
bool allowed);
private:
void DecidePermission(
content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
bool user_gesture,
const content::BrowserContext::MidiSysExPermissionCallback& callback);
void PermissionDecided(
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
const content::BrowserContext::MidiSysExPermissionCallback& callback,
bool allowed);
PermissionQueueController* GetQueueController();
void CancelPendingInfobarRequest(const PermissionRequestID& id);
Profile* const profile_;
bool shutting_down_;
scoped_ptr<PermissionQueueController> permission_queue_controller_;
DISALLOW_COPY_AND_ASSIGN(ChromeMidiPermissionContext);
};
#endif