OLD | NEW |
---|---|
(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/aw_permission_request.h" | |
11 #include "base/memory/ref_counted.h" | |
12 | |
13 namespace android_webview { | |
14 | |
15 class AwContents; | |
16 | |
17 // This class is used to send the permission requests, or cancel ongoing | |
18 // requests. | |
19 // It is owned by AwContents and has 1x1 mapping to AwContents. All methods | |
20 // are running on UI thread. | |
21 class PermissionRequestHandler { | |
mkosiba (inactive)
2014/04/17 10:34:06
this class could have a native (C++) unittest
michaelbai
2014/04/22 20:53:51
Done.
mkosiba (inactive)
2014/04/23 18:04:40
appreciated. thanks!
| |
22 public: | |
23 PermissionRequestHandler(AwContents* aw_contents); | |
24 virtual ~PermissionRequestHandler(); | |
25 | |
26 // Send the given |request| to AwContentsClient. | |
27 void SendRequest(scoped_refptr<AwPermissionRequest> request); | |
benm (inactive)
2014/04/16 14:51:10
const &
michaelbai
2014/04/22 20:53:51
Done.
| |
28 | |
29 // Cancel the ongoing request initiated by |origin| for accessing |resources|. | |
30 void CancelRequest(const GURL& origin, int64 resources); | |
mkosiba (inactive)
2014/04/17 10:34:06
doesn't look like anyone calls this.
michaelbai
2014/04/22 20:53:51
Yes, this method is here for migrating geolocation
| |
31 | |
32 private: | |
33 // Called by AwPermissionRequest when request was handled. | |
34 void OnRequestProcessed(scoped_refptr<AwPermissionRequest> request); | |
35 | |
36 typedef std::vector<scoped_refptr<AwPermissionRequest> >::iterator | |
37 RequestIterator; | |
38 | |
39 // Return the request initiated by |origin| for accessing |resources|. | |
40 RequestIterator FindRequest(const GURL& origin, int64 resources); | |
41 | |
42 // Cancel the given request. | |
43 void CancelRequest(RequestIterator i); | |
benm (inactive)
2014/04/16 14:51:10
Are there any callers for this now?
I think we'd
michaelbai
2014/04/22 20:53:51
The geolocation has cancel method, see Geolocation
| |
44 | |
45 // The associated AwContents. | |
46 AwContents* aw_contents_; | |
47 | |
48 // A list of ongoing requests. | |
49 std::vector<scoped_refptr<AwPermissionRequest> > requests_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(PermissionRequestHandler); | |
52 }; | |
53 | |
54 } // namespace android_webivew | |
55 | |
56 #endif // ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H | |
OLD | NEW |