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

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

Issue 185863003: [Media] Add user gesture reporting for API calls to midi and media streams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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"
(...skipping 15 matching lines...) Expand all
26 26
27 // BrowserContextKeyedService methods: 27 // BrowserContextKeyedService methods:
28 virtual void Shutdown() OVERRIDE; 28 virtual void Shutdown() OVERRIDE;
29 29
30 // Request to ask users permission about MIDI. 30 // Request to ask users permission about MIDI.
31 void RequestMidiSysExPermission( 31 void RequestMidiSysExPermission(
32 int render_process_id, 32 int render_process_id,
33 int render_view_id, 33 int render_view_id,
34 int bridge_id, 34 int bridge_id,
35 const GURL& requesting_frame, 35 const GURL& requesting_frame,
36 bool user_gesture,
36 const content::BrowserContext::MidiSysExPermissionCallback& callback); 37 const content::BrowserContext::MidiSysExPermissionCallback& callback);
37 38
38 // Cancel a pending MIDI permission request. 39 // Cancel a pending MIDI permission request.
39 void CancelMidiSysExPermissionRequest(int render_process_id, 40 void CancelMidiSysExPermissionRequest(int render_process_id,
40 int render_view_id, 41 int render_view_id,
41 int bridge_id, 42 int bridge_id,
42 const GURL& requesting_frame); 43 const GURL& requesting_frame);
43 44
44 // Called when the permission decision is made. If a permissions prompt is 45 // Called when the permission decision is made. If a permissions prompt is
45 // shown to the user it will be called when the user selects an option 46 // shown to the user it will be called when the user selects an option
46 // from that prompt. 47 // from that prompt.
47 void NotifyPermissionSet( 48 void NotifyPermissionSet(
48 const PermissionRequestID& id, 49 const PermissionRequestID& id,
49 const GURL& requesting_frame, 50 const GURL& requesting_frame,
50 const content::BrowserContext::MidiSysExPermissionCallback& callback, 51 const content::BrowserContext::MidiSysExPermissionCallback& callback,
51 bool allowed); 52 bool allowed);
52 53
53 private: 54 private:
54 // Decide whether the permission should be granted. 55 // Decide whether the permission should be granted.
55 // Calls PermissionDecided if permission can be decided non-interactively, 56 // Calls PermissionDecided if permission can be decided non-interactively,
56 // or NotifyPermissionSet if permission decided by presenting an infobar. 57 // or NotifyPermissionSet if permission decided by presenting an infobar.
57 void DecidePermission( 58 void DecidePermission(
58 content::WebContents* web_contents, 59 content::WebContents* web_contents,
59 const PermissionRequestID& id, 60 const PermissionRequestID& id,
60 const GURL& requesting_frame, 61 const GURL& requesting_frame,
61 const GURL& embedder, 62 const GURL& embedder,
63 bool user_gesture,
62 const content::BrowserContext::MidiSysExPermissionCallback& callback); 64 const content::BrowserContext::MidiSysExPermissionCallback& callback);
63 65
64 // Called when permission is granted without interactively asking the user. 66 // Called when permission is granted without interactively asking the user.
65 void PermissionDecided( 67 void PermissionDecided(
66 const PermissionRequestID& id, 68 const PermissionRequestID& id,
67 const GURL& requesting_frame, 69 const GURL& requesting_frame,
68 const GURL& embedder, 70 const GURL& embedder,
69 const content::BrowserContext::MidiSysExPermissionCallback& callback, 71 const content::BrowserContext::MidiSysExPermissionCallback& callback,
70 bool allowed); 72 bool allowed);
71 73
72 // Return an instance of the infobar queue controller, creating it if needed. 74 // Return an instance of the infobar queue controller, creating it if needed.
73 PermissionQueueController* GetQueueController(); 75 PermissionQueueController* GetQueueController();
74 76
75 // Removes any pending InfoBar request. 77 // Removes any pending InfoBar request.
76 void CancelPendingInfobarRequest(const PermissionRequestID& id); 78 void CancelPendingInfobarRequest(const PermissionRequestID& id);
77 79
78 Profile* const profile_; 80 Profile* const profile_;
79 bool shutting_down_; 81 bool shutting_down_;
80 scoped_ptr<PermissionQueueController> permission_queue_controller_; 82 scoped_ptr<PermissionQueueController> permission_queue_controller_;
81 83
82 DISALLOW_COPY_AND_ASSIGN(ChromeMidiPermissionContext); 84 DISALLOW_COPY_AND_ASSIGN(ChromeMidiPermissionContext);
83 }; 85 };
84 86
85 #endif // CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_ 87 #endif // CHROME_BROWSER_MEDIA_CHROME_MIDI_PERMISSION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698