OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // Implementation is in platform-specific infobar file. | 26 // Implementation is in platform-specific infobar file. |
27 static std::unique_ptr<infobars::InfoBar> CreateInfoBar( | 27 static std::unique_ptr<infobars::InfoBar> CreateInfoBar( |
28 infobars::InfoBarManager* infobar_manager, | 28 infobars::InfoBarManager* infobar_manager, |
29 std::unique_ptr<GroupedPermissionInfoBarDelegate> delegate); | 29 std::unique_ptr<GroupedPermissionInfoBarDelegate> delegate); |
30 | 30 |
31 GroupedPermissionInfoBarDelegate( | 31 GroupedPermissionInfoBarDelegate( |
32 const GURL& requesting_origin, | 32 const GURL& requesting_origin, |
33 const std::vector<ContentSettingsType>& types); | 33 const std::vector<ContentSettingsType>& types); |
34 ~GroupedPermissionInfoBarDelegate() override; | 34 ~GroupedPermissionInfoBarDelegate() override; |
35 | 35 |
36 bool ShouldShowPersistenceToggle() const; | |
37 bool persist() const { return persist_; } | |
38 void set_persist(bool persist) { persist_ = persist; } | |
39 | |
40 base::string16 GetMessageText() const override; | 36 base::string16 GetMessageText() const override; |
41 | 37 |
42 int GetPermissionCount() const; | 38 int GetPermissionCount() const; |
43 ContentSettingsType GetContentSettingType(int index) const; | 39 ContentSettingsType GetContentSettingType(int index) const; |
44 int GetIconIdForPermission(int index) const; | 40 int GetIconIdForPermission(int index) const; |
45 // Message text to display for an individual permission at |index|. | 41 // Message text to display for an individual permission at |index|. |
46 base::string16 GetMessageTextFragment(int index) const; | 42 base::string16 GetMessageTextFragment(int index) const; |
47 | 43 |
48 void ToggleAccept(int position, bool new_value); | 44 void ToggleAccept(int position, bool new_value); |
49 | 45 |
50 protected: | 46 protected: |
51 bool GetAcceptState(int position); | 47 bool GetAcceptState(int position); |
52 | 48 |
53 private: | 49 private: |
54 // ConfirmInfoBarDelegate: | 50 // ConfirmInfoBarDelegate: |
55 base::string16 GetButtonLabel(InfoBarButton button) const override; | 51 base::string16 GetButtonLabel(InfoBarButton button) const override; |
56 int GetButtons() const override; | 52 int GetButtons() const override; |
57 | 53 |
58 // InfoBarDelegate: | 54 // InfoBarDelegate: |
59 Type GetInfoBarType() const override; | 55 Type GetInfoBarType() const override; |
60 | 56 |
61 const GURL requesting_origin_; | 57 const GURL requesting_origin_; |
62 const std::vector<ContentSettingsType> types_; | 58 const std::vector<ContentSettingsType> types_; |
63 std::vector<bool> accept_states_; | 59 std::vector<bool> accept_states_; |
64 bool persist_; | |
65 | 60 |
66 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate); | 61 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate); |
67 }; | 62 }; |
68 | 63 |
69 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ | 64 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ |
OLD | NEW |