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

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

Issue 2440403002: Make GroupedPermissionInfoBarDelegate's methods call through PermissionPromptAndroid (Closed)
Patch Set: add set and reset Created 4 years, 1 month 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_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 PermissionRequest; 17 class PermissionRequest;
17 18
18 // An InfoBar that displays a group of permission requests, each of which can be 19 // An InfoBar that displays a group of permission requests, each of which can be
19 // allowed or blocked independently. 20 // allowed or blocked independently.
20 // TODO(tsergeant): Expand this class so it can be used without subclassing. 21 // TODO(tsergeant): Expand this class so it can be used without subclassing.
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
(...skipping 14 matching lines...) Expand all
40 int GetIconIdForPermission(size_t position) const; 41 int GetIconIdForPermission(size_t position) const;
41 42
42 // Message text to display for an individual permission at |position|. 43 // Message text to display for an individual permission at |position|.
43 base::string16 GetMessageTextFragment(size_t position) const; 44 base::string16 GetMessageTextFragment(size_t position) const;
44 45
45 // Toggle accept value for an individual permission at |position|. 46 // Toggle accept value for an individual permission at |position|.
46 void ToggleAccept(size_t position, bool new_value); 47 void ToggleAccept(size_t position, bool new_value);
47 48
48 // ConfirmInfoBarDelegate: 49 // ConfirmInfoBarDelegate:
49 base::string16 GetMessageText() const override; 50 base::string16 GetMessageText() const override;
51 bool Accept() override;
52 bool Cancel() override;
53
54 void SetPermissionPrompt(PermissionPromptAndroid* permission_prompt);
55 void ResetPermissionPrompt();
50 56
51 protected: 57 protected:
52 bool GetAcceptState(size_t position); 58 bool GetAcceptState(size_t position);
53 59
54 private: 60 private:
55 GroupedPermissionInfoBarDelegate( 61 GroupedPermissionInfoBarDelegate(
56 const GURL& requesting_origin, 62 const GURL& requesting_origin,
57 const std::vector<PermissionRequest*>& requests); 63 const std::vector<PermissionRequest*>& requests);
58 64
59 // ConfirmInfoBarDelegate: 65 // ConfirmInfoBarDelegate:
60 InfoBarIdentifier GetIdentifier() const override; 66 InfoBarIdentifier GetIdentifier() const override;
61 Type GetInfoBarType() const override; 67 Type GetInfoBarType() const override;
62 int GetButtons() const override; 68 int GetButtons() const override;
63 base::string16 GetButtonLabel(InfoBarButton button) const override; 69 base::string16 GetButtonLabel(InfoBarButton button) const override;
70 GroupedPermissionInfoBarDelegate* AsGroupedPermissionInfoBarDelegate()
71 override;
64 72
65 const GURL requesting_origin_; 73 const GURL requesting_origin_;
66 const std::vector<PermissionRequest*> requests_; 74 const std::vector<PermissionRequest*> requests_;
67 std::vector<bool> accept_states_; 75 std::vector<bool> accept_states_;
68 // Whether the accept/deny decision is persisted. 76 // Whether the accept/deny decision is persisted.
69 bool persist_; 77 bool persist_;
78 PermissionPromptAndroid* permission_prompt_;
70 79
71 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate); 80 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate);
72 }; 81 };
73 82
74 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROI D_H_ 83 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROI D_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698