Chromium Code Reviews| 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_SINGLE_PERMISSION_INFOBAR_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_PERMISSIONS_SINGLE_PERMISSION_INFOBAR_DELEGATE_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "chrome/browser/permissions/permission_infobar_delegate.h" | |
| 12 #include "chrome/browser/permissions/permission_util.h" | |
| 13 #include "components/content_settings/core/common/content_settings_types.h" | |
| 14 #include "content/public/browser/permission_type.h" | |
| 15 | |
| 16 class Profile; | |
| 17 | |
| 18 // Base class for single permission infobars. Implements the default behavior so | |
| 19 // 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.
| |
| 20 // A basic implementor only needs to implement the methods that provide an icon | |
| 21 // and a message text to the infobar. | |
| 22 class SinglePermissionInfoBarDelegate : public PermissionInfoBarDelegate { | |
| 23 | |
| 24 public: | |
| 25 ~SinglePermissionInfoBarDelegate() override; | |
| 26 ContentSettingsType GetContentSettingType(int index) const override; | |
| 27 bool ShouldShowPersistenceToggle() const override; | |
| 28 | |
| 29 // ConfirmInfoBarDelegate: | |
| 30 base::string16 GetMessageText() const override; | |
|
raymes
2016/08/17 03:36:40
I think this can be private? It's public in the ba
| |
| 31 | |
| 32 protected: | |
| 33 SinglePermissionInfoBarDelegate(const GURL& requesting_origin, | |
| 34 content::PermissionType permission_type, | |
| 35 ContentSettingsType content_settings_type, | |
| 36 bool user_gesture, | |
| 37 Profile* profile, | |
| 38 const PermissionSetCallback& callback); | |
| 39 | |
| 40 virtual int GetMessageResourceId() const = 0; | |
|
raymes
2016/08/17 03:36:40
I think this can be private?
| |
| 41 | |
| 42 private: | |
| 43 void SetPermission(bool update_content_setting, PermissionAction decision); | |
| 44 | |
| 45 // ConfirmInfoBarDelegate: | |
| 46 base::string16 GetButtonLabel(InfoBarButton button) const override; | |
| 47 bool Accept() override; | |
| 48 bool Cancel() override; | |
| 49 void InfoBarDismissed() override; | |
| 50 | |
| 51 content::PermissionType permission_type_; | |
| 52 ContentSettingsType content_settings_type_; | |
| 53 Profile* const profile_; | |
| 54 const PermissionSetCallback callback_; | |
| 55 bool action_taken_; | |
| 56 bool user_gesture_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(SinglePermissionInfoBarDelegate); | |
| 59 }; | |
| 60 | |
| 61 #endif // CHROME_BROWSER_PERMISSIONS_SINGLE_PERMISSION_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |