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 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #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" | 12 #include "components/content_settings/core/common/content_settings_types.h" |
13 | 13 |
14 class InfoBarService; | |
15 class PermissionRequest; | 14 class PermissionRequest; |
16 | 15 |
17 namespace content { | 16 namespace content { |
18 class WebContents; | 17 class WebContents; |
19 } | 18 } |
20 | 19 |
21 namespace infobars { | |
22 class InfoBar; | |
23 } | |
24 | |
25 class PermissionPromptAndroid : public PermissionPrompt { | 20 class PermissionPromptAndroid : public PermissionPrompt { |
26 public: | 21 public: |
27 explicit PermissionPromptAndroid(content::WebContents* web_contents); | 22 explicit PermissionPromptAndroid(content::WebContents* web_contents); |
28 ~PermissionPromptAndroid() override; | 23 ~PermissionPromptAndroid() override; |
29 | 24 |
30 // PermissionPrompt: | 25 // PermissionPrompt: |
31 void SetDelegate(Delegate* delegate) override; | 26 void SetDelegate(Delegate* delegate) override; |
32 void Show(const std::vector<PermissionRequest*>& requests, | 27 void Show(const std::vector<PermissionRequest*>& requests, |
33 const std::vector<bool>& accept_state) override; | 28 const std::vector<bool>& accept_state) override; |
34 bool CanAcceptRequestUpdate() override; | 29 bool CanAcceptRequestUpdate() override; |
(...skipping 12 matching lines...) Expand all Loading... |
47 int GetIconIdForPermission(size_t position) const; | 42 int GetIconIdForPermission(size_t position) const; |
48 base::string16 GetMessageTextFragment(size_t position) const; | 43 base::string16 GetMessageTextFragment(size_t position) const; |
49 | 44 |
50 private: | 45 private: |
51 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should | 46 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should |
52 // be safe to hold a raw WebContents pointer here because this class is | 47 // be safe to hold a raw WebContents pointer here because this class is |
53 // destroyed before the WebContents. | 48 // destroyed before the WebContents. |
54 content::WebContents* web_contents_; | 49 content::WebContents* web_contents_; |
55 // |delegate_| is the PermissionRequestManager, which owns this object. | 50 // |delegate_| is the PermissionRequestManager, which owns this object. |
56 Delegate* delegate_; | 51 Delegate* delegate_; |
57 // |infobar_| is owned by the InfoBarService; we keep a pointer here so we can | |
58 // ask the service to remove the infobar after it is added. | |
59 infobars::InfoBar* infobar_; | |
60 // The current request being displayed (if any). | 52 // The current request being displayed (if any). |
61 std::vector<PermissionRequest*> requests_; | 53 std::vector<PermissionRequest*> requests_; |
62 | 54 |
63 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); | 55 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); |
64 }; | 56 }; |
65 | 57 |
66 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ | 58 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ |
OLD | NEW |