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/permissions/permission_util.h" | 13 #include "chrome/browser/permissions/permission_util.h" |
14 #include "content/public/browser/permission_type.h" | 14 #include "components/content_settings/core/common/content_settings_types.h" |
15 | 15 |
16 using base::android::JavaParamRef; | 16 using base::android::JavaParamRef; |
17 using base::android::ScopedJavaLocalRef; | 17 using base::android::ScopedJavaLocalRef; |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class WebContents; | 20 class WebContents; |
21 } | 21 } |
22 | 22 |
23 class MediaStreamDevicesController; | 23 class MediaStreamDevicesController; |
24 class GURL; | 24 class GURL; |
25 class PermissionInfoBarDelegate; | 25 class PermissionInfoBarDelegate; |
26 class Profile; | 26 class Profile; |
27 class TabAndroid; | 27 class TabAndroid; |
28 | 28 |
29 // Delegate class for displaying a permission prompt as a modal dialog. Used as | 29 // 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 | 30 // the native to Java interface to allow Java to communicate the user's |
31 // decision. | 31 // decision. |
32 // | 32 // |
33 // This class currently wraps a PermissionInfoBarDelegate. Future refactoring | 33 // This class currently wraps a PermissionInfoBarDelegate. Future refactoring |
34 // will consolidate PermissionInfoBarDelegate and its subclasses together into | 34 // will consolidate PermissionInfoBarDelegate and its subclasses together into |
35 // GroupedPermissionInfoBarDelegate, which will then source all of its data from | 35 // GroupedPermissionInfoBarDelegate, which will then source all of its data from |
36 // an underlying PermissionPromptAndroid object. At that time, this class will | 36 // an underlying PermissionPromptAndroid object. At that time, this class will |
37 // also change to wrap a PermissionPromptAndroid. | 37 // also change to wrap a PermissionPromptAndroid. |
38 class PermissionDialogDelegate { | 38 class PermissionDialogDelegate { |
39 public: | 39 public: |
40 using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>; | 40 using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>; |
41 | 41 |
42 // Creates a modal dialog for |type|. | 42 // Creates a modal dialog for |type|. |
43 static void Create(content::WebContents* web_contents, | 43 static void Create(content::WebContents* web_contents, |
44 content::PermissionType type, | 44 ContentSettingsType type, |
45 const GURL& requesting_frame, | 45 const GURL& requesting_frame, |
46 bool user_gesture, | 46 bool user_gesture, |
47 Profile* profile, | 47 Profile* profile, |
48 const PermissionSetCallback& callback); | 48 const PermissionSetCallback& callback); |
49 | 49 |
50 // Creates a modal dialog for a media stream permission request. | 50 // Creates a modal dialog for a media stream permission request. |
51 // TODO(dominickn): remove this when media stream requests are eventually | 51 // TODO(dominickn): remove this when media stream requests are eventually |
52 // folded in with other permission requests. | 52 // folded in with other permission requests. |
53 static void CreateMediaStreamDialog( | 53 static void CreateMediaStreamDialog( |
54 content::WebContents* web_contents, | 54 content::WebContents* web_contents, |
(...skipping 27 matching lines...) Expand all Loading... |
82 | 82 |
83 // The InfoBarDelegate which this class is wrapping. | 83 // The InfoBarDelegate which this class is wrapping. |
84 // TODO(dominickn,lshang) replace this with PermissionPromptAndroid as the | 84 // TODO(dominickn,lshang) replace this with PermissionPromptAndroid as the |
85 // permission prompt refactoring continues. | 85 // permission prompt refactoring continues. |
86 std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate_; | 86 std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(PermissionDialogDelegate); | 88 DISALLOW_COPY_AND_ASSIGN(PermissionDialogDelegate); |
89 }; | 89 }; |
90 | 90 |
91 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DIALOG_DELEGATE_H_ | 91 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DIALOG_DELEGATE_H_ |
OLD | NEW |