simple_permission_request.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #ifndef ANDROID_WEBVIEW_BROWSER_PERMISSION_SIMPLE_PERMISSION_REQUEST_H_
  5. #define ANDROID_WEBVIEW_BROWSER_PERMISSION_SIMPLE_PERMISSION_REQUEST_H_
  6. #include <stdint.h>
  7. #include "android_webview/browser/permission/aw_permission_request_delegate.h"
  8. #include "android_webview/browser/permission/permission_callback.h"
  9. #include "base/callback.h"
  10. namespace android_webview {
  11. // The class is used to handle the simple permission request which just needs
  12. // a callback with bool parameter to indicate the permission granted or not.
  13. class SimplePermissionRequest : public AwPermissionRequestDelegate {
  14. public:
  15. SimplePermissionRequest(const GURL& origin,
  16. int64_t resources,
  17. PermissionCallback callback);
  18. SimplePermissionRequest(const SimplePermissionRequest&) = delete;
  19. SimplePermissionRequest& operator=(const SimplePermissionRequest&) = delete;
  20. ~SimplePermissionRequest() override;
  21. // AwPermissionRequestDelegate implementation.
  22. const GURL& GetOrigin() override;
  23. int64_t GetResources() override;
  24. void NotifyRequestResult(bool allowed) override;
  25. private:
  26. const GURL origin_;
  27. int64_t resources_;
  28. PermissionCallback callback_;
  29. };
  30. } // namespace android_webview
  31. #endif // ANDROID_WEBVIEW_BROWSER_PERMISSION_SIMPLE_PERMISSION_REQUEST_H_