| 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" | |
| 15 | 14 |
| 16 using base::android::JavaParamRef; | 15 using base::android::JavaParamRef; |
| 17 using base::android::ScopedJavaLocalRef; | 16 using base::android::ScopedJavaLocalRef; |
| 18 | 17 |
| 19 namespace content { | 18 namespace content { |
| 20 class WebContents; | 19 class WebContents; |
| 21 } | 20 } |
| 22 | 21 |
| 23 class MediaStreamDevicesController; | 22 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 |
| 34 // will consolidate PermissionInfoBarDelegate and its subclasses together into | 33 // will consolidate PermissionInfoBarDelegate and its subclasses together into |
| 35 // GroupedPermissionInfoBarDelegate, which will then source all of its data from | 34 // GroupedPermissionInfoBarDelegate, which will then source all of its data from |
| 36 // an underlying PermissionPromptAndroid object. At that time, this class will | 35 // an underlying PermissionPromptAndroid object. At that time, this class will |
| 37 // also change to wrap a PermissionPromptAndroid. | 36 // also change to wrap a PermissionPromptAndroid. |
| 38 class PermissionDialogDelegate { | 37 class PermissionDialogDelegate { |
| 39 public: | 38 public: |
| 40 using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>; | 39 using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>; |
| 41 | 40 |
| 42 // Creates a modal dialog for |type|. | 41 // Creates a modal dialog for |type|. |
| 43 static void Create(content::WebContents* web_contents, | 42 static void Create(content::WebContents* web_contents, |
| 44 content::PermissionType type, | 43 ContentSettingsType type, |
| 45 const GURL& requesting_frame, | 44 const GURL& requesting_frame, |
| 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, |
| (...skipping 27 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 |