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

Side by Side Diff: chrome/browser/permissions/permission_prompt_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
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 PermissionRequest;
11 15
12 namespace content { 16 namespace content {
13 class WebContents; 17 class WebContents;
14 } 18 }
15 19
16 namespace infobars { 20 namespace infobars {
17 class InfoBar; 21 class InfoBar;
18 } 22 }
19 23
20 class PermissionPromptAndroid : public PermissionPrompt { 24 class PermissionPromptAndroid : public PermissionPrompt {
21 public: 25 public:
22 explicit PermissionPromptAndroid(content::WebContents* web_contents); 26 explicit PermissionPromptAndroid(content::WebContents* web_contents);
23 ~PermissionPromptAndroid() override; 27 ~PermissionPromptAndroid() override;
24 28
25 // PermissionPrompt: 29 // PermissionPrompt:
26 void SetDelegate(Delegate* delegate) override; 30 void SetDelegate(Delegate* delegate) override;
27 void Show(const std::vector<PermissionRequest*>& requests, 31 void Show(const std::vector<PermissionRequest*>& requests,
28 const std::vector<bool>& accept_state) override; 32 const std::vector<bool>& accept_state) override;
29 bool CanAcceptRequestUpdate() override; 33 bool CanAcceptRequestUpdate() override;
30 void Hide() override; 34 void Hide() override;
31 bool IsVisible() override; 35 bool IsVisible() override;
32 void UpdateAnchorPosition() override; 36 void UpdateAnchorPosition() override;
33 gfx::NativeWindow GetNativeWindow() override; 37 gfx::NativeWindow GetNativeWindow() override;
34 38
35 void Closing(); 39 void Closing();
36 void ToggleAccept(int index, bool value); 40 void ToggleAccept(int index, bool value);
37 void Accept(); 41 void Accept();
38 void Deny(); 42 void Deny();
39 43
44 size_t permission_count() const { return requests_.size(); }
45 ContentSettingsType GetContentSettingType(size_t position) const;
46 int GetIconIdForPermission(size_t position) const;
47 base::string16 GetMessageTextFragment(size_t position) const;
48
40 private: 49 private:
41 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should 50 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should
42 // be safe to hold a raw WebContents pointer here because this class is 51 // be safe to hold a raw WebContents pointer here because this class is
43 // destroyed before the WebContents. 52 // destroyed before the WebContents.
44 content::WebContents* web_contents_; 53 content::WebContents* web_contents_;
45 // |delegate_| is the PermissionRequestManager, which owns this object. 54 // |delegate_| is the PermissionRequestManager, which owns this object.
46 Delegate* delegate_; 55 Delegate* delegate_;
47 // |infobar_| is owned by the InfoBarService; we keep a pointer here so we can 56 // |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. 57 // ask the service to remove the infobar after it is added.
49 infobars::InfoBar* infobar_; 58 infobars::InfoBar* infobar_;
59 // The current request being displayed (if any).
60 std::vector<PermissionRequest*> requests_;
50 61
51 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); 62 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid);
52 }; 63 };
53 64
54 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ 65 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698