| 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_ANDROID_H
_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROID_H
_ |
| 6 #define CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROID_H
_ | 6 #define CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROID_H
_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "components/content_settings/core/common/content_settings_types.h" | 11 #include "components/content_settings/core/common/content_settings_types.h" |
| 12 #include "components/infobars/core/confirm_infobar_delegate.h" | 12 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 class InfoBarService; | 15 class InfoBarService; |
| 16 class PermissionPromptAndroid; | 16 class PermissionPromptAndroid; |
| 17 | 17 |
| 18 // An InfoBar that displays a group of permission requests, each of which can be | 18 // An InfoBar that displays a group of permission requests, each of which can be |
| 19 // allowed or blocked independently. | 19 // allowed or blocked independently. |
| 20 // TODO(tsergeant): Expand this class so it can be used without subclassing. | 20 // TODO(timloh): This is incorrectly named as we've removed grouped permissions, |
| 21 // rename it to PermissionInfoBarDelegate once crbug.com/606138 is done. |
| 21 class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { | 22 class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 22 public: | 23 public: |
| 23 // Public so we can have std::unique_ptr<GroupedPermissionInfoBarDelegate>. | 24 // Public so we can have std::unique_ptr<GroupedPermissionInfoBarDelegate>. |
| 24 ~GroupedPermissionInfoBarDelegate() override; | 25 ~GroupedPermissionInfoBarDelegate() override; |
| 25 | 26 |
| 26 static infobars::InfoBar* Create(PermissionPromptAndroid* permission_prompt, | 27 static infobars::InfoBar* Create(PermissionPromptAndroid* permission_prompt, |
| 27 InfoBarService* infobar_service, | 28 InfoBarService* infobar_service, |
| 28 const GURL& requesting_origin); | 29 const GURL& requesting_origin); |
| 29 | 30 |
| 30 bool persist() const { return persist_; } | 31 bool persist() const { return persist_; } |
| 31 void set_persist(bool persist) { persist_ = persist; } | 32 void set_persist(bool persist) { persist_ = persist; } |
| 32 size_t PermissionCount() const; | 33 size_t PermissionCount() const; |
| 33 | 34 |
| 34 // Returns true if the infobar should display a toggle to allow users to | 35 // Returns true if the infobar should display a toggle to allow users to |
| 35 // opt-out of persisting their accept/deny decision. | 36 // opt-out of persisting their accept/deny decision. |
| 36 bool ShouldShowPersistenceToggle() const; | 37 bool ShouldShowPersistenceToggle() const; |
| 37 | 38 |
| 38 ContentSettingsType GetContentSettingType(size_t position) const; | 39 ContentSettingsType GetContentSettingType(size_t position) const; |
| 39 int GetIconIdForPermission(size_t position) const; | |
| 40 | 40 |
| 41 // Message text to display for an individual permission at |position|. | 41 // InfoBarDelegate: |
| 42 base::string16 GetMessageTextFragment(size_t position) const; | 42 int GetIconId() const override; |
| 43 | 43 |
| 44 // ConfirmInfoBarDelegate: | 44 // ConfirmInfoBarDelegate: |
| 45 base::string16 GetMessageText() const override; | 45 base::string16 GetMessageText() const override; |
| 46 bool Accept() override; | 46 bool Accept() override; |
| 47 bool Cancel() override; | 47 bool Cancel() override; |
| 48 void InfoBarDismissed() override; | 48 void InfoBarDismissed() override; |
| 49 base::string16 GetLinkText() const override; | 49 base::string16 GetLinkText() const override; |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 bool GetAcceptState(size_t position); | 52 bool GetAcceptState(size_t position); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 | 67 |
| 68 const GURL requesting_origin_; | 68 const GURL requesting_origin_; |
| 69 // Whether the accept/deny decision is persisted. | 69 // Whether the accept/deny decision is persisted. |
| 70 bool persist_; | 70 bool persist_; |
| 71 PermissionPromptAndroid* permission_prompt_; | 71 PermissionPromptAndroid* permission_prompt_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate); | 73 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROI
D_H_ | 76 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROI
D_H_ |
| OLD | NEW |