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

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

Issue 2808003002: Start wiring up modal dialog experiment in PermissionRequestManager codepath (Closed)
Patch Set: fix bad rebase Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_dialog_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9b699eeaa33fb5e2b9977b0ed370bfcf937c3bf8..e1a3ab52cf2bacbc8df40b16eec3799b2da4e428 100644
--- a/chrome/browser/permissions/permission_dialog_delegate.h
+++ b/chrome/browser/permissions/permission_dialog_delegate.h
@@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "chrome/browser/media/webrtc/media_stream_devices_controller.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"
#include "content/public/browser/web_contents_observer.h"
@@ -29,16 +30,21 @@ 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. This is tracked in crbug.com/606138.
class PermissionDialogDelegate : public content::WebContentsObserver {
public:
using PermissionSetCallback = base::Callback<void(bool, PermissionAction)>;
- // Creates a modal dialog for |type|.
+ // The interface for creating a modal dialog when the PermissionRequestManager
+ // is enabled.
+ static void Create(content::WebContents* web_contents,
+ PermissionPromptAndroid* permission_prompt);
+
+ // The interface for creating a modal dialog when the PermissionRequestManager
+ // is disabled, i.e. we're using the PermissionQueueController.
static void Create(content::WebContents* web_contents,
ContentSettingsType type,
const GURL& requesting_frame,
@@ -72,7 +78,8 @@ class PermissionDialogDelegate : public content::WebContentsObserver {
private:
PermissionDialogDelegate(
TabAndroid* tab,
- std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate_);
+ std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate,
+ PermissionPromptAndroid* permission_prompt);
~PermissionDialogDelegate() override;
void CreateJavaDelegate(JNIEnv* env);
@@ -89,11 +96,15 @@ class PermissionDialogDelegate : public content::WebContentsObserver {
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_;
+ // The PermissionPromptAndroid is alive until the tab navigates or is closed.
+ // We close the prompt on DidFinishNavigation and WebContentsDestroyed, so it
+ // should always be safe to use this pointer.
+ PermissionPromptAndroid* permission_prompt_;
+
DISALLOW_COPY_AND_ASSIGN(PermissionDialogDelegate);
};
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_dialog_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698