OLD | NEW |
---|---|
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 |
dominickn
2017/03/16 03:55:07
Nit: #include <vector>
Timothy Loh
2017/03/17 00:47:27
Done.
| |
8 #include "chrome/browser/ui/website_settings/permission_prompt.h" | 8 #include "chrome/browser/ui/website_settings/permission_prompt.h" |
9 | 9 |
10 class InfoBarService; | 10 class InfoBarService; |
dominickn
2017/03/16 03:55:07
nit: class PermissionRequest;
Timothy Loh
2017/03/17 00:47:27
Done.
| |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class WebContents; | 13 class WebContents; |
14 } | 14 } |
15 | 15 |
16 namespace infobars { | 16 namespace infobars { |
17 class InfoBar; | 17 class InfoBar; |
18 } | 18 } |
19 | 19 |
20 class PermissionPromptAndroid : public PermissionPrompt { | 20 class PermissionPromptAndroid : public PermissionPrompt { |
21 public: | 21 public: |
22 explicit PermissionPromptAndroid(content::WebContents* web_contents); | 22 explicit PermissionPromptAndroid(content::WebContents* web_contents); |
23 ~PermissionPromptAndroid() override; | 23 ~PermissionPromptAndroid() override; |
24 | 24 |
25 // PermissionPrompt: | 25 // PermissionPrompt: |
26 void SetDelegate(Delegate* delegate) override; | 26 void SetDelegate(Delegate* delegate) override; |
27 void Show(const std::vector<PermissionRequest*>& requests, | 27 void Show(const std::vector<PermissionRequest*>& requests, |
28 const std::vector<bool>& accept_state) override; | 28 const std::vector<bool>& accept_state) override; |
29 bool CanAcceptRequestUpdate() override; | 29 bool CanAcceptRequestUpdate() override; |
30 void Hide() override; | 30 void Hide() override; |
31 bool IsVisible() override; | 31 bool IsVisible() override; |
32 void UpdateAnchorPosition() override; | 32 void UpdateAnchorPosition() override; |
33 gfx::NativeWindow GetNativeWindow() override; | 33 gfx::NativeWindow GetNativeWindow() override; |
34 | 34 |
35 void Closing(); | 35 void Closing(); |
36 void ToggleAccept(int index, bool value); | 36 void ToggleAccept(int index, bool value); |
37 void Accept(); | 37 void Accept(); |
38 void Deny(); | 38 void Deny(); |
39 | 39 |
40 const std::vector<PermissionRequest*>& Requests() { return requests_; } | |
dominickn
2017/03/16 03:55:07
Instead of exposing the requests directly, I think
Timothy Loh
2017/03/17 00:47:27
Done.
| |
41 | |
40 private: | 42 private: |
41 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should | 43 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should |
42 // be safe to hold a raw WebContents pointer here because this class is | 44 // be safe to hold a raw WebContents pointer here because this class is |
43 // destroyed before the WebContents. | 45 // destroyed before the WebContents. |
44 content::WebContents* web_contents_; | 46 content::WebContents* web_contents_; |
45 // |delegate_| is the PermissionRequestManager, which owns this object. | 47 // |delegate_| is the PermissionRequestManager, which owns this object. |
46 Delegate* delegate_; | 48 Delegate* delegate_; |
47 // |infobar_| is owned by the InfoBarService; we keep a pointer here so we can | 49 // |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. | 50 // ask the service to remove the infobar after it is added. |
49 infobars::InfoBar* infobar_; | 51 infobars::InfoBar* infobar_; |
52 // The current request being displayed (if any). | |
53 std::vector<PermissionRequest*> requests_; | |
50 | 54 |
51 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); | 55 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); |
52 }; | 56 }; |
53 | 57 |
54 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ | 58 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ |
OLD | NEW |