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

Unified Diff: chrome/browser/permissions/permission_dialog_delegate.h

Issue 2808003002: Start wiring up modal dialog experiment in PermissionRequestManager codepath (Closed)
Patch Set: upd comment Created 3 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: chrome/browser/permissions/permission_dialog_delegate.h
diff --git a/chrome/browser/permissions/permission_dialog_delegate.h b/chrome/browser/permissions/permission_dialog_delegate.h
index f57ccd1219dd18d457fbecb50f0c5e669c72871a..3ae24d7e2a6bf22376e53c0c32540ec6ab4bd570 100644
--- a/chrome/browser/permissions/permission_dialog_delegate.h
+++ b/chrome/browser/permissions/permission_dialog_delegate.h
@@ -10,6 +10,7 @@
#include "base/android/scoped_java_ref.h"
#include "base/callback.h"
#include "base/macros.h"
+#include "chrome/browser/permissions/permission_prompt_android.h"
#include "chrome/browser/permissions/permission_util.h"
#include "components/content_settings/core/common/content_settings_types.h"
@@ -30,15 +31,20 @@ class TabAndroid;
// the native to Java interface to allow Java to communicate the user's
// decision.
//
-// This class currently wraps a PermissionInfoBarDelegate. Future refactoring
-// will consolidate PermissionInfoBarDelegate and its subclasses together into
-// GroupedPermissionInfoBarDelegate, which will then source all of its data from
-// an underlying PermissionPromptAndroid object. At that time, this class will
-// also change to wrap a PermissionPromptAndroid.
+// This class owns a PermissionInfoBarDelegate if the PermissionRequestManager
+// is disabled and points to a PermissionPromptAndroid if it's enabled. When the
+// PermissionRequestManager is enabled by default, we can remove the code path
+// for using a PermissionInfoBarDelegate.
raymes 2017/04/11 02:50:35 nit: can you add a bug link here?
Timothy Loh 2017/05/24 03:30:22 Done.
+//
+// TODO(timloh): Make this a WebContentsObserver so we can remove this if the
raymes 2017/04/11 02:50:35 nit: can you clarify what "this" means here
Timothy Loh 2017/05/24 03:30:22 Done.
+// page navigates under us.
class PermissionDialogDelegate {
public:
using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>;
+ static void Create(content::WebContents* web_contents,
+ PermissionPromptAndroid* permission_prompt);
raymes 2017/04/11 02:50:35 nit: could you add more documentation on when each
Timothy Loh 2017/05/24 03:30:22 Done.
+
// Creates a modal dialog for |type|.
static void Create(content::WebContents* web_contents,
ContentSettingsType type,
@@ -71,20 +77,25 @@ class PermissionDialogDelegate {
void Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj);
private:
+ PermissionDialogDelegate(TabAndroid* tab,
+ PermissionPromptAndroid* permission_prompt);
PermissionDialogDelegate(
TabAndroid* tab,
std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate_);
~PermissionDialogDelegate();
+ void Init();
+
ScopedJavaLocalRef<jobject> CreateJavaDelegate(JNIEnv* env);
TabAndroid* tab_;
- // The InfoBarDelegate which this class is wrapping.
- // TODO(dominickn,lshang) replace this with PermissionPromptAndroid as the
- // permission prompt refactoring continues.
+ // TODO(timloh): Remove this when the refactoring is finished and we can
+ // delete the PermissionQueueController.
std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate_;
+ PermissionPromptAndroid* permission_prompt_;
raymes 2017/04/11 02:50:35 nit: could you make a comment on the lifetime of t
Timothy Loh 2017/05/24 03:30:22 Done.
+
DISALLOW_COPY_AND_ASSIGN(PermissionDialogDelegate);
};

Powered by Google App Engine
This is Rietveld 408576698