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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/native/permission/permission_request_handler.h
diff --git a/android_webview/native/permission/permission_request_handler.h b/android_webview/native/permission/permission_request_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..e11382c06d7779e2f5faeab409abdd9abb5e08e8
--- /dev/null
+++ b/android_webview/native/permission/permission_request_handler.h
@@ -0,0 +1,56 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H
+#define ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H
+
+#include <vector>
+
+#include "android_webview/native/permission/aw_permission_request.h"
+#include "base/memory/ref_counted.h"
+
+namespace android_webview {
+
+class AwContents;
+
+// This class is used to send the permission requests, or cancel ongoing
+// requests.
+// It is owned by AwContents and has 1x1 mapping to AwContents. All methods
+// are running on UI thread.
+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!
+ public:
+ PermissionRequestHandler(AwContents* aw_contents);
+ virtual ~PermissionRequestHandler();
+
+ // Send the given |request| to AwContentsClient.
+ void SendRequest(scoped_refptr<AwPermissionRequest> request);
benm (inactive) 2014/04/16 14:51:10 const &
michaelbai 2014/04/22 20:53:51 Done.
+
+ // Cancel the ongoing request initiated by |origin| for accessing |resources|.
+ 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
+
+ private:
+ // Called by AwPermissionRequest when request was handled.
+ void OnRequestProcessed(scoped_refptr<AwPermissionRequest> request);
+
+ typedef std::vector<scoped_refptr<AwPermissionRequest> >::iterator
+ RequestIterator;
+
+ // Return the request initiated by |origin| for accessing |resources|.
+ RequestIterator FindRequest(const GURL& origin, int64 resources);
+
+ // Cancel the given request.
+ 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
+
+ // The associated AwContents.
+ AwContents* aw_contents_;
+
+ // A list of ongoing requests.
+ std::vector<scoped_refptr<AwPermissionRequest> > requests_;
+
+ DISALLOW_COPY_AND_ASSIGN(PermissionRequestHandler);
+};
+
+} // namespace android_webivew
+
+#endif // ANDROID_WEBVIEW_NATIVE_PERMISSION_PERMISSION_REQUEST_HANDLER_H

Powered by Google App Engine
This is Rietveld 408576698