OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_PERMISSIONS_PERMISSION_DIALOG_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_DIALOG_DELEGATE_H_ |
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_DIALOG_DELEGATE_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_DIALOG_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
13 #include "chrome/browser/permissions/permission_util.h" | 14 #include "chrome/browser/permissions/permission_util.h" |
14 #include "components/content_settings/core/common/content_settings_types.h" | 15 #include "components/content_settings/core/common/content_settings_types.h" |
15 | 16 |
16 using base::android::JavaParamRef; | 17 using base::android::JavaParamRef; |
17 using base::android::ScopedJavaLocalRef; | 18 using base::android::ScopedJavaLocalRef; |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 class WebContents; | 21 class WebContents; |
21 } | 22 } |
22 | |
23 class MediaStreamDevicesController; | |
24 class GURL; | 23 class GURL; |
25 class PermissionInfoBarDelegate; | 24 class PermissionInfoBarDelegate; |
26 class Profile; | 25 class Profile; |
27 class TabAndroid; | 26 class TabAndroid; |
28 | 27 |
29 // Delegate class for displaying a permission prompt as a modal dialog. Used as | 28 // Delegate class for displaying a permission prompt as a modal dialog. Used as |
30 // the native to Java interface to allow Java to communicate the user's | 29 // the native to Java interface to allow Java to communicate the user's |
31 // decision. | 30 // decision. |
32 // | 31 // |
33 // This class currently wraps a PermissionInfoBarDelegate. Future refactoring | 32 // This class currently wraps a PermissionInfoBarDelegate. Future refactoring |
(...skipping 12 matching lines...) Expand all Loading... |
46 bool user_gesture, | 45 bool user_gesture, |
47 Profile* profile, | 46 Profile* profile, |
48 const PermissionSetCallback& callback); | 47 const PermissionSetCallback& callback); |
49 | 48 |
50 // Creates a modal dialog for a media stream permission request. | 49 // Creates a modal dialog for a media stream permission request. |
51 // TODO(dominickn): remove this when media stream requests are eventually | 50 // TODO(dominickn): remove this when media stream requests are eventually |
52 // folded in with other permission requests. | 51 // folded in with other permission requests. |
53 static void CreateMediaStreamDialog( | 52 static void CreateMediaStreamDialog( |
54 content::WebContents* web_contents, | 53 content::WebContents* web_contents, |
55 bool user_gesture, | 54 bool user_gesture, |
56 std::unique_ptr<MediaStreamDevicesController> controller); | 55 std::unique_ptr<MediaStreamDevicesController::Request> request); |
57 | 56 |
58 // Returns true if we should show the user a modal permission prompt rather | 57 // Returns true if we should show the user a modal permission prompt rather |
59 // than an infobar. | 58 // than an infobar. |
60 static bool ShouldShowDialog(bool has_user_gesture); | 59 static bool ShouldShowDialog(bool has_user_gesture); |
61 | 60 |
62 // JNI methods. | 61 // JNI methods. |
63 static bool RegisterPermissionDialogDelegate(JNIEnv* env); | 62 static bool RegisterPermissionDialogDelegate(JNIEnv* env); |
64 void Accept(JNIEnv* env, const JavaParamRef<jobject>& obj, jboolean persist); | 63 void Accept(JNIEnv* env, const JavaParamRef<jobject>& obj, jboolean persist); |
65 void Cancel(JNIEnv* env, const JavaParamRef<jobject>& obj, jboolean persist); | 64 void Cancel(JNIEnv* env, const JavaParamRef<jobject>& obj, jboolean persist); |
66 void Dismissed(JNIEnv* env, const JavaParamRef<jobject>& obj); | 65 void Dismissed(JNIEnv* env, const JavaParamRef<jobject>& obj); |
(...skipping 15 matching lines...) Expand all Loading... |
82 | 81 |
83 // The InfoBarDelegate which this class is wrapping. | 82 // The InfoBarDelegate which this class is wrapping. |
84 // TODO(dominickn,lshang) replace this with PermissionPromptAndroid as the | 83 // TODO(dominickn,lshang) replace this with PermissionPromptAndroid as the |
85 // permission prompt refactoring continues. | 84 // permission prompt refactoring continues. |
86 std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate_; | 85 std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate_; |
87 | 86 |
88 DISALLOW_COPY_AND_ASSIGN(PermissionDialogDelegate); | 87 DISALLOW_COPY_AND_ASSIGN(PermissionDialogDelegate); |
89 }; | 88 }; |
90 | 89 |
91 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DIALOG_DELEGATE_H_ | 90 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DIALOG_DELEGATE_H_ |
OLD | NEW |