| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H | 5 #ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H |
| 6 #define ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H | 6 #define ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Allow |origin| to access the |resources|. | 41 // Allow |origin| to access the |resources|. |
| 42 void PreauthorizePermission(const GURL& origin, int64_t resources); | 42 void PreauthorizePermission(const GURL& origin, int64_t resources); |
| 43 | 43 |
| 44 // WebContentsObserver | 44 // WebContentsObserver |
| 45 void NavigationEntryCommitted( | 45 void NavigationEntryCommitted( |
| 46 const content::LoadCommittedDetails& load_details) override; | 46 const content::LoadCommittedDetails& load_details) override; |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 friend class TestPermissionRequestHandler; | 49 friend class TestPermissionRequestHandler; |
| 50 | 50 |
| 51 typedef std::vector<base::WeakPtr<AwPermissionRequest> >::iterator | 51 typedef std::vector<base::WeakPtr<AwPermissionRequest>>::iterator |
| 52 RequestIterator; | 52 RequestIterator; |
| 53 | 53 |
| 54 // Return the request initiated by |origin| for accessing |resources|. | 54 // Return the request initiated by |origin| for accessing |resources|. |
| 55 RequestIterator FindRequest(const GURL& origin, int64_t resources); | 55 RequestIterator FindRequest(const GURL& origin, int64_t resources); |
| 56 | 56 |
| 57 // Cancel the given request. | 57 // Cancel the given request. |
| 58 void CancelRequestInternal(RequestIterator i); | 58 void CancelRequestInternal(RequestIterator i); |
| 59 | 59 |
| 60 void CancelAllRequests(); | 60 void CancelAllRequests(); |
| 61 | 61 |
| 62 // Remove the invalid requests from requests_. | 62 // Remove the invalid requests from requests_. |
| 63 void PruneRequests(); | 63 void PruneRequests(); |
| 64 | 64 |
| 65 // Return true if |origin| were preauthorized to access |resources|. | 65 // Return true if |origin| were preauthorized to access |resources|. |
| 66 bool Preauthorized(const GURL& origin, int64_t resources); | 66 bool Preauthorized(const GURL& origin, int64_t resources); |
| 67 | 67 |
| 68 PermissionRequestHandlerClient* client_; | 68 PermissionRequestHandlerClient* client_; |
| 69 | 69 |
| 70 // A list of ongoing requests. | 70 // A list of ongoing requests. |
| 71 std::vector<base::WeakPtr<AwPermissionRequest> > requests_; | 71 std::vector<base::WeakPtr<AwPermissionRequest>> requests_; |
| 72 | 72 |
| 73 std::map<std::string, int64_t> preauthorized_permission_; | 73 std::map<std::string, int64_t> preauthorized_permission_; |
| 74 | 74 |
| 75 // The unique id of the active NavigationEntry of the WebContents that we were | 75 // The unique id of the active NavigationEntry of the WebContents that we were |
| 76 // opened for. Used to help expire on requests. | 76 // opened for. Used to help expire on requests. |
| 77 int contents_unique_id_; | 77 int contents_unique_id_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(PermissionRequestHandler); | 79 DISALLOW_COPY_AND_ASSIGN(PermissionRequestHandler); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace android_webivew | 82 } // namespace android_webivew |
| 83 | 83 |
| 84 #endif // ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H | 84 #endif // ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H |
| OLD | NEW |