Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: chrome/browser/permissions/grouped_permission_infobar_delegate.h

Issue 2319443002: Add InfoBarIdentifier to GroupedPermissionInfoBarDelegate (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
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 16
17 namespace infobars { 17 namespace infobars {
18 class InfoBarManager; 18 class InfoBarManager;
19 } 19 }
20 20
21 // Configures an InfoBar to display a group of permission requests, each of 21 // Configures an InfoBar to display a group of permission requests, each of
22 // which can be allowed or blocked independently. 22 // which can be allowed or blocked independently.
23 // TODO(tsergeant): Expand this class so it can be used without subclassing. 23 // TODO(tsergeant): Expand this class so it can be used without subclassing.
24 class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { 24 class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
25 public: 25 public:
Peter Kasting 2016/09/08 04:06:24 Nit: Make as much of this as private as possible.
lshang 2016/09/21 07:09:33 Done.
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(
Peter Kasting 2016/09/08 04:06:24 Today it seems there is only an Android implementa
tsergeant 2016/09/08 05:19:57 This infobar is Android-only.
Peter Kasting 2016/09/08 06:24:08 OK. Can it be moved to Android-specific files or
lshang 2016/09/21 07:09:33 Done.
lshang 2016/09/21 07:09:33 On 2016/09/08 04:06:24, Peter Kasting wrote:
lshang 2016/09/21 07:09:33 How about we add "_android" at the end of file nam
Peter Kasting 2016/09/21 18:44:39 Yes, adding _android on the filename is fine.
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(
Peter Kasting 2016/09/08 04:06:24 Nit: InfoBarDelegate constructors should never be
lshang 2016/09/21 07:09:33 Done. Create delegate within Create() method.
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 base::string16 GetMessageText() const override; 36 base::string16 GetMessageText() const override;
Peter Kasting 2016/09/08 04:06:24 Nit: Needs a // ConfirmInfoBarDelegate: heading.
lshang 2016/09/21 07:09:33 Done.
37 37
38 int GetPermissionCount() const; 38 int GetPermissionCount() const;
Peter Kasting 2016/09/08 04:06:24 Nit: For whatever of these are basically simple ge
lshang 2016/09/21 07:09:33 Done.
39 ContentSettingsType GetContentSettingType(int index) const; 39 ContentSettingsType GetContentSettingType(int index) const;
40 int GetIconIdForPermission(int index) const; 40 int GetIconIdForPermission(int index) const;
41 // Message text to display for an individual permission at |index|. 41 // Message text to display for an individual permission at |index|.
Peter Kasting 2016/09/08 04:06:24 Nit: Blank line above any above-function comments.
lshang 2016/09/21 07:09:33 Done.
42 base::string16 GetMessageTextFragment(int index) const; 42 base::string16 GetMessageTextFragment(int index) const;
43 43
44 void ToggleAccept(int position, bool new_value); 44 void ToggleAccept(int position, bool new_value);
Peter Kasting 2016/09/08 04:06:24 Nit: Needs descriptive comment
lshang 2016/09/21 07:09:33 Done.
45 45
46 protected: 46 protected:
47 bool GetAcceptState(int position); 47 bool GetAcceptState(int position);
48 48
49 private: 49 private:
50 // ConfirmInfoBarDelegate: 50 // ConfirmInfoBarDelegate:
51 base::string16 GetButtonLabel(InfoBarButton button) const override; 51 base::string16 GetButtonLabel(InfoBarButton button) const override;
52 int GetButtons() const override; 52 int GetButtons() const override;
53 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
Peter Kasting 2016/09/08 04:06:24 Nit: Move this function to the top of this group o
lshang 2016/09/21 07:09:33 Done.
53 54
54 // InfoBarDelegate: 55 // InfoBarDelegate:
Peter Kasting 2016/09/08 04:06:24 Nit: While here: Remove this comment, move the fun
lshang 2016/09/21 07:09:33 Done.
55 Type GetInfoBarType() const override; 56 Type GetInfoBarType() const override;
56 57
57 const GURL requesting_origin_; 58 const GURL requesting_origin_;
58 const std::vector<ContentSettingsType> types_; 59 const std::vector<ContentSettingsType> types_;
59 std::vector<bool> accept_states_; 60 std::vector<bool> accept_states_;
60 61
61 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate); 62 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate);
62 }; 63 };
63 64
64 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_ 65 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698