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

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

Issue 2757483002: Move requests from GroupedPermissionInfoBarDelegate to PermissionPromptAndroid (Closed)
Patch Set: rename inline function Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/permissions/grouped_permission_infobar_delegate_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 PermissionPromptAndroid;
17 class PermissionRequest;
18 17
19 // 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
20 // allowed or blocked independently. 19 // allowed or blocked independently.
21 // TODO(tsergeant): Expand this class so it can be used without subclassing. 20 // TODO(tsergeant): Expand this class so it can be used without subclassing.
22 class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { 21 class GroupedPermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
23 public: 22 public:
24 // Public so we can have std::unique_ptr<GroupedPermissionInfoBarDelegate>. 23 // Public so we can have std::unique_ptr<GroupedPermissionInfoBarDelegate>.
25 ~GroupedPermissionInfoBarDelegate() override; 24 ~GroupedPermissionInfoBarDelegate() override;
26 25
27 static infobars::InfoBar* Create( 26 static infobars::InfoBar* Create(PermissionPromptAndroid* permission_prompt,
28 PermissionPromptAndroid* permission_prompt, 27 InfoBarService* infobar_service,
29 InfoBarService* infobar_service, 28 const GURL& requesting_origin);
30 const GURL& requesting_origin,
31 const std::vector<PermissionRequest*>& requests);
32 29
33 bool persist() const { return persist_; } 30 bool persist() const { return persist_; }
34 void set_persist(bool persist) { persist_ = persist; } 31 void set_persist(bool persist) { persist_ = persist; }
35 size_t permission_count() const { return requests_.size(); } 32 size_t PermissionCount() const;
36 33
37 // Returns true if the infobar should display a toggle to allow users to 34 // Returns true if the infobar should display a toggle to allow users to
38 // opt-out of persisting their accept/deny decision. 35 // opt-out of persisting their accept/deny decision.
39 bool ShouldShowPersistenceToggle() const; 36 bool ShouldShowPersistenceToggle() const;
40 37
41 ContentSettingsType GetContentSettingType(size_t position) const; 38 ContentSettingsType GetContentSettingType(size_t position) const;
42 int GetIconIdForPermission(size_t position) const; 39 int GetIconIdForPermission(size_t position) const;
43 40
44 // Message text to display for an individual permission at |position|. 41 // Message text to display for an individual permission at |position|.
45 base::string16 GetMessageTextFragment(size_t position) const; 42 base::string16 GetMessageTextFragment(size_t position) const;
46 43
47 // Toggle accept value for an individual permission at |position|. 44 // Toggle accept value for an individual permission at |position|.
48 void ToggleAccept(size_t position, bool new_value); 45 void ToggleAccept(size_t position, bool new_value);
49 46
50 // ConfirmInfoBarDelegate: 47 // ConfirmInfoBarDelegate:
51 base::string16 GetMessageText() const override; 48 base::string16 GetMessageText() const override;
52 bool Accept() override; 49 bool Accept() override;
53 bool Cancel() override; 50 bool Cancel() override;
54 void InfoBarDismissed() override; 51 void InfoBarDismissed() override;
55 52
56 void PermissionPromptDestroyed(); 53 void PermissionPromptDestroyed();
57 54
58 protected: 55 protected:
59 bool GetAcceptState(size_t position); 56 bool GetAcceptState(size_t position);
60 57
61 private: 58 private:
62 GroupedPermissionInfoBarDelegate( 59 GroupedPermissionInfoBarDelegate(PermissionPromptAndroid* permission_prompt,
63 PermissionPromptAndroid* permission_prompt, 60 const GURL& requesting_origin);
64 const GURL& requesting_origin,
65 const std::vector<PermissionRequest*>& requests);
66 61
67 // ConfirmInfoBarDelegate: 62 // ConfirmInfoBarDelegate:
68 InfoBarIdentifier GetIdentifier() const override; 63 InfoBarIdentifier GetIdentifier() const override;
69 Type GetInfoBarType() const override; 64 Type GetInfoBarType() const override;
70 int GetButtons() const override; 65 int GetButtons() const override;
71 base::string16 GetButtonLabel(InfoBarButton button) const override; 66 base::string16 GetButtonLabel(InfoBarButton button) const override;
72 67
73 const GURL requesting_origin_; 68 const GURL requesting_origin_;
74 const std::vector<PermissionRequest*> requests_;
75 // Whether the accept/deny decision is persisted. 69 // Whether the accept/deny decision is persisted.
76 bool persist_; 70 bool persist_;
77 PermissionPromptAndroid* permission_prompt_; 71 PermissionPromptAndroid* permission_prompt_;
78 72
79 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate); 73 DISALLOW_COPY_AND_ASSIGN(GroupedPermissionInfoBarDelegate);
80 }; 74 };
81 75
82 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROI D_H_ 76 #endif // CHROME_BROWSER_PERMISSIONS_GROUPED_PERMISSION_INFOBAR_DELEGATE_ANDROI D_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/permissions/grouped_permission_infobar_delegate_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698