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

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

Issue 2250053002: Clean up the PermissionInfoBarDelegate hierarchy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-infobar-remember-decision
Patch Set: Created 4 years, 4 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/single_permission_infobar_delegate.h
diff --git a/chrome/browser/permissions/single_permission_infobar_delegate.h b/chrome/browser/permissions/single_permission_infobar_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..b1577c75731673dc42059e38d29bbac0b640ee39
--- /dev/null
+++ b/chrome/browser/permissions/single_permission_infobar_delegate.h
@@ -0,0 +1,61 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PERMISSIONS_SINGLE_PERMISSION_INFOBAR_DELEGATE_H_
+#define CHROME_BROWSER_PERMISSIONS_SINGLE_PERMISSION_INFOBAR_DELEGATE_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "chrome/browser/permissions/permission_infobar_delegate.h"
+#include "chrome/browser/permissions/permission_util.h"
+#include "components/content_settings/core/common/content_settings_types.h"
+#include "content/public/browser/permission_type.h"
+
+class Profile;
+
+// Base class for single permission infobars. Implements the default behavior so
+// that the accept/deny buttons grant/deny the relevant permission.
raymes 2016/08/17 03:20:43 nit: fill 80 chars or new paragraph
dominickn 2016/08/17 03:29:38 Done.
+// A basic implementor only needs to implement the methods that provide an icon
+// and a message text to the infobar.
+class SinglePermissionInfoBarDelegate : public PermissionInfoBarDelegate {
+
+ public:
+ ~SinglePermissionInfoBarDelegate() override;
+ ContentSettingsType GetContentSettingType(int index) const override;
+ bool ShouldShowPersistenceToggle() const override;
+
+ // ConfirmInfoBarDelegate:
+ base::string16 GetMessageText() const override;
raymes 2016/08/17 03:36:40 I think this can be private? It's public in the ba
+
+ protected:
+ SinglePermissionInfoBarDelegate(const GURL& requesting_origin,
+ content::PermissionType permission_type,
+ ContentSettingsType content_settings_type,
+ bool user_gesture,
+ Profile* profile,
+ const PermissionSetCallback& callback);
+
+ virtual int GetMessageResourceId() const = 0;
raymes 2016/08/17 03:36:40 I think this can be private?
+
+ private:
+ void SetPermission(bool update_content_setting, PermissionAction decision);
+
+ // ConfirmInfoBarDelegate:
+ base::string16 GetButtonLabel(InfoBarButton button) const override;
+ bool Accept() override;
+ bool Cancel() override;
+ void InfoBarDismissed() override;
+
+ content::PermissionType permission_type_;
+ ContentSettingsType content_settings_type_;
+ Profile* const profile_;
+ const PermissionSetCallback callback_;
+ bool action_taken_;
+ bool user_gesture_;
+
+ DISALLOW_COPY_AND_ASSIGN(SinglePermissionInfoBarDelegate);
+};
+
+#endif // CHROME_BROWSER_PERMISSIONS_SINGLE_PERMISSION_INFOBAR_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698