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

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

Issue 2757483002: Move requests from GroupedPermissionInfoBarDelegate to PermissionPromptAndroid (Closed)
Patch Set: rebase 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
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_PERMISSION_PROMPT_ANDROID_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_
7 7
8 #include <vector>
9
10 #include "base/strings/string16.h"
8 #include "chrome/browser/ui/permission_bubble/permission_prompt.h" 11 #include "chrome/browser/ui/permission_bubble/permission_prompt.h"
12 #include "components/content_settings/core/common/content_settings_types.h"
9 13
10 class InfoBarService; 14 class InfoBarService;
dominickn 2017/03/17 01:48:13 I don't think InfoBarService is needed.
Timothy Loh 2017/03/17 02:23:14 Done.
15 class PermissionRequest;
11 16
12 namespace content { 17 namespace content {
13 class WebContents; 18 class WebContents;
14 } 19 }
15 20
16 namespace infobars { 21 namespace infobars {
17 class InfoBar; 22 class InfoBar;
18 } 23 }
19 24
20 class PermissionPromptAndroid : public PermissionPrompt { 25 class PermissionPromptAndroid : public PermissionPrompt {
21 public: 26 public:
22 explicit PermissionPromptAndroid(content::WebContents* web_contents); 27 explicit PermissionPromptAndroid(content::WebContents* web_contents);
23 ~PermissionPromptAndroid() override; 28 ~PermissionPromptAndroid() override;
24 29
25 // PermissionPrompt: 30 // PermissionPrompt:
26 void SetDelegate(Delegate* delegate) override; 31 void SetDelegate(Delegate* delegate) override;
27 void Show(const std::vector<PermissionRequest*>& requests, 32 void Show(const std::vector<PermissionRequest*>& requests,
28 const std::vector<bool>& accept_state) override; 33 const std::vector<bool>& accept_state) override;
29 bool CanAcceptRequestUpdate() override; 34 bool CanAcceptRequestUpdate() override;
30 void Hide() override; 35 void Hide() override;
31 bool IsVisible() override; 36 bool IsVisible() override;
32 void UpdateAnchorPosition() override; 37 void UpdateAnchorPosition() override;
33 gfx::NativeWindow GetNativeWindow() override; 38 gfx::NativeWindow GetNativeWindow() override;
34 39
35 void Closing(); 40 void Closing();
36 void ToggleAccept(int index, bool value); 41 void ToggleAccept(int index, bool value);
37 void Accept(); 42 void Accept();
38 void Deny(); 43 void Deny();
39 44
45 size_t PermissionCount() const { return requests_.size(); }
46 ContentSettingsType GetContentSettingType(size_t position) const;
47 int GetIconIdForPermission(size_t position) const;
48 base::string16 GetMessageTextFragment(size_t position) const;
49
40 private: 50 private:
41 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should 51 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should
42 // be safe to hold a raw WebContents pointer here because this class is 52 // be safe to hold a raw WebContents pointer here because this class is
43 // destroyed before the WebContents. 53 // destroyed before the WebContents.
44 content::WebContents* web_contents_; 54 content::WebContents* web_contents_;
45 // |delegate_| is the PermissionRequestManager, which owns this object. 55 // |delegate_| is the PermissionRequestManager, which owns this object.
46 Delegate* delegate_; 56 Delegate* delegate_;
47 // |infobar_| is owned by the InfoBarService; we keep a pointer here so we can 57 // |infobar_| is owned by the InfoBarService; we keep a pointer here so we can
48 // ask the service to remove the infobar after it is added. 58 // ask the service to remove the infobar after it is added.
49 infobars::InfoBar* infobar_; 59 infobars::InfoBar* infobar_;
60 // The current request being displayed (if any).
61 std::vector<PermissionRequest*> requests_;
50 62
51 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); 63 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid);
52 }; 64 };
53 65
54 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ 66 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698