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 PermissionRequest; | 14 class PermissionRequest; |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class WebContents; | 17 class WebContents; |
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() override; | 27 void Show() override; |
28 bool CanAcceptRequestUpdate() override; | 28 bool MaybeCancelRequest() override; |
29 bool HidesAutomatically() override; | 29 bool HidesAutomatically() override; |
30 void Hide() override; | 30 void Hide() override; |
31 void UpdateAnchorPosition() override; | 31 void UpdateAnchorPosition() override; |
32 gfx::NativeWindow GetNativeWindow() override; | 32 gfx::NativeWindow GetNativeWindow() override; |
33 | 33 |
34 void Closing(); | 34 void Closing(); |
35 void ToggleAccept(int index, bool value); | 35 void ToggleAccept(int index, bool value); |
36 void Accept(); | 36 void Accept(); |
37 void Deny(); | 37 void Deny(); |
38 | 38 |
39 size_t permission_count() const { return requests_.size(); } | 39 size_t permission_count() const { return requests_.size(); } |
40 ContentSettingsType GetContentSettingType(size_t position) const; | 40 ContentSettingsType GetContentSettingType(size_t position) const; |
41 int GetIconIdForPermission(size_t position) const; | 41 int GetIconIdForPermission(size_t position) const; |
42 base::string16 GetMessageTextFragment(size_t position) const; | 42 base::string16 GetMessageTextFragment(size_t position) const; |
43 | 43 |
44 private: | 44 private: |
45 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should | 45 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should |
46 // be safe to hold a raw WebContents pointer here because this class is | 46 // be safe to hold a raw WebContents pointer here because this class is |
47 // destroyed before the WebContents. | 47 // destroyed before the WebContents. |
48 content::WebContents* web_contents_; | 48 content::WebContents* web_contents_; |
49 // |delegate_| is the PermissionRequestManager, which owns this object. | 49 // |delegate_| is the PermissionRequestManager, which owns this object. |
50 Delegate* delegate_; | 50 Delegate* delegate_; |
51 // The current request being displayed (if any). | 51 // The current request being displayed (if any). |
52 std::vector<PermissionRequest*> requests_; | 52 std::vector<PermissionRequest*> requests_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); | 54 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); |
55 }; | 55 }; |
56 | 56 |
57 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ | 57 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ |
OLD | NEW |