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

Unified Diff: content/public/browser/midi_permission_context.h

Issue 38043004: Cancel MIDI permission request infobar on MIDIAccess stop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/public/browser/midi_permission_context.h
diff --git a/content/public/browser/midi_permission_context.h b/content/public/browser/midi_permission_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..70fe53f84a6c849704a4b13e22b8cd553b7f83f6
--- /dev/null
+++ b/content/public/browser/midi_permission_context.h
@@ -0,0 +1,50 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_MIDI_MIDI_PERMISSION_CONTEXT_H_
+#define CONTENT_BROWSER_MIDI_MIDI_PERMISSION_CONTEXT_H_
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "content/common/content_export.h"
+
+class GURL;
+
+namespace content {
+
+typedef base::Callback<void(bool)> MIDISysExPermissionCallback;
+
+// MidiPermissionContext must be implemented by the embedder, to provide
+// the policy and logic for the Midi permissions flow.
+// This includes both prompting the user and persisting results, as required.
+class CONTENT_EXPORT MidiPermissionContext
+ : public base::RefCountedThreadSafe<MidiPermissionContext> {
jam 2013/10/24 16:15:26 does this have to be ref counted? please avoid ref
Kibeom Kim (inactive) 2013/10/24 19:36:26 Done.
+ public:
+ // The renderer is requesting permission to use Midi.
+ // When the answer to a permission request has been determined, |callback|
+ // should be called with the result.
+ virtual void RequestMIDISysExPermission(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame,
+ const MIDISysExPermissionCallback& callback) = 0;
+
+ // The renderer is cancelling a pending permission request.
+ virtual void CancelMIDISysExPermissionRequest(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame) = 0;
+
+ protected:
+ virtual ~MidiPermissionContext() {}
Bernhard Bauer 2013/10/24 07:42:04 Nit: one less space
Kibeom Kim (inactive) 2013/10/24 19:36:26 Done.
+
+ private:
+ friend class base::RefCountedThreadSafe<MidiPermissionContext>;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MIDI_MIDI_CONTEXT_H_

Powered by Google App Engine
This is Rietveld 408576698