Chromium Code Reviews| Index: chrome/browser/permissions/grouped_permission_infobar_delegate.h |
| diff --git a/chrome/browser/permissions/grouped_permission_infobar_delegate.h b/chrome/browser/permissions/grouped_permission_infobar_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9748e310f8bf37b98b619bfb3568c79f53a61983 |
| --- /dev/null |
| +++ b/chrome/browser/permissions/grouped_permission_infobar_delegate.h |
| @@ -0,0 +1,58 @@ |
| +// 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_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ |
| +#define CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/callback.h" |
| +#include "components/content_settings/core/common/content_settings_types.h" |
| +#include "components/infobars/core/confirm_infobar_delegate.h" |
| + |
| +class GURL; |
| +class InfoBarService; |
| + |
| +namespace infobars { |
| +class InfoBarManager; |
| +} |
| + |
| +// Configures an InfoBar to display a group of permission requests, each of |
| +// which can be allowed or blocked independently. |
| +// TODO(tsergeant): Expand this class so it can be used without subclassing. |
| +class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { |
| + public: |
| + // Implementation is in platform-specific infobar file. |
| + static std::unique_ptr<infobars::InfoBar> CreateInfoBar( |
| + infobars::InfoBarManager* infobar_manager, |
| + std::unique_ptr<GroupedPermissionInfoBarDelegate> delegate); |
| + |
| + GroupedPermissionInfoBarDelegate( |
| + const GURL& requesting_origin, |
| + const std::vector<ContentSettingsType>& types); |
| + ~GroupedPermissionInfoBarDelegate() override; |
| + |
| + // Message text that displays at the top of the infobar. |
| + base::string16 GetMessageText() const override; |
| + |
| + int GetPermissionCount() const; |
| + ContentSettingsType GetContentSettingType(int index) const; |
| + int GetIconIdForPermission(int index) const; |
| + // Message text to display for an individual permission at |index|. |
| + base::string16 GetMessageTextFragment(int index) const; |
| + |
| + private: |
| + // ConfirmInfoBarDelegate: |
| + base::string16 GetButtonLabel(InfoBarButton button) const override; |
| + |
| + // InfoBarDelegate: |
| + Type GetInfoBarType() const override; |
| + |
| + GURL requesting_origin_; |
|
gone
2016/04/19 19:54:32
Also const?
tsergeant
2016/04/20 07:26:17
Done.
|
| + const std::vector<ContentSettingsType> types_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ |