OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ | |
6 #define CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/callback.h" | |
11 #include "components/content_settings/core/common/content_settings_types.h" | |
12 #include "components/infobars/core/confirm_infobar_delegate.h" | |
13 | |
14 class GURL; | |
15 class InfoBarService; | |
16 | |
17 namespace infobars { | |
18 class InfoBarManager; | |
19 } | |
20 | |
21 // Configures an InfoBar to display a group of permission requests, each of | |
22 // which can be allowed or blocked independently. | |
23 // TODO(tsergeant): Expand this class so it can be used without subclassing. | |
24 class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { | |
25 public: | |
26 // Implementation is in platform-specific infobar file. | |
27 static std::unique_ptr<infobars::InfoBar> CreateInfoBar( | |
28 infobars::InfoBarManager* infobar_manager, | |
29 std::unique_ptr<GroupedPermissionInfoBarDelegate> delegate); | |
30 | |
31 GroupedPermissionInfoBarDelegate( | |
32 const GURL& requesting_origin, | |
33 const std::vector<ContentSettingsType>& types); | |
34 ~GroupedPermissionInfoBarDelegate() override; | |
35 | |
36 // Message text that displays at the top of the infobar. | |
37 base::string16 GetMessageText() const override; | |
38 | |
39 int GetPermissionCount() const; | |
40 ContentSettingsType GetContentSettingType(int index) const; | |
41 int GetIconIdForPermission(int index) const; | |
42 // Message text to display for an individual permission at |index|. | |
43 base::string16 GetMessageTextFragment(int index) const; | |
44 | |
45 private: | |
46 // ConfirmInfoBarDelegate: | |
47 base::string16 GetButtonLabel(InfoBarButton button) const override; | |
48 | |
49 // InfoBarDelegate: | |
50 Type GetInfoBarType() const override; | |
51 | |
52 GURL requesting_origin_; | |
gone
2016/04/19 19:54:32
Also const?
tsergeant
2016/04/20 07:26:17
Done.
| |
53 const std::vector<ContentSettingsType> types_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate); | |
56 }; | |
57 | |
58 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ | |
OLD | NEW |