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

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: fix error, landed it again Created 6 years, 7 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 "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "url/gurl.h"
13
14 namespace android_webview {
15
16 class AwPermissionRequest;
17 class AwPermissionRequestDelegate;
18 class PermissionRequestHandlerClient;
19
20 // This class is used to send the permission requests, or cancel ongoing
21 // requests.
22 // It is owned by AwContents and has 1x1 mapping to AwContents. All methods
23 // are running on UI thread.
24 class PermissionRequestHandler {
25 public:
26 PermissionRequestHandler(PermissionRequestHandlerClient* aw_contents);
27 virtual ~PermissionRequestHandler();
28
29 // Send the given |request| to PermissionRequestHandlerClient.
30 void SendRequest(scoped_ptr<AwPermissionRequestDelegate> request);
31
32 // Cancel the ongoing request initiated by |origin| for accessing |resources|.
33 void CancelRequest(const GURL& origin, int64 resources);
34
35 private:
36 friend class TestPermissionRequestHandler;
37
38 typedef std::vector<base::WeakPtr<AwPermissionRequest> >::iterator
39 RequestIterator;
40
41 // Return the request initiated by |origin| for accessing |resources|.
42 RequestIterator FindRequest(const GURL& origin, int64 resources);
43
44 // Cancel the given request.
45 void CancelRequest(RequestIterator i);
46
47 // Remove the invalid requests from requests_.
48 void PruneRequests();
49
50 PermissionRequestHandlerClient* client_;
51
52 // A list of ongoing requests.
53 std::vector<base::WeakPtr<AwPermissionRequest> > requests_;
54
55 DISALLOW_COPY_AND_ASSIGN(PermissionRequestHandler);
56 };
57
58 } // namespace android_webivew
59
60 #endif // ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698