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

Side by Side Diff: android_webview/native/permission/permission_request_handler.h

Issue 239793002: Handle media access permission request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments, added unittests Created 6 years, 8 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H
6 #define ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H
7
8 #include <vector>
9
10 #include "android_webview/native/permission/permission_request_handler_client.h"
11
12 namespace android_webview {
13
14 // This class is used to send the permission requests, or cancel ongoing
15 // requests.
16 // It is owned by AwContents and has 1x1 mapping to AwContents. All methods
17 // are running on UI thread.
18 class PermissionRequestHandler {
19 public:
20 PermissionRequestHandler(PermissionRequestHandlerClient* aw_contents);
21 virtual ~PermissionRequestHandler();
22
23 // Send the given |request| to AwContentsClient.
24 void SendRequest(const scoped_refptr<AwPermissionRequest>& request);
25
26 // Cancel the ongoing request initiated by |origin| for accessing |resources|.
27 void CancelRequest(const GURL& origin, int64 resources);
28
29 private:
30 friend class TestPermissionRequestHandler;
31
32 // Called by AwPermissionRequest when request was handled.
33 void NotifyRequestProcessed(scoped_refptr<AwPermissionRequest> request);
34
35 typedef std::vector<scoped_refptr<AwPermissionRequest> >::iterator
36 RequestIterator;
37
38 // Return the request initiated by |origin| for accessing |resources|.
39 RequestIterator FindRequest(const GURL& origin, int64 resources);
40
41 // Cancel the given request.
42 void CancelRequest(RequestIterator i);
43
44 // The associated AwContents.
45 PermissionRequestHandlerClient* client_;
46
47 // A list of ongoing requests.
48 std::vector<scoped_refptr<AwPermissionRequest> > requests_;
49
50 DISALLOW_COPY_AND_ASSIGN(PermissionRequestHandler);
51 };
52
53 } // namespace android_webivew
54
55 #endif // ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698